SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 'error_message_for' error

    Pg 166 of "Build you own Ruby on Rails Web Applications" calls for the code line

    Code:
    <%= error_message_for 'story' %>
    resulting in:


    Code:
    NoMethodError in Story#new
    
    Showing app/views/story/new.rhtml where line #1 raised:
    
    undefined method `error_message_for' for #<#<Class:0x4a5eaac>:0x4a5ea84>
    
    Extracted source (around line #1):
    
    1: <%= error_message_for 'story' %>
    2: <% form_for :story do |f| %>
    3: <p>
    4:    Name:<br />
    does any one have any suggestions?

    Conrad

  2. #2
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't been doing rails that long but I thought it should be

    error_messages_for

    where message should have been messages.

    If you ever need to check you can always do a search for the method at api.rubyonrails.org
    Goofy
    Life is what you make it!
    Follow your dreams!

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found it! I now have a sore forehead!

    I used message (singular) instead of messages (plural)

    Thanks for making me check the api!
    ---------------------------
    Conrad Parvin
    Web Development: http://www.parvin-associates.com
    Web Hosting: http://www.integrityhosting.biz


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •