Hello, I am trying to render a partial with a collection <%= render :partial => ''classified'', :collection => @classifieds %> this one works but if I changed my partial name to list for example <%= render :partial => ''list'', :collection => @classifieds %> and changed the name of my partial to _list.html.erb I get the error undefined local variable or method `classified'' for #<ActionView::Base:0x4a55bf0> does the name of the partial must match the name of the variable classified? What is the way around that Can someone help please -- 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 -~----------~----~----~----~------~----~------~--~---
I figured out it is a naming convention issue, I have renamed variables in my partial to list instead of classified (as per the partial name) and it worked but is there any way around that Issam -- 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 -~----------~----~----~----~------~----~------~--~---
On 17 Feb 2008, at 08:43, Issam Alameh wrote:> > I figured out it is a naming convention issue, I have renamed > variables > in my partial to list instead of classified (as per the partial name) > and it worked > > but is there any way around thatNope, that''s pretty much the way partials work - you get a local variable with the same name as the partial Fred> > > Issam > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 17 Feb 2008, at 08:43, Issam Alameh wrote: > >> >> I figured out it is a naming convention issue, I have renamed >> variables >> in my partial to list instead of classified (as per the partial name) >> and it worked >> >> but is there any way around that > Nope, that''s pretty much the way partials work - you get a local > variable with the same name as the partial > > Fredi tried to run hello.rb which contains puts "HAI DEEPESH">>ruby hello.rb but i am gettingNameError: undefined local variable or method `hello'' for main:Object from (irb):6 -- Posted via http://www.ruby-forum.com/.
On Aug 20, 9:22 am, Deepesh Cp <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > i tried to run hello.rb which contains puts "HAI DEEPESH">>ruby hello.rb but i am getting > > NameError: undefined local variable or method `hello'' for main:Object > from (irb):6Sounds like you''re trying to do this from an irb console. Why not do it from the command prompt ? (if you do want to shell out and execute something from irb you should have a look at `` or system) Fred> -- > Posted viahttp://www.ruby-forum.com/.