Sha256: 2b28d2be8bdf8b41527c5ff259226113ab94d3368848533ccb304c8b8fc09230
Contents?: true
Size: 937 Bytes
Versions: 3
Compression:
Stored size: 937 Bytes
Contents
module AdminCore module ResourceManager module Buildable extend ActiveSupport::Concern # @!method self.resource_class # @return [Class] # @!method self.resource_name # @return [String] # @!method self.resource_display_name # @return [String] class_methods do def resource_class @model ||= "::#{name.demodulize}".constantize end def resource_name resource_class.model_name.singular end def resource_display_name resource_class.model_name.human end private attr_writer :model end # @param params [ActionController::Parameters] # @return [ActiveRecord::Base] def build(params) self.class.resource_class.new(params) end # @return [String] def name self.class.resource_class.model_name.singular end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
admin_core-0.0.3 | lib/admin_core/resource_manager/buildable.rb |
admin_core-0.0.2 | lib/admin_core/resource_manager/buildable.rb |
admin_core-0.0.1 | lib/admin_core/resource_manager/buildable.rb |