Module: Ratable::Models::Ratee
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ratable/models/ratee.rb
Defined Under Namespace
Modules: ActiveRecordExtension
Instance Attribute Summary collapse
-
#has_one ⇒ Object
readonly
Returns the value of attribute has_one.
Instance Method Summary collapse
Instance Attribute Details
#has_one ⇒ Object (readonly)
Returns the value of attribute has_one.
6 7 8 |
# File 'lib/ratable/models/ratee.rb', line 6 def has_one @has_one end |
Instance Method Details
#rate(options = {}) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/ratable/models/ratee.rb', line 32 def rate(={}) .reject! { |k| k == :ratee } if @has_one self..create() else self..create() end end |
#raters ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ratable/models/ratee.rb', line 24 def raters if @has_one .rater else .includes(:rater).collect { || .rater } end end |