Sha256: afe13c44da37226b3f5833ad5ce0abfa00230108ed68a38f24e874c30808cff1

Contents?: true

Size: 630 Bytes

Versions: 4

Compression:

Stored size: 630 Bytes

Contents

module DynamicController
  module ActionControllerExtension

    def has_crud_actions(options={})
      @resource_options = Hash[options.map { |k, v| [:only, :except].include?(k.to_sym) ? [k, [v].flatten.map(&:to_sym)] : [k, v] }].reverse_merge(only: DynamicController::ACTIONS, except: [])
      send :extend, ClassMethods
      send :include, InstanceMethods
      send :include, HelperMethods

      helper_method :search_query
    end

    def nested_of(resource_class)
      before_filter :load_parent_models if parent_resources.empty?
      parent_resources << Resource.new(resource_class: resource_class)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dynamic_controller-0.0.12 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.11 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.10 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.9 lib/dynamic_controller/action_controller_extension.rb