Class: Effective::Classified
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Classified
- Defined in:
- app/models/effective/classified.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
Instance Method Summary collapse
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
7 8 9 |
# File 'app/models/effective/classified.rb', line 7 def current_user @current_user end |
Instance Method Details
#approve! ⇒ Object
159 160 161 |
# File 'app/models/effective/classified.rb', line 159 def approve! approved! end |
#published? ⇒ Boolean
140 141 142 143 144 145 146 |
# File 'app/models/effective/classified.rb', line 140 def published? return false unless approved? return false if archived? return false if start_on.blank? || (Time.zone.now.to_date < start_on) return false if end_on.present? && (Time.zone.now.to_date >= end_on) true end |
#submit! ⇒ Object
148 149 150 151 152 153 154 155 156 157 |
# File 'app/models/effective/classified.rb', line 148 def submit! submitted! approve! if EffectiveClassifieds.auto_approve after_commit do EffectiveClassifieds.send_email(:classified_submitted, self) end true end |
#to_s ⇒ Object
136 137 138 |
# File 'app/models/effective/classified.rb', line 136 def to_s title.presence || 'New Classified' end |