Class: Findable::Associations::Utils
- Inherits:
-
Object
- Object
- Findable::Associations::Utils
- Defined in:
- lib/findable/associations/utils.rb
Class Method Summary collapse
Class Method Details
.model_for(name, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/findable/associations/utils.rb', line 4 def self.model_for(name, = {}) unless model_name = [:class_name].presence name = [:collection] ? name.to_s.singularize : name.to_s model_name = name.camelize end if [:safe] model_name.try(:safe_constantize) else model_name.constantize end end |
.parse_args(args) ⇒ Object
17 18 19 20 21 |
# File 'lib/findable/associations/utils.rb', line 17 def self.parse_args(args) copied = args.dup = copied. [copied.first, ] end |