app/controllers/blog_controller.rb in spud_blog-0.8.14 vs app/controllers/blog_controller.rb in spud_blog-0.8.15

- old
+ new

@@ -23,11 +23,11 @@ def index @posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page) if Spud::Core.config.multisite_mode_enabled @posts = @posts.for_spud_site(current_site_id) - end + end respond_with @posts end # The sole purpose of this action is to redirect from a POST to an seo-friendly url def filter @@ -85,16 +85,20 @@ if @post.blank? flash[:error] = "Post not found!" redirect_to blog_path and return false end @comment = @post.comments.new(params[:spud_post_comment]) + @comment.user_agent = request.env["HTTP_USER_AGENT"] + @comment.user_ip = request.remote_ip + @comment.referrer = request.referrer @comment.approved = true + @comment.permalink = blog_post_url(@post.url_name) flash[:notice] = 'Your comment has been posted.' if @comment.save respond_with @comment do |format| format.html { redirect_to blog_post_path(@post.url_name, :anchor => 'spud_post_comment_form') } end - end + end private def find_post @post = SpudPost.find_by_url_name(params[:id]) @@ -102,6 +106,6 @@ flash[:error] = "Post not found!" redirect_to blog_path and return false end end -end \ No newline at end of file +end