Module: Controllers::Showable
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActivityTypesController, AssignmentQueuesController, BankAccountsController, CampaignsController, CatalogsController, CommunicationsController, ContactPointsController, DoNotCallsController, EmployeeGoalsController, EmployeeReviewsController, ItemLedgerEntriesController, LedgerClosingPeriodsController, LedgerTransactionsController, OutgoingPaymentsController, PackagingsController, ShipmentReceiptsController, ShipmentsController, SpiffsController, StoresController, SupplierItemsController, TopicCategoriesController, TopicExamsController, TopicsController, VideosController, WarehousePackagesController
- Defined in:
- app/concerns/controllers/showable.rb
Instance Method Summary collapse
Instance Method Details
#perform_show(record_class, _options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/concerns/controllers/showable.rb', line 10 def perform_show(record_class, = {}) error_msg = [] record_identifier = "#{record_class.name.titleize} record id #{params[:id]}" record_instance_name = "@#{record_class.name.tableize.singularize}" record = instance_variable_get(record_instance_name) || record_class.find(params[:id]) # Future, not sure all models have ability defined yet. # authorize! :read, record instance_variable_set(record_instance_name, record) # Redirection will be either succes/error url, or a generalized redir url option, or the index action respond_to do |format| format.html format.xml { head :ok } format.json { head :no_content } end end |
#show ⇒ Object
6 7 8 |
# File 'app/concerns/controllers/showable.rb', line 6 def show perform_show controller_name.classify.constantize end |