Sha256: 39ad23c73cfd4aa62b9711c45c8d1e25637ee0710afb9b849190ce079128a93e

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 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!(
                params.merge(:ip => request.remote_ip, :published => true))
              ""    
          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 :action => 'trackback.xml.builder' }
        format.html { render :nothing => true }
    end
  end

  protected

  def get_feedback
    @trackbacks =
      if params[:article_id]
        this_blog.requested_article(params).published_trackbacks
      else
        this_blog.published_trackbacks.with_options(this_blog.rss_limit_params) do |t|
          t.find(:all, :order => 'created_at DESC')
        end
      end
  end

  def get_article
    true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typo-5.0.1 app/controllers/trackbacks_controller.rb
typo-5.0.2 app/controllers/trackbacks_controller.rb
typo-5.0 app/controllers/trackbacks_controller.rb