Sha256: 3b31dca7fa8413439169f9c9fe9fe4f2d1d97a9d43d51a0f22b905d82ea6119c
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module Arpa class ResourcesController < ApplicationController before_action :set_resource, only: [:show] # GET /resources def index @resources = resource_finder.all respond_with(@resources) end # GET /resources/1 def show respond_with(@resource) end # GET /generate_resources_and_actions def generate_resources_and_actions Rails.application.eager_load! resource_creator.create({resourceables: ApplicationController.descendants, except_action_methods: ApplicationController.action_methods}, { success: -> (resource) { flash[:notice] = I18n.t('flash.actions.generate_resources_and_actions.notice') }, fail: -> (error) { flash[:alert] = I18n.t('flash.actions.generate_resources_and_actions.alert') } }) redirect_to resources_path end private def resource_creator @resource_creator ||= Arpa::Services::Resources::ResourceManagerCreator.new end def resource_finder @resource_finder ||= Arpa::Repositories::Resources::Finder.new end def set_resource @resource = resource_finder.find(params[:id]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arpa-0.0.6 | lib/arpa/controllers/resources_controller.rb |