Module: Railslove::Plugins::FindByParam::SingletonMethods
- Included in:
- Admin::TaxonsController
- Defined in:
- lib/spree_core/find_by_param.rb
Instance Method Summary collapse
Instance Method Details
#find_by_param(value, args = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/spree_core/find_by_param.rb', line 61 def find_by_param(value,args={}) if [:prepend_id] param = "id" value = value.to_i else param = [:field] end self.send("find_by_#{param}".to_sym, value, args) end |
#find_by_param!(value, args = {}) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/spree_core/find_by_param.rb', line 71 def find_by_param!(value, args={}) param = [:field] obj = find_by_param(value, args) raise ::ActiveRecord::RecordNotFound unless obj obj end |