I have my rails app structure as
TestApp
| app
____| assets
____| controllers
__________| app
_______________| v1
______________________| mobile_controller
_____ test_controller
____| helpers
____| mailers
____| models
____| views
_________| test
______________| _form
______________| edit
______________| index
______________| show
______________| index
| bin
| config
| custom
| db
| lib
| log
| public
|....
|....
I have two controllers Mobile, Test
Mobile controllers has all the API's
class Api::V1::MobileController < ApplicationController
# POST method
def taskCompleted
respond_to do |format|
format.html { redirect_to '/thankyou', :params => params, :isValid => true }
end
end
When the taskCompleted method is called i want to display a thank you screen So, i am calling index method in TestController,
class TestController < ApplicationController
def index
end
end
In app/views/test/ i have index.html, where i have HTML content.
But i am unable to receive params, passed from taskCompleted method in mobile controller, in index method of Test controller
Can this be possible?
Or do i need to create views for mobile controller?
You should build URL with parameters use Rails helper:
redirect_to test_path(param1: 'value', ...)
or specify controller and action:
redirect_to controller: 'Test', action: 'index', param1: 'value', ...
in your case you just make redirect to '/thankyou' URL without parameters.
You can set it is session, for example:
def first
@first_value = params[:f_name]
session[:passed_variable] = @first_value
end
def second
@first_value = session[:passed_variable]
@get_value = @first_value
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.