0

I have a custom object in Salesforce called Sales__c. I am trying to create a record from a RoR app using the databasedotcom-rails gem.

Controller

Class SalesController < ApplicationController
include Databasedotcom::Rails::Controller

  def new
    @sale = Sale__c.new
  end

  def create
    sale = Sale__c.new(params[:sale])

    sale.Item_on_Machine__c = "a0Co0000001TszL"
    sale.OwnerId = "005o0000000HLctAAG"

    if @sale.save
        redirect_to(sale, :notice => 'Sale was successfully created.')
    end

   end


end

View

<h1>New Sale</h1>
<div class="actions">
    <%= f.submit %>
</div>

#Note there is no field on the form, just the submit button.

Routes

VendingForce2::Application.routes.draw do
  resources :sales
end

//////////////////////// ERROR

When I go to

http://0.0.0.0:3000/sales/new 

I get the following error

NoMethodError in Sales#new

undefined method `sale__cs_path' for #<#<Class:0x007f85cc7c79d8>:0x007f85cc7c4dc8>

app/views/sales/new.html.erb:4:in `_app_views_sales_new_html_erb___1324507284181611345_70106319051940'

Any idea?

Lut
  • 1,363
  • 1
  • 14
  • 30

1 Answers1

0

Try having the <%= f.submit %> under a for tag:

<% @sale.each do |f| %>
<%= f.submit %>
<% end %>

Or

try this

<%= form_for @sale do |f| %>
  <%= f.submit %>
<% end %>
V Sree Harissh
  • 665
  • 5
  • 24