title: Ruby on Rails: Create Database Entry without JavaScript
body: <p>i´m kinda new in web development and try to get started a project with Ruby on Rails (3.2.9).
  So, i´m a little bit confused about what RoR can do without JavaScript or not...
  For Example with using a Rails Scaffold, it´s no problem to create new records in the database via accessing the Controller´s new method (which then calls the create method and saves the record to the database)
  I would now like to create new records without using a view for it. 
  Just something like "User hits a button -> record is saved" 
  I will give you an example (i need this for my studies, it´s not a real life project...)</p>
  
  <p>I have a view which shows all my articles (rails generate scaffold article) and now  added a link to a "buy-method" which shows the articles name and available amount.
  below there is a field in which a customer could select the amount of the article he wants to buy. </p>
  
  <pre><code>&lt;p&gt;
    &lt;b&gt;Name:&lt;/b&gt;
    &lt;%= @article.name %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
    &lt;b&gt;Available:&lt;/b&gt;
    &lt;%= @article.stocks %&gt;
  &lt;/p&gt;
  
  &lt;%= form_for(@article) do |f| %&gt;
  
   &lt;div class="field"&gt;
      &lt;b&gt;How many?&lt;/b&gt;
      &lt;br /&gt;
      &lt;%= f.number_field :amount %&gt;
    &lt;/div&gt;
  &lt;% end %&gt; 
  </code></pre>
  
  <p>Now i want to add a link (or better a button i think) which causes an event which turns the article´s name and the selected amount into something like an order item i.e. create a record in an order_item table.</p>
  
  <pre><code>&lt;td&gt;&lt;%=link_to "Ja", :controller =&gt; "oderItem", :method =&gt; "create" %&gt;&lt;/td&gt;&lt;br&gt;
  </code></pre>
  
  <p>Now i´m confused about how i can do it.
  I thought about using just the create - Method (or any method) of the Controller which does something like:</p>
  
  <pre><code>def match
  
      @apo = OrderItem.new(:amount :2, ...)
      @apo.save
  end
  </code></pre>
  
  <p>But this just seems to render me to the new-method of the controller or sth like that.</p>
  
  <p>So, with this explanations (which maybe as well reveal the level of my knowledge...) can anybody tell me if i am doing something really wrong with rails or if i just have to use javascript for this???</p>
  
  <p>Some Sample Code (for Rails and / or JS) would be appreciated the most!
  (Please keep it simple, i know that Ajax etc. are state of the Art but i just want to get this running :-) )
  ...also links to Code-Samples which just show projects like this on Rails (simply :-) ) would be very nice!</p>