Sunday, May 22, 2011

Re: [Rails] Re: undefined method `posts_path'

On 22 May 2011 08:09, John shelfer <johnsshelfer@gmail.com> wrote:
>
>
> On May 22, 2:55 am, Colin Law <clan...@googlemail.com> wrote:
>> On 22 May 2011 07:41, John shelfer <johnsshel...@gmail.com> wrote:
>>> ...
>> > "undefined method `name' for #<Post id: nil, created_at: nil,
>> > updated_at: nil>"
>>
>> Look at the error and try and work out what it means.  There should
>> also be an indication of which line generated the error.
>    Error is generated at link 8 in following code.
>
>
> <%= link_to 'New Post', new_post_path%>
> <%= form_for(@post) do |f| %>
>
>
>  <div class="field">
>    <%= f.label :name %><br />
>    <%= f.text_field :name %>

Here you are asking to display (and allow entry) of @post.name,
whereas the error suggests that Post does not have a method 'name'.

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate