[issue #195] Changed scopes.
This commit is contained in:
parent
0c09568d74
commit
7234cb7f99
|
@ -18,7 +18,7 @@ class Group < ActiveRecord::Base
|
|||
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
|
||||
|
||||
scope :search_order, order("CHAR_LENGTH(uname) ASC")
|
||||
scope :without, lambda {|l| where("groups.id NOT IN (?)", Array(l))}
|
||||
scope :without, lambda {|a| where("groups.id NOT IN (?)", a)}
|
||||
scope :search, lambda {|q| where("uname ILIKE ?", "%#{q.strip}%")}
|
||||
scope :opened, where('1=1')
|
||||
scope :by_owner, lambda {|owner| where(:owner_id => owner.id)}
|
||||
|
|
|
@ -48,7 +48,7 @@ class User < ActiveRecord::Base
|
|||
attr_accessor :login
|
||||
|
||||
scope :search_order, order("CHAR_LENGTH(uname) ASC")
|
||||
scope :without, lambda {|l| where("users.id NOT IN (?)", Array(l))}
|
||||
scope :without, lambda {|a| where("users.id NOT IN (?)", a)}
|
||||
scope :search, lambda {|q| where("uname ILIKE ?", "%#{q.strip}%")}
|
||||
scope :opened, where('1=1')
|
||||
scope :banned, where(:role => 'banned')
|
||||
|
|
11
db/schema.rb
11
db/schema.rb
|
@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
|
|||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
|
@ -268,11 +268,11 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
|
|||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "srpm_file_name"
|
||||
t.string "srpm_content_type"
|
||||
t.integer "srpm_file_size"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "default_branch", :default => "master"
|
||||
t.boolean "is_rpm", :default => true
|
||||
end
|
||||
|
@ -292,7 +292,6 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
|
|||
end
|
||||
|
||||
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
|
||||
add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "relations", :force => true do |t|
|
||||
t.integer "object_id"
|
||||
|
@ -351,16 +350,16 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
|
|||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
|
Loading…
Reference in New Issue