app/controllers/subscribes_controller.rb in enju_library-0.1.2 vs app/controllers/subscribes_controller.rb in enju_library-0.2.0.beta.1

- old
+ new

@@ -1,8 +1,9 @@ class SubscribesController < ApplicationController - load_and_authorize_resource - before_filter :get_subscription, :get_work + before_action :set_subscribe, only: [:show, :edit, :update, :destroy] + before_action :check_policy, only: [:index, :new, :create] + before_action :get_subscription, :get_work # GET /subscribes # GET /subscribes.json def index @subscribes = Subscribe.page(params[:page]) @@ -79,9 +80,18 @@ format.json { head :no_content } end end private + def set_subscribe + @subscribe = Subscribe.find(params[:id]) + authorize @subscribe + end + + def check_policy + authorize Subscribe + end + def subscribe_params params.require(:subscribe).permit( :subscription_id, :work_id, :start_at, :end_at ) end