Module: SimpleCrudify::CommonMethods
- Included in:
- Crudify
- Defined in:
- lib/simple_crudify/common_methods.rb
Overview
Common methods that should implement in each controller
class UsersController < ApplicationController
include SimpleCrudify::Crudify
actions :crud
def model_klass
User
end
# Notice for a user after redirect action
def controller_notice(action_name)
t("resource.#{action_name}.success", resource_name: model_klass)
end
private
def after_create_path
edit_user_path(@resource)
end
def after_update_path
users_path
end
def after_destroy_path
users_path
end
def resource_params
params.require(:user).permit(:password, :phone, :email)
end
end