First you have to find the product by:
 @product = Product.find(params[:id])
 @product.title =  "You don't decide the title! I do!"
  @product.save


On Feb 21, 12:19 am, Guillaume Loader <rails-mailing-l...@andreas-
s.net> wrote:
> Hello everyone!
>
> I'm trying to modify an example from a book. The example show how to
> create a scaffold for a table.
>
> But I want to change the way things are modified.
>
> Here is the method in my controller :
>
>   def update
>     @product = Product.find(params[:id])
>
>     respond_to do |format|
>       if @product.update_attributes(params[:product])
>         flash[:notice] = 'Product was successfully updated.'
>         format.html { redirect_to(@product) }
>         format.xml  { head :ok }
>       else
>         format.html { render :action => "edit" }
>         format.xml  { render :xml => @product.errors, :status =>
> :unprocessable_entity }
>       end
>     end
>   end
>
> So I tried to add this line :
>
> Product.title =  "You don't decide the title! I do!"
>
> after @product = Product.find(params[:id])
>
> But I got an error (undefined method `title=' for #<Class:0x365b654>)
>
> Could you help me?
>
> Thank you!
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to