Class: Enki::CommentsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Enki::CommentsController
- Defined in:
- app/controllers/enki/comments_controller.rb
Instance Method Summary collapse
Methods included from HostHelper
Methods included from UrlHelper
#author_link, #post_comments_path, #post_path
Methods included from TagHelper
Methods included from PostsHelper
Methods included from PageTitleHelper
#archives_title, #html_title, #page_title, #post_title, #posts_title
Methods included from NavigationHelper
#category_links_for_navigation, #class_for_tab, #page_links_for_navigation
Methods included from FormHelper
Methods included from DateHelper
#format_comment_date, #format_month, #format_post_date
Methods included from ApplicationHelper
#author, #comments?, #format_comment_error, #paginated, #tags?
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/enki/comments_controller.rb', line 20 def create @comment = Comment.new((session[:pending_comment] || params[:comment] || {}). reject {|key, value| !Comment.protected_attribute?(key) }) @comment.post = @post session[:pending_comment] = nil if @comment.save redirect_to post_path(@post) else render :template => 'posts/show' end end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/enki/comments_controller.rb', line 6 def index redirect_to(post_path(@post)) end |
#new ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/enki/comments_controller.rb', line 10 def new @comment = Comment.build_for_preview(params[:comment]) respond_to do |format| format.js do render :partial => 'comment', :locals => {:comment => @comment} end end end |