Pass a varible from view to controller


#1

please can anyone suggest me a code to pass a variable whichis in the
view
to controller


#2

Ishara G. wrote:

please can anyone suggest me a code to pass a variable whichis in the
view
to controller

Can you please provide the exact problem? So that can try for solution.


#3

On Mon, Feb 23, 2009 at 2:37 AM, Priya B. <
removed_email_address@domain.invalid> wrote:

Ishara G. wrote:

please can anyone suggest me a code to pass a variable whichis in the
view
to controller

Can you please provide the exact problem? So that can try for solution.

Hi, I agree with Priya. What are you trying to do exactly? Please
provide
a use case or
scenario.

-Conrad


#4

Yes


#5

basically you got two possibilities:

  1. write the value into a session-variable
    session[:wtf] = “some string or value”

  2. pass your value as a parameter to some action and read params in
    your controller:
    view:
    <%= link_to “my_action” :controller => :bla, :action
    => :my_action, :wtf => “some string or value” %>
    controller:
    def my_action
    puts params[:wtf]
    end