1
0

Added new Unit form

This commit is contained in:
cryptogopher
2019-08-10 23:31:20 +02:00
parent 2cd9900cea
commit b0789e6217
10 changed files with 65 additions and 17 deletions

View File

@@ -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,

View File

@@ -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