title: Why I can't insert data in a model from a custom controller?
body: <p>I created a scaffold for a model called "Charge", but I want to insert data to the model from a custom controller I created "Checkout".</p>
  
  <p>I have the following code</p>
  
  <pre><code>##routes.rb
  get "checkout/pay", to: 'checkout#index'
  post "checkout/charge"
  
  ## app/controllers/checkout_controler.rb
  require "conekta"
  Conekta.api_key = "xxxxxxxxxxxxxxxx"
  
  # GET 'checkout/pay'
  def index
    redirect_to root_path, notice: "your cart is empty" if @cart.line_items.empty?
  end
  
  # POST 'checkout/charge'
  def charge
    redirect_to root_path, notice: "your cart is empty" if @cart.line_items.empty?
  
    total_price = @cart.total_price_cart * 100
  
    begin 
      charge = Conekta::Charge.create({
        amount: total_pricec.to_i,
        currency: "MXN",
        description: "Pizza Delivery",
        reference_id: "sku product",
        card: params[:conektaTokenId]
      })
      #Conekta::Charge.create() runs successfully and return a hash of values
  
      @charge = Charge.new(id: charge.id, amount: charge.amount, livemode: charge.livemode, created_at: charge.created_at, status: charge.status, currency: charge.currency, description: charge.description, reference_id: charge.reference_id, failure_code: charge.failure_code, failure_message: charge.failure_message)
      if @charge.save
        redirect_to products_path, notice: "charge was created"
      else
        redirect_to root_path
      end
    rescue Conekta::Error 
      puts e.message 
    end
  </code></pre>
  
  <p>in the app/views/checkout/index.html.erb</p>
  
  <pre><code>&lt;%= form_tag('checkout/charge, id:'card-form') do %&gt;
      fields .....
      &lt;button&gt;Charge&lt;/button&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>Update:</strong>
  I can reach to the method charge = Conekta::Charge.create(), and it runs successfully creating the payment, but the method can't insert the data in the "Charge" model and save the data. 
  When I go to '/charges' it's empty.</p>