
圖1 資料表編輯

圖2 欄位編輯
Warning (512): (Model::validates) Parameter usage is deprecated, use Model::set() to update your fields first [CORE\cake\libs\model\model.php, line 2018]
if ($this->MyModel->validates($this->data)) {
//code...
}
if ($this->MyModel->create($this->data) && $this->MyModel->validates()) {
//code...
}
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'db',
'prefix' => '',
'encoding' => 'UTF8' // 加入這行
);
}
xml_http_request "/store/add_to_cart" , :id => ruby_book.id
xml_http_request(request_method, path, parameters = nil, headers = nil)
Performs an XMLHttpRequest request with the given parameters, mirroring a request from the Prototype library.
The request_method is :get, :post, :put, :delete or :head; the parameters are nil, a hash, or a url-encoded or multipart string; the headers are a hash. Keys are automatically upcased and prefixed with ‘HTTP_’ if not already.
This method is also aliased as xhr
xml_http_request :post, "/store/add_to_cart" , :id => ruby_book.id
No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).
若要解決此問題,必須將 app\controllers\application.rb中的protect_from_forgery # :secret => 'your_secret_id'修改為
protect_from_forgery :secret => 'your_secret_id'