Can anyone tell me how to pass a value from a link_to in a view to a controler? The value is just a piece of text for the time being. <%= link_to ''About Us'', :action => ''about'', :params => ''string'' %> ??? -- Posted via http://www.ruby-forum.com/.
Hi, John, try link_to ''about us'', :action => ''about'', :my_param => "we''re the greatest" and have a look at the development.log. you should be able to pick up params[:my_param] and it should be able to tell you something about yourself... Cheers, Jan On 8/4/06, John Butler <johnnybutler7@gmail.com> wrote:> > Can anyone tell me how to pass a value from a link_to in a view to a > controler? > > The value is just a piece of text for the time being. > > <%= link_to ''About Us'', :action => ''about'', :params => ''string'' %> > > ??? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060804/323b330e/attachment.html
John, Any param in the url section (second part) of the link_to call that is not matched with rails routing is passed as a parameter. <%= link_to ''Edit'', { :action => ''edit'', :my_var => ''dude'' } %> now in the controller params[:my_var] = ''dude'' Hope this helps, Zack On 8/4/06, John Butler <johnnybutler7@gmail.com> wrote:> Can anyone tell me how to pass a value from a link_to in a view to a > controler? > > The value is just a piece of text for the time being. > > <%= link_to ''About Us'', :action => ''about'', :params => ''string'' %> > > ??? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >