-
-
Save notch8-old/1174776 to your computer and use it in GitHub Desktop.
Campaign
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Campaign < ActiveRecord::Base | |
belongs_to :user | |
#scope :active, where(:active => true) | |
#scope :not_yet_active, where(:active => false) | |
validates :goal, :presence => true | |
validates :url, :presence => true | |
validates :name_or_twitter, :presence => true | |
attr_accessor :complete_tweet | |
def complete_tweet | |
@complete_tweet ||= if self.campaign_url | |
"#{self.tweet} #{self.campaign_url} #{MyGivingTweetConf::HASHTAG}" | |
else | |
"#{self.tweet} http://bit.ly/XXXXX #{MyGivingTweetConf::HASHTAG}" | |
end | |
end | |
ruby-1.9.2-p290 :002 > c.full_tweet | |
=> "I am excited to donate $500 to @hrrygggg and you should consider helping me http://bit.ly/XXXXX #mgt20yo http://bit.ly/XXXXX #mgt20yo" | |
ruby-1.9.2-p290 :003 > c.complete_tweet | |
=> "I am excited to donate $500 to @hrrygggg and you should consider helping me http://bit.ly/XXXXX #mgt20yo http://bit.ly/XXXXX #mgt20yo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment