Fixed use of default scope for Rails 4.x
This commit is contained in:
parent
0277a4e3d0
commit
d6c5508fdd
2 changed files with 4 additions and 2 deletions
|
|
@ -16,7 +16,7 @@ class Package < ActiveRecord::Base
|
|||
to_tsvector('english', packages.description) @@ plainto_tsquery(:q)
|
||||
", q: query).order("#{rank} desc")
|
||||
else
|
||||
scoped
|
||||
all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
class Screenshot < ActiveRecord::Base
|
||||
belongs_to :package, :inverse_of=>:screenshots
|
||||
default_scope order('uploaddatetime DESC')
|
||||
default_scope {
|
||||
order('uploaddatetime DESC')
|
||||
}
|
||||
|
||||
def image_url(size)
|
||||
"/screenshots/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue