Added new Unit form
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
class BodyTrackersController < ApplicationController
|
||||
before_action :find_project, only: [:index, :units]
|
||||
before_action :find_project, only: [:index]
|
||||
before_action :authorize
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def units
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# :find_* methods are called before :authorize,
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
class UnitsController < ApplicationController
|
||||
before_action :find_project, only: [:new, :index, :create]
|
||||
before_action :authorize
|
||||
|
||||
def new
|
||||
@unit = Unit.new
|
||||
end
|
||||
|
||||
def index
|
||||
@unit = Unit.new
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# :find_* methods are called before :authorize,
|
||||
# @project is required for :authorize to succeed
|
||||
def find_project
|
||||
@project = Project.find(params[:project_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user