lib/slugged/slug.rb in slugged-1.1.0 vs lib/slugged/slug.rb in slugged-2.0.0
- old
+ new
@@ -2,12 +2,12 @@
class Slug < ActiveRecord::Base
self.table_name = "slugs"
validates_presence_of :record_id, :slug, :scope
- scope :ordered, order('created_at DESC')
- scope :only_slug, select(:slug)
+ scope :ordered, lambda { order('created_at DESC') }
+ scope :only_slug, lambda { select(:slug) }
scope :for_record, lambda { |r| where(:record_id => r.id, :scope => Slugged.key_for_scope(r)) }
scope :for_slug, lambda { |scope, slug| where(:scope=> scope.to_s, :slug => slug.to_s)}
if methods.include? :pluck
def self.id_for(scope, slug)
@@ -46,6 +46,6 @@
def self.usable?
table_exists? rescue false
end
end
-end
\ No newline at end of file
+end