Hi All,
I have some strange problem which appears only on heroku hosting 2.3.5
default stack (not on my local computer)
I have some models. Here they are:
class Contact < ActiveRecord::Base
belongs_to :user
belongs_to :type, :class_name => “ContactType”, :foreign_key =>
“type_id”
validates_presence_of :name, :on => :create, :message => “can’t be
blank”
validates_presence_of :type, :on => :create, :message => “can’t be
blank”
validates_presence_of :number, :on => :create, :message => “can’t be
blank”
end
class ContactType < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
end
migration:
create_table :contacts, :force => true do |t|
t.integer :user_id
t.integer :type_id
t.string :name
t.string :number
t.timestamps
end
add_index :contacts, :user_id
create_table :contact_types, :force => true do |t|
t.string :name
t.timestamps
end
end
And a simple form:
<% form_for(@contact) do |f| %>
<%= f.error_messages %>
<%= f.label :name %> <%= f.text_field :name %>
<%= f.label :type_id %> <%= f.collection_select(:type_id, @contact_types, :id, :name) %>
<%= f.label :number %> <%= f.text_field :number %>
<%= f.submit 'Create' %>
<% end %>If i’m trying to save model and I get
There were problems with the following fields:
Contact can’t be blank
What does it mean {model name} can’t be blank?
When I try it local all save well.
Great Thanks.