Skip to content

Instantly share code, notes, and snippets.

@kmelkon
Last active December 22, 2015 02:38
Show Gist options
  • Save kmelkon/6404571 to your computer and use it in GitHub Desktop.
Save kmelkon/6404571 to your computer and use it in GitHub Desktop.
<%= form_for [@company, @activity], :remote=> true, :validate => true do |f| %>
<%= f.label :title %>
<%= f.text_field :title, :class => "input-width bottom-border"%>
<%= f.label :background %>
<%= f.text_area :background, :class => "area-height area-width bottom-border" %>
<%= f.collection_select(:activity_category_id, ActivityCategory.all, :id, :activity_category) %>
<%= f.submit "Add activity", class: "btn submit-deals" %>
<% end %>
<%= form_for [@company, @deal], :remote=> true, :id => "form", :validate => true do |f| %>
<%= f.label :name %>
<%= f.text_field :name, :class => "input-width", :autofocus => true %>
<%= f.label :value %>
<%= f.text_field :value, :class => "input-width" %>
<%= f.label :currency %>
<%= f.text_field :currency, :class => "input-width" %>
<%= f.label :background %>
<%= f.text_area :background, :class => "area-width area-height" %>
<%= f.submit "Add this Deal", class: "btn submit-deals" %>
<% end %>
class Activity < ActiveRecord::Base
attr_accessible :activity_category_id, :background, :title, :user_id
belongs_to :company
belongs_to :contact
belongs_to :activity_category
validates :company_id, :presence => true
validates :title, :presence => true,
:length => {:minimum => 1, :maximum => 20}
end
class Deal < ActiveRecord::Base
attr_accessible :background, :company_id, :currency, :deal_category_id, :deal_status_id, :name, :offer, :user_id, :value, :status, :state
belongs_to :company
belongs_to :deal_catergory
belongs_to :deal_status
belongs_to :user
validates :company_id, :presence => true
validates :name, :presence => true,
:length => {:minimum => 1, :maximum => 20}
validates :value, :presence => true,
:numericality => true
end
Uncaught TypeError: Cannot read property 'validators' of undefined
_ref.focusout.ClientSideValidations
jQuery.event.dispatch
elemData.handle
jQuery.event.trigger
jQuery.event.simulate
handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment