Module: Grape::Utils::Helpers
- Defined in:
- lib/grape_utils/helpers.rb
Instance Method Summary collapse
- #calculate_scope(scope:, model:) ⇒ Object
- #default_params(configuration) ⇒ Object
- #permitted_params ⇒ Object
Instance Method Details
#calculate_scope(scope:, model:) ⇒ Object
10 11 12 13 |
# File 'lib/grape_utils/helpers.rb', line 10 def calculate_scope(scope:, model:) initial_scope = scope.is_a?(Proc) ? instance_eval(&scope) : scope initial_scope || model.all end |
#default_params(configuration) ⇒ Object
15 16 17 |
# File 'lib/grape_utils/helpers.rb', line 15 def default_params(configuration) configuration.is_a?(Proc) ? instance_eval(&configuration) : configuration || {} end |
#permitted_params ⇒ Object
6 7 8 |
# File 'lib/grape_utils/helpers.rb', line 6 def permitted_params @permitted_params ||= declared(params, include_missing: false) end |