Sha256: c390f21536609ae354e9ed90c10de4791bf563c5a9a98d98b9c8d9233d024593

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

class TrackbacksController < FeedbackController
  def create
    @error_message = catch(:error) do
      if this_blog.global_pings_disable
        throw :error, 'Trackback not saved'
      elsif params[:__mode] == 'rss'
        # Part of the trackback spec... not sure what we should be doing here though.
      else
        begin
          @trackback = this_blog.ping_article! trackback_params
        rescue ActiveRecord::RecordNotFound, ActiveRecord::StatementInvalid
          throw :error, "Article id #{params[:id]} not found."
        rescue ActiveRecord::RecordInvalid
          throw :error, 'Trackback not saved'
        end
      end
    end

    respond_to do |format|
      format.xml { render 'trackback', formats: [:xml], handlers: [:builder] }
      format.html { render nothing: true }
    end
  end

  protected

  def trackback_params
    params.
      permit(:blog_name, :excerpt, :title, :url, :article_id).
      merge(ip: request.remote_ip, published: true)
  end

  def get_article
    true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
publify_core-9.0.0.pre2 app/controllers/trackbacks_controller.rb
publify_core-9.0.0.pre1 app/controllers/trackbacks_controller.rb