def feed_url(format = :rss20)
blog.url_for(:controller => 'xml', :action => 'feed', :type => 'article', :format => format, :id => id)
end
def self.find_by_permalink(year=nil, month=nil, day=nil, title=nil)
if self.blog.seopermalinks == 0
unless month
case year
when Hash
year, month, day, title = date_from(year)
when Array
year, month, day, title = year
end
end
from, to = self.time_delta(year, month, day)
returning(find_published(:first,
:conditions => ['permalink = ? AND ' +
'published_at BETWEEN ? AND ?',
title, from, to ])) do |res|
if res.nil?
raise ActiveRecord::RecordNotFound
end
end
else
returning(find_published(:first,
:conditions => ['permalink = ? ' , title])) do |res|
if res.nil?
raise ActiveRecord::RecordNotFound
end
end
end
end