daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest Jul 21st, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%= simple_form_for(@provider) do |f| %>
  2.   <% Car.all.each do |c| %>
  3.     <div>
  4.       <%= check_box_tag :car_ids, c.id, @store.cars.include?(c), :name => 'store[car_ids][]' %>
  5.       $<%= c.cost %> | <%= c.description %>
  6.     </div>
  7.   <% end %>
  8.   <div class="actions">
  9.     <%= f.submit "New" %>
  10.   </div>
  11. <% end %>
  12.    
  13. f.input car_ids, ..., :as => :check_box
  14.    
  15. @provider = Provider.new(params[:provider])
  16.    
  17. car_ids = params[:provider][:car_ids]
  18. car_ids.each do |cid|
  19.   @provider.cars << Car.find(cid)
  20. end
  21.    
  22. @provider.save!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top