module Wallaby::Defaultable
Defaults related methods
Protected Instance Methods
assign_create_and_update_defaults_with(options)
click to toggle source
@param options [Hash] @return [Hash] updated options with default values
# File lib/concerns/wallaby/defaultable.rb, line 21 def assign_create_and_update_defaults_with(options) options[:params] ||= resource_params options[:location] ||= -> { helpers.show_path resource, is_resource: params[:resource] } end
assign_destroy_defaults_with(options)
click to toggle source
@param options [Hash] @return [Hash] updated options with default values
# File lib/concerns/wallaby/defaultable.rb, line 28 def assign_destroy_defaults_with(options) options[:params] ||= params options[:location] ||= if params[:resource] helpers.show_path resource, is_resource: params[:resource] else helpers.index_path current_model_class end end
set_defaults_for(action, options)
click to toggle source
Set default options for create action @param options [Hash] @return [Hash] updated options with default values
# File lib/concerns/wallaby/defaultable.rb, line 11 def set_defaults_for(action, options) case action.try(:to_sym) when :create, :update then assign_create_and_update_defaults_with options when :destroy then assign_destroy_defaults_with options end options end