The problem variable here is @item_class. It''s not passing as an extra parameter. I have in my partial <%= @item_class.name %> #Just to make sure @item_class is not null <%= link_to_if someCondition, ''myLink'', :action=>:myLinkAction, :id => @item,:item_class=> @item_class.name %> the above renders Photo <a href="/item/myLinkAction/10">myLink</a> which is missing the extra parameter Photo. Why don''t I see <a href="/item/myLinkAction/10?item_class=Photo">myLink</a> if I add a string like ''wibble'' <%= link_to_if someCondition, ''myLink'', :action=>:myLinkAction, :id => @item,:item_class=> @item_class.name, :extra=>''wibble'' %> I get Photo <a href="/item/myLinkAction/10?extra=wibble">myLink</a> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> if I add a string like ''wibble'' > <%= link_to_if someCondition, ''myLink'', :action=>:myLinkAction, :id => > @item,:item_class=> @item_class.name, :extra=>''wibble'' %>if you enter :item_class=> ''wibble'' what do you get? -- 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 -~----------~----~----~----~------~----~------~--~---
Ok, if I switch it to <%= @item_class.name %> <%= link_to_if someCondition, ''myLink'', :action=>:myLinkAction, :id => @item,:extras=> @item_class.name, :item_class=>''wibble'' %> I get Photo <a href="/item/myLinkAction/10?extras=Photo">myLink</a> What''s the problem with using a parameter having a same name as a variable? I didn''t see this issue until I went to 1.2.2 from 1.1.6. I REALLY appreciate the help, it''s been about 2 weeks I''ve been wrestling with this. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yottameter wrote:> Ok, if I switch it to > > <%= @item_class.name %> > <%= link_to_if someCondition, ''myLink'', :action=>:myLinkAction, :id => > @item,:extras=> @item_class.name, :item_class=>''wibble'' %>Yeah, seems the link_to_if helper thinks your trying to assign a value to the :item_class symbol which already exists, not pass it a param. Have you thought about renaming your param? You could override the link_to_if helper and see what it''s spitting out: def link_to_if(condition, name, options = {}, html_options = {}, *parameters_for_method_reference, &block) return *parameters_for_method_reference end no clue if that''ll work though.... good luck. -- 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 -~----------~----~----~----~------~----~------~--~---
One other note, this only happens with named routes. item_class is assigned in the named route, I get the results above. If I manually type it into the url, it''s fine. I''ll try your suggestion. Thanks again for the help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok if I return the various arguments passed in, I see: condition: true name: myLink options:item_classwibbleextrasPhotoactionmyLinkActionid html_options: NULL *parameters_for_method_reference: NULL No block supplied, so didn''t check that. What were you expecting for *parameters for method_reference? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
parameters_for_method_reference should probably be nil. What is the route for this action? What does url_for(:action=>:myLinkAction, :id =>> @item, :extras=> @item_class.name, :item_class=>''wibble'') generate?On Mar 12, 9:26 am, "Yottameter" <yottame...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> Ok if I return the various arguments passed in, I see: > > condition: true > name: myLink > options:item_classwibbleextrasPhotoactionmyLinkActionid > html_options: NULL > *parameters_for_method_reference: NULL > > No block supplied, so didn''t check that. > > What were you expecting for *parameters for method_reference?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The url_for generates: /item/myLinkAction?extras=Photo On Mar 11, 8:00 pm, "eden li" <eden...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> parameters_for_method_reference should probably be nil. > > What is the route for this action? What does > url_for(:action=>:myLinkAction, :id => > > > @item, :extras=> @item_class.name, :item_class=>''wibble'') generate? > > On Mar 12, 9:26 am, "Yottameter" <yottame...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > Ok if I return the various arguments passed in, I see: > > > condition: true > > name: myLink > > options:item_classwibbleextrasPhotoactionmyLinkActionid > > html_options: NULL > > *parameters_for_method_reference: NULL > > > No block supplied, so didn''t check that. > > > What were you expecting for *parameters for method_reference?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---