Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/no_limits.rb
Overview
Monkey patch ActiveRecord::Base
Class Method Summary collapse
Class Method Details
.has(limit, name, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/no_limits.rb', line 10 def self.has limit, name, = {} if limit > 1 has_many name.to_sym, -> { limit(limit) }, else has_one name.to_sym, end end |