Max*_*Max 1 ruby ruby-on-rails crud
任务模型只有一个字段:标题.
我已经创建了一个表单,用一个字段添加一个新任务:title
但是在create方法中,我们可以看到标题被"test"填充
但在查询中,我们可以看到"无"......任何想法?
谢谢
Started POST "/tasks" for 127.0.0.1 at 2013-01-03 13:16:44 -0500
Processing by TasksController#create as HTML
Parameters: {"utf8"=>"?", "authenticity_token"=>"iWaK1QX6VCyeUCueLrRNErJEtdm/ZNxg4d3LU0vKjnY=", "task"=>{"title"
=>"test"}, "commit"=>"Add a new task "}
(0.1ms) begin transaction
SQL (0.9ms) INSERT INTO "tasks" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Thu, 03 Jan 2013 18:16:44 UTC +00:00], ["title", nil], ["updated_at", Thu, 03 Jan 2013 18:16:44 UTC +00:00]]
(0.8ms) commit transaction
Redirected to http://0.0.0.0:3000/tasks
Completed 302 Found in 8ms (ActiveRecord: 1.8ms)
Run Code Online (Sandbox Code Playgroud)
这是创建方法
def create
@task = Task.new(params[:post])
if @task.save
redirect_to tasks_path, :notice => "Task successfully saved"
else
render "new"
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
242 次 |
| 最近记录: |