title: how can I update an existing column from an action except update?
body: <p>I want to update a column of an existing record, hopefully, with one action, but since I could not do that, now there are two actions.</p>
  
  <h2>In detail</h2>
  
  <p>make users specify a number to add to an existing column like
  if a user specifies 3, and the existing column is 97, then in total 100 and the number, 100 will be saved.</p>
  
  <p>view <code>split_now.html.erb</code></p>
  
  <pre><code>&lt;div class="container"&gt;
   &lt;h1&gt;Split&lt;/h1&gt;
   &lt;%= form_for @currency, url: { action: 'split', controller: 'currencies'}, method: :put do |f|%&gt;
    &lt;% if @currency.errors.any? %&gt;
        &lt;div id="error_explanation" class="alert alert-danger"&gt;
          &lt;h2&gt;&lt;%= @currency.errors.count %&gt;error(s) exist(s).&lt;/h2&gt;
          &lt;ul&gt;
            &lt;% @currency.errors.full_messages.each do |msg| %&gt;
                &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
            &lt;% end %&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
    &lt;% end %&gt;
    &lt;p&gt;amount whatever you want to issue like 100&lt;/p&gt;
    &lt;div class="input-group"&gt;
      &lt;%= f.text_field :amount,:class=&gt;'form-control form-group',placeholder:"amount"%&gt;
    &lt;/div&gt;
    &lt;%= f.submit 'done', class: "btn btn-large bg-info" %&gt;
   &lt;% end %&gt;
  &lt;/div&gt;   
  
  
  def split_now
    @currency=Currency.find_by_slug(params[:id])
  end
  
  
  def split
     @currency=Currency.find_by_slug(params[:id])
    if CurrencyUser.where(currency_id:@currency.id,owner:true).first.user==current_user
     if SplitValidation.new(amount:params[:amount]).valid?
      issue_more(params,@currency)
      else
      render "split_now"
      end
    else
      redirect_to @currency,alert:"This currency wasn't issued by you"
    end
  end
  
  def issue_more(params,currency)
     result=false
     current_amount=currency.amount
    result=currency.update(
              amount:current_amount+params[:amount].to_i
    )
   currency_user=CurrencyUser.find_by(currency_id:currency.id,owner:true)
   currency_user.update(amount:currency_user.amount+params[:amount].to_i)
   return result
  end`
  </code></pre>
  
  <p>this is the validator</p>
  
  <pre><code>class SplitValidation
  
   include ActiveModel::Model
   attr_accessor :amount
   validates :amount, presence: true,numericality: { only_integer:  true,greater_than: 0 }
  
  end
  </code></pre>
  
  <p>routes</p>
  
  <pre><code> resources :currencies do
    member do
      put :split
      get :split_now
    end
   end
  </code></pre>