Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/activerecord_squared/activerecord_ext.rb
Class Method Summary collapse
Class Method Details
.[](input) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/activerecord_squared/activerecord_ext.rb', line 3 def self.[](input) case input when nil # Specifically enables ```SomeModel[nil]``` to not error out. return nil when ::Hash return self.where(input) else return self.find(input) end end |