Class: Blogit::PostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Blogit::PostsController
- Defined in:
- app/controllers/blogit/posts_controller.rb
Overview
Handles requests for viewing Blogit::Posts
Instance Attribute Summary (collapse)
-
- (Object) post
readonly
The current Blogit::Post being displayed.
-
- (ActiveRecord::Relation) posts
readonly
The current Posts being displayed.
Instance Method Summary (collapse)
-
- (Object) index
Handles GET requests to /blogit/posts.html, /blogit/posts.xml, and /blogit/posts.rss Possible formats include:.
-
- (Object) show
Handles GET requests to /blogit/posts/:id.html.
-
- (Object) tagged
Handles GET requests to /blogit/posts/tagged/:tag.html.
Methods inherited from ApplicationController
Instance Attribute Details
- (Object) post (readonly)
The current Blogit::Post being displayed.
9 10 11 |
# File 'app/controllers/blogit/posts_controller.rb', line 9 def post @post end |
- (ActiveRecord::Relation) posts (readonly)
The current Posts being displayed
14 15 16 |
# File 'app/controllers/blogit/posts_controller.rb', line 14 def posts @posts end |
Instance Method Details
- (Object) index
Handles GET requests to /blogit/posts.html, /blogit/posts.xml, and /blogit/posts.rss Possible formats include:
"XML" - calls #set_posts_for_feed. "RSS" - calls #set_posts_for_feed. "HTML" - calls #set_posts_for_index_page.
27 28 29 30 31 32 33 |
# File 'app/controllers/blogit/posts_controller.rb', line 27 def index respond_to do |format| format.xml { set_posts_for_feed } format.rss { set_posts_for_feed } format.html { set_posts_for_index_page } end end |
- (Object) show
Handles GET requests to /blogit/posts/:id.html
36 37 38 |
# File 'app/controllers/blogit/posts_controller.rb', line 36 def show set_post end |
- (Object) tagged
Handles GET requests to /blogit/posts/tagged/:tag.html. Renders the index template with Posts tagged with tag in tag parameter
42 43 44 45 |
# File 'app/controllers/blogit/posts_controller.rb', line 42 def tagged set_posts_for_tagged_page render :index end |