[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

update: NoMethodError?

(D. Alvarado)

8/5/2008 10:08:00 PM

Hi,

I'm trying to update an existing model from form data, by doing

def update
# Get the subscriber corresponding to the client.
params[:form][:user_id] = session[:user_id]
@user = User.find(session[:user_id])
@form = Form.find_by_user_id(@user.id)
@form.update(params[:form])
if (!@form.valid?)
flash[:notice] = "Form is invalid."
render :action => 'edit'
else
@form.save
redirect_to :controller => 'order', :action =>
'new'
end
end

but the line "@form.update(params[:form])" gives me the error

NoMethodError in FormsController#update
private method `update' called for #<Form:0xb785ef28>

I'm sure this is a syntax thing that I'm missing, but any advice you
can offer is appreciated, - Dave