Sha256: 4c71e00165fac823f3e6f0c80365b842a30762a4ea8524dad01ecea4f2487508

Contents?: true

Size: 1013 Bytes

Versions: 4

Compression:

Stored size: 1013 Bytes

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 { head :ok }
    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

4 entries across 4 versions & 1 rubygems

Version Path
publify_core-9.0.0.pre6 app/controllers/trackbacks_controller.rb
publify_core-9.0.0.pre5 app/controllers/trackbacks_controller.rb
publify_core-9.0.0.pre4 app/controllers/trackbacks_controller.rb
publify_core-9.0.0.pre3 app/controllers/trackbacks_controller.rb