Sha256: bb974466ef0453551f0ed4a5a3fb687019aefb2cf6ccf894931bc485cb45bf70

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

#todo move to routing dir
module RademadeAdmin
  module Model
    class Reflection
      include Uploader
      include Data

      attr_reader :model, :controller

      def initialize(model, controller, controller_name, inner)
        @model, @controller, @controller_name, @inner = model, controller, controller_name, inner
      end

      def parent_menu_item
        @controller_name.camelize.constantize.instance_variable_get('@parent_item')
      end

      def nested?
        @inner
      end

      # @doc
      # Admin::User => :users
      # RademadeAdmin::User::Adapter => :adapters
      def model_related_name
        @model.to_s.demodulize.pluralize.downcase.to_sym
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.0.1 lib/rademade_admin/model/reflection.rb