Sha256: 33581d2125a8a2ff0505e9fb73552b112d26b7a28525944b60d872da5455c6a2

Contents?: true

Size: 717 Bytes

Versions: 54

Compression:

Stored size: 717 Bytes

Contents

module Para
  module Component
    class Resource < Para::Component::Base
      class ModelNotFound < NameError; end

      def model
        @model ||= model_type.presence && model_type.constantize
      rescue NameError
        raise ModelNotFound,
          "The model #{ model_type } was not found. You may need to set " +
          "the :model_type option in your component definition in the " +
          "config/components.rb file. If no component should actually " +
          "reference this model, you may need to run the " +
          "`rake para:components:clean` task to clean up your components index."
      end

      def model_table_name
        model && model.table_name
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
para-0.12.4 app/models/para/component/resource.rb
para-0.12.3 app/models/para/component/resource.rb
para-0.12.2 app/models/para/component/resource.rb
para-0.12.1 app/models/para/component/resource.rb
para-0.12.0 app/models/para/component/resource.rb
para-0.11.4 app/models/para/component/resource.rb
para-0.11.3 app/models/para/component/resource.rb
para-0.11.2 app/models/para/component/resource.rb
para-0.11.1 app/models/para/component/resource.rb
para-0.11.0 app/models/para/component/resource.rb
para-0.10.0 app/models/para/component/resource.rb
para-0.9.4 app/models/para/component/resource.rb
para-0.9.3.3 app/models/para/component/resource.rb
para-0.9.3.2 app/models/para/component/resource.rb
para-0.9.3.1 app/models/para/component/resource.rb
para-0.9.2 app/models/para/component/resource.rb
para-0.9.0 app/models/para/component/resource.rb
para-0.8.15 app/models/para/component/resource.rb
para-0.8.14 app/models/para/component/resource.rb
para-0.8.13 app/models/para/component/resource.rb