mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
Louis | Adds form for selecting bike labels to print
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user