У меня есть модель, где я храню вещи.Когда значение логического атрибута (action_type) равно false, PostgreSQL по какой-то причине откатывает запрос INSERT.
create_table :process_flows do |t|
t.integer :campaign_id
t.integer :position
t.string :description
t.string :typestr
t.float :action_number
t.boolean :action_type
t.string :action_on_donation
t.integer :created_by
t.integer :updated_by
t.timestamps
end
Файл My View выглядит следующим образом:
<%= form_for [@org, @campaign, @process_flow] do |f| %>
<%= render "shared/errors", :target => @process_flow %>
<div class="field">
<%= f.label :description %><br />
<%= f.text_field :description %>
</div>
<div class="field">
<%= f.label :typestr, 'Type of organization' %><br /><br />
<%= f.select :typestr, options_for_select([["Point of collection", "PC", :selected => true], ["Your Organization", "O"], ["Bank / Payment Gateway", "B"], ["Intermediary", "I"], ["Recipient Charity Project", "R"]]) %><br /><br />
</div>
<%= f.select :action_on_donation, options_for_select([["100% (Unchanged)", "U", :selected => true], ["Increase", "A"], ["Decrease", "S"]]) %>
the donation
by
<%= f.text_field :action_number, :style=>"width: 30px;", :value => '0' %>
<%= f.select :action_type, options_for_select([["Percent", '1', :selected => true], ["Flat Amount", '0']]) %>
<div>
<%= f.submit 'Add', :class=>'button' %>
</div>
<% end %>