Object.save is not creating an insert statement


#1

I have a model for a task class. When I try to save a task, for some
reason no INSERT statement is being generated. Here’s the pertinent
part of the

development.log:

Processing TasksController#create_fromProject (for 70.247.24.238 at
2006-03-08 14:20:30) [POST]
Parameters: {“commit”=>“Create”, “action”=>“create_fromProject”,
“task”=>{…blahblahblah…}, “id”=>“3”, “controller”=>“tasks”}
Task Columns (0.000345) SHOW FIELDS FROM tasks
SQL (0.000133) BEGIN
SQL (0.000124) COMMIT
Redirected to …

And the code in the task controller:

def create_fromProject
@task = Task.new(params[:task])
if @task.save
flash[:notice] = ‘Task was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

So what’s the deal?

Thanks!


#2

Am Mittwoch, den 08.03.2006, 23:23 +0100 schrieb John Stackhouse:

“task”=>{…blahblahblah…}, “id”=>“3”, “controller”=>“tasks”}
if @task.save
flash[:notice] = ‘Task was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

So what’s the deal?

Seems to look ok for me. Perhaps the problem is in your model code.


Norman T.

http://blog.inlet-media.de


#3

The data you are passing to the task object might be failing some of the
validation you set up in the model.


#4

Am Donnerstag, den 09.03.2006, 09:37 +0000 schrieb Kamal F.:

Task Columns (0.000345) SHOW FIELDS FROM tasks
flash[:notice] = ‘Task was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

But if, there should not be a redirection.


Norman T.

http://blog.inlet-media.de


#5

Norman T. wrote:

But if, there should not be a redirection.

Yes. Perhaps a before_save method is returning false.


We develop, watch us RoR, in numbers too big to ignore.