Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Models (at least those descending from ActiveRecord::Base) require a database, so if you are using a model you are using a database, even if its a simple one like SQLite.</p> <p>If you don't want to descend into models and generating a migration to create the tables for your models, then you are probably just going to store the form values into instance variables and reference those in your view. Below is a quick example how to do that.</p> <p>If you have a form that sends data (ex: <code>name</code> and <code>email</code>) to a <code>create</code> action, the create action would look sort of like this:</p> <pre><code>def create @name = params[:name] @email = params[:email] render :my_template end </code></pre> <p>The <code>create</code> action above is assigning the params sent to it to instance variables, which you can then reference in your view. In the above example the <code>create</code> action is going to try and render a view called <code>my_template</code> which would probably be named <code>my_template.html.erb</code> and might look something like this:</p> <pre><code>&lt;p&gt;Your name is &lt;%= @name =&gt; and your email is &lt;%= @email =&gt;.&lt;/p&gt; </code></pre> <p>This is an extremely small and contrived example, but hopefully this helps.</p> <p>When you move on to working with models your create action might instead create a new instance of a model, pass that model the params sent by the user, save the model, and then redirect them to a page that shows the data.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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