Forum: Ruby on Rails Rails tutorial; CRD working, U failing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D64ad32131be178b4a69c1c55e27fe06?d=identicon&s=25 unknown (Guest)
on 2013-08-22 10:58
(Received via mailing list)
Using as a guide.
 Create, Read, Delete all work.  Update fails:

NoMethodError in WordsController#update

private method `update' called for #<Word:0xae98360>

(I chose to make a list of words rather than of posts.)

The Request parameters:

 "definition"=>"Like a cat; stealthy"},
 "commit"=>"Update Word",

The "update" method from the controller:

class WordsController < ApplicationController
  def update
    @word = Word.find(params[:id])

    if @word.update(params[:definition])
      redirect_to @word
      render 'edit'

rake routes:
      PUT    /words/:id(.:format)                        words#update

Context information:
rails -v
Rails 3.2.2

ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]

In case relevant:  CentOS release 5.5 (Final)

I'm sure this is a simple thing and may have to do with a different
of Rails.  However, I've not had success pursuing that line.

Does anyone have a good idea why I'd be getting the error on the update

5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-08-22 11:37
(Received via mailing list)
On 21 August 2013 19:01,  <> wrote:
>     if @word.update(params[:definition])
That should be @word.update_attributes( ..)

This topic is locked and can not be replied to.