Skip to content

Instantly share code, notes, and snippets.

@vu0tran

vu0tran/users.rb Secret

Created July 30, 2016 11:41
Show Gist options
  • Save vu0tran/9c9cca45966246306b7adef41408c93f to your computer and use it in GitHub Desktop.
Save vu0tran/9c9cca45966246306b7adef41408c93f to your computer and use it in GitHub Desktop.
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
# skips :text is an Array
# number_of_photos :integer default("0")
# age :integer
#
class User < ActiveRecord::Base
acts_as_messageable :required => :body, # default [:topic, :body]
:dependent => :destroy # default :nullify
has_many :skips, :dependent => :destroy
acts_as_taggable # Alias for acts_as_taggable_on :tags
acts_as_taggable_on :seeking_gender, :trait, :seeking_race
scope :by_updated_date, -> {
order("updated_at DESC")
}
#schema
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "skips", array: true
t.integer "number_of_photos", default: 0
t.integer "age"
end
add_index "users", ["age"], name: "index_users_on_age", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["number_of_photos"], name: "index_users_on_number_of_photos", using: :btree
add_index "users", ["updated_at"], name: "index_users_on_updated_at", order: {"updated_at"=>:desc}, using: :btree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment