1 Reply Latest reply on Apr 22, 2013 1:27 AM by Kutir Mobility

    Pass values from one controller to other

      I just started learning Rho.


      I created login screen at index.erb. and want to pass the username to next controller showing Welcome username at the header..

      how to do that?


      Aplication Index.erb : @welcomecontroller = WelcomeController.create("userName" => "Ankur")


      Want to display in index.erb of WelcomeController

      <h1>Welcome<%WelcomeController.userName %> </h1>

        • Re: Pass values from one controller to other
          Kutir Mobility

          Hi Ankur,


          If you would like to just pass a value to another controller try this from your login controller.


          WebView.navigate(url_for(:controller=>:Welcome,:action => :index, :query=>{"userName" => "Kutir"}))


          Then you can access the value in another controller (say welcome controller)


          class WelcomeController < Rho::RhoController

            def index

              @userName = @params["userName"]



          In your index.erb,


          <h1>Welcome <%= @userName %></h1>



          Surendran S

          Kutir Mobility