Passing values between controllers

263 views
Skip to first unread message

cyber c.

unread,
Jun 27, 2012, 6:32:33 PM6/27/12
to rubyonra...@googlegroups.com
Hi,

I have 2 controllers A and B. The create method in controller A is
programmed to redirect to B#index method. I want to pass data between my
controllers, so i have made use of the params hash. But i cannot access
the params hash on the index method of B controller. what is the right
way to pass values between controllers?

--
Posted via http://www.ruby-forum.com/.

aash dhariya

unread,
Jun 28, 2012, 3:05:26 AM6/28/12
to rubyonra...@googlegroups.com
i think you can pass data as the get parameters along with the request i.e generate the url which contains the parameters that you want to pass

--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.




--
Thanks, 
Aash

Swati Verma

unread,
Jun 28, 2012, 3:31:32 AM6/28/12
to rubyonra...@googlegroups.com
You can pass parameter as 
redirect_to :controller=>'tips', :action => 'show', :id => "1"
or 
redirect_to params[:search].merge! (:action => 'list')
Reply all
Reply to author
Forward
0 new messages