Sha256: 8822bb65599e75ec6686c4f7096b4c154c852d92fa3e93a22d15409437581149

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 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
    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

6 entries across 6 versions & 1 rubygems

Version Path
dynamic_controller-0.0.8 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.7 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.6 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.5 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.4 lib/dynamic_controller/action_controller_extension.rb
dynamic_controller-0.0.3 lib/dynamic_controller/action_controller_extension.rb