Class: Post

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/post.rb

Instance Method Summary collapse

Instance Method Details

#send_public_tweetObject


18
19
20
21
22
# File 'app/models/post.rb', line 18

def send_public_tweet
  link = ShortLink.shorten_link("https://hospitium.co/posts/#{self.slug}")
  message = "#{self.title.slice(0, 100)} - #{link}"
  TwitterAccount.twitter_post(message, 1)
end

#set_slugObject


14
15
16
# File 'app/models/post.rb', line 14

def set_slug
  self.slug = self.title.parameterize
end

#to_paramObject

used to create url for posts


10
11
12
# File 'app/models/post.rb', line 10

def to_param
  slug
end