Module: Blogit::Blogs::ClassMethods

Defined in:
lib/blogit/blogs.rb

Instance Method Summary collapse

Instance Method Details

#blogsObject

When called within a model (usually User) this creates a has-many assosciation between the model and Post



10
11
12
13
# File 'lib/blogit/blogs.rb', line 10

def blogs
  @blogs = true
  has_many :blog_posts, :as => "blogger", :class_name => "Blogit::Post"
end

#blogs?Boolean

Has this model been registered as a blogging model?

Returns true or false

Returns:

  • (Boolean)


18
19
20
# File 'lib/blogit/blogs.rb', line 18

def blogs?
  @blogs == true
end