Module: ResourcefulController::QueryDefinitions

Included in:
ResourcefulController
Defined in:
lib/resourceful_controller/query_definitions.rb

Constant Summary collapse

QUERY_METHODS =
[:index_query, :find_query, :show_query, :edit_query, :update_query, :destroy_query]

Instance Method Summary collapse

Instance Method Details

#default_find_queryObject



16
17
18
# File 'lib/resourceful_controller/query_definitions.rb', line 16

def default_find_query
  lambda { |params| resource_class.find(params[:id]) }
end

#default_index_queryObject



12
13
14
# File 'lib/resourceful_controller/query_definitions.rb', line 12

def default_index_query
  lambda { |params| resource_class.all }
end

#procify(option) ⇒ Object



24
25
26
27
# File 'lib/resourceful_controller/query_definitions.rb', line 24

def procify option
  return unless option
  option.is_a?(Proc) ? option : Proc.new { send option }
end