Generic finders for a rails base controller
def model | |
@model ||= controller_name.classify.constantize | |
end | |
def record | |
@record ||= records.find(params[:id]) | |
end | |
def records | |
@records ||= policy_scope(model) # Requires Pundit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment