Module: Findable::ClassMethods
- Included in:
- BestCompanies::Industry, BestCompanies::State
- Defined in:
- lib/best_companies/concerns/findable.rb
Instance Method Summary collapse
Instance Method Details
#find_by_name(name) ⇒ Object
4 5 6 |
# File 'lib/best_companies/concerns/findable.rb', line 4 def find_by_name(name) all.detect{|i|i.name == name} end |
#find_or_create_by_name(name) ⇒ Object
8 9 10 |
# File 'lib/best_companies/concerns/findable.rb', line 8 def find_or_create_by_name(name) find_by_name(name) || create(name) end |