Dhruv Sharma
Dhruv Sharma

Reputation: 25

Redirect to another model's index action, and hence view index.erb - Rhomobile

I am developing a Rhomobile application,on submit of a POST method, i am going to my 'Model 1' action, after execution of my action i want to redirect to another model's (Model 2) Index action and list the data.

I am from a Rails background, there i would have used URL, any similar concept exists here or any solution.

i tried, but it didn't worked for me render :controller => :model2, :action => :index

Upvotes: 0

Views: 98

Answers (1)

engineersmnky
engineersmnky

Reputation: 29598

Please Note: I have never used rhodes and all of this information was acquired by simply reading the API documentation and taking a look at the source code.

According to the documentation You should be able to deal with this in a very railsy fashion eg

   def some_action 
     redirect controller: :model2, action: :index
   end

Seems the only caveat is if this redirection is to happen in a callback function. In this case the redirection should be handled by the WebView instead e.g.

  Rho::WebView.navigate(url_for(controller: :model2 action: :index))  

Source for Rho::RhoController#redirect supports these statements in the documentation.

Additionally as you might notice above it appears that Rho has ported a lot of the rails like helpers including url_for

Upvotes: 0

Related Questions