Why, when I am trying to manually assign permalinks, would I get this
from the ruby console:
s.update_attribute :permalink, ''my-shiny-weblog''
NoMethodError: undefined method `permalink='' for
#<Story:0x32361c8>
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/base.rb:1858:in `method_missing''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/validations.rb:772:in `send''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/validations.rb:772:in `update_attribute''
from (irb):54
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 4/10/07, Zkidd <zacharykidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Why, when I am trying to manually assign permalinks, would I get this > from the ruby console:If you don''t have a permalink field in your db, yes. Pat p.s. Actually you get that any time you don''t have a permalink= method (just like it says). Rails just happens to create that method for you based on your attributes> s.update_attribute :permalink, ''my-shiny-weblog'' > NoMethodError: undefined method `permalink='' for #<Story:0x32361c8> > from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ > active_record/base.rb:1858:in `method_missing'' > from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ > active_record/validations.rb:772:in `send'' > from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ > active_record/validations.rb:772:in `update_attribute'' > from (irb):54 > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 4/10/07, Zak Kidd <zacharykidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok. . . I hope I am not stretching your patience but now I get this (I > assume it''s obvious that I just started this stuff last week: > > > NoMethodError in Story#show > > Showing app/views/story/show.rhtml where line #1 raised: You have a nil > object when you didn''t expect it! > The error occurred while evaluating nil.name > > > Extracted source (around line #1): 1: <h2><%= @story.name %></h2> > 2: <p><%= link_to @story.link, @story.link %></p>That means that your @story variable is nil. Did you set it in your controller? Something like: @story = Story.find params[:id] Pat --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am receiving this error messagek
NoMethodError in Story#index
Showing app/views/story/index.rhtml where line #2 raised:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.size
Extracted source (around line #2):
1: <h2>
2: <%= "Showing #{ pluralize(@stories.size, ''story'',
''stories'') }"
%>
3: </h2>
4: <%= render :partial => ''story'', :collection =>
@stories %>
Any help would be appreciated. Thanks.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Zkidd wrote:> I am receiving this error messagek > > NoMethodError in Story#index > > Showing app/views/story/index.rhtml where line #2 raised: > > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.size > Extracted source (around line #2): > > 1: <h2> > 2: <%= "Showing #{ pluralize(@stories.size, ''story'', ''stories'') }" > %> > 3: </h2> > 4: <%= render :partial => ''story'', :collection => @stories %> > > Any help would be appreciated. Thanks.Your @stories instance variable is nil, meaning it doesn''t exist or has no data in it. In your story controller index method, are you creating the instance variable called @stories? -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zkidd wrote:> I am receiving this error messagek > > NoMethodError in Story#index > > Showing app/views/story/index.rhtml where line #2 raised: > > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.size > Extracted source (around line #2): > > 1: <h2> > 2: <%= "Showing #{ pluralize(@stories.size, ''story'', ''stories'') }" > %> > 3: </h2> > 4: <%= render :partial => ''story'', :collection => @stories %> > > Any help would be appreciated. Thanks.@stories is nil. Make sure the query or whatever object that variable is pointing at is not nil. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---