Louis | Adds form for selecting bike labels to print

This commit is contained in:
Loos
2014-09-17 14:30:09 -04:00
parent 0c581e775f
commit 49351e0f32
7 changed files with 41 additions and 3 deletions
@@ -1,5 +1,3 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
+13
View File
@@ -16,6 +16,15 @@ class BikesController < ApplicationController
def edit
end
def print_select
@bikes = Bike.all
end
def print_labels
bike_ids = print_params.map{|key, value| key if value == "1"}.compact
@bikes = Bike.find(bike_ids)
end
def create
@bike = Bike.new(bike_params)
if @bike.save
@@ -63,4 +72,8 @@ class BikesController < ApplicationController
:created_at,
:updated_at)
end
def print_params
params.require(:print_bikes)
end
end