Class: Sooner::Subscriber
- Inherits:
-
Object
- Object
- Sooner::Subscriber
- Includes:
- Mongoid::Document
- Defined in:
- app/models/sooner/subscriber.rb
Instance Method Summary collapse
Instance Method Details
#name_required ⇒ Object
11 12 13 |
# File 'app/models/sooner/subscriber.rb', line 11 def name_required Sooner.name_required end |
#save_csv ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/sooner/subscriber.rb', line 15 def save_csv begin file = File.open("public/#{ Sooner.csv_file.nil? ? 'subscribers.csv' : Sooner.csv_file }", "a") if Sooner.name_required file << "#{ name },#{ email }\n" else file << "#{ email }\n" end file.close return true rescue Exception => e self.errors.add_to_base(e. + " (CSV)") end end |