Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know that it is some time since you posted this, but I hope it helps or that others may find it helpfull.</p> <p>Assuming that you know how to make the calculations on the first page, lets call it the index-page (as it is properly named in rhodes), you can do it as follows:</p> <p>Before you begin make sure that you store the result of your calculations in a variable, for these instructions lets call it $result.</p> <p>1) Create a new .erb file which you want to represent the result page (if you created a model, you already have a .erb file called "show" and could just as easily modify and use that). In this example - lets call the page "result".</p> <p>2) Create a new def in your controller - lets call it "calculate". This could look something like this:</p> <p><code>def calculate</code> <br/> <code>[do any calulations you should desire]</code> <br/> <code>$result = [result of calculations]</code> <br/> <code>render :action =&gt; :result, :back =&gt; url_for(:action =&gt; :index)</code> <br/> <code>end</code> </p> <p>This line:</p> <p><code>render :action =&gt; :result, :back =&gt; url_for(:action =&gt; :index)</code></p> <p>will send you to your result page and define the action for the smartphone's backbutton to navigate back to your index-page.</p> <p>3) Make sure that your "get-result-button" on your index-page invokes your new def. For a simple link this could for example look something like this:</p> <p><code>&lt;a href="&lt;%= url_for :action =&gt; :calculate %&gt;"&gt;get result&lt;/a&gt;</code></p> <p>4) Display the result in the result page. Your variable from your index-page is still available in the result-page, so you can show the result by adding the following line to your result-page (result.erb):</p> <p><code>&lt;%= $result.to_s %&gt; (this will insert your result as a string).</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload