Module: Blogit::Blogs::ClassMethods

Defined in:
lib/blogit/blogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) blogs

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

- (Boolean) blogs?

Has this model been registered as a blogging model?

Returns:

  • (Boolean)

    true or false


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

def blogs?
  @blogs == true
end