I have this form tag: <% form_remote_tag :update => ''hotel-loyalties'', :url => { :action => ''make_hotel_loyalty'', :id => @user.id, :manager => @manager.id end } do -%> I only want to pass the @manager value if it is not blank. I tried: <% form_remote_tag :update => ''hotel-loyalties'', :url => { :action => ''make_hotel_loyalty'', :id => @user.id, if !@manager.blank? :manager => @manager.id end } do -%> But that didn''t work. I thought that I had seen something similiar before. Does anyone know how do to do this or if it is even possible? Thanks, -S -- 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 11/6/07, Shandy Nantz <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have this form tag: > > <% form_remote_tag :update => ''hotel-loyalties'', :url => { :action => > ''make_hotel_loyalty'', :id => @user.id, :manager => @manager.id end } do > -%> > > I only want to pass the @manager value if it is not blank. I tried: > > <% form_remote_tag :update => ''hotel-loyalties'', :url => { :action => > ''make_hotel_loyalty'', :id => @user.id, if !@manager.blank? :manager => > @manager.id end } do -%> > > But that didn''t work. I thought that I had seen something similiar > before. Does anyone know how do to do this or if it is even possible? > Thanks,nil params aren''t passed, so you could do: :manager => @manager.blank? ? nil : @manager --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bob Showalter wrote:> > nil params aren''t passed, so you could do: > > :manager => @manager.blank? ? nil : @managerThat worked, thank you very much, -S -- 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 -~----------~----~----~----~------~----~------~--~---