添加sso model

cs_optimize_txz
guange 9 years ago
parent 0635c1e98b
commit e8adcf8cc7

@ -30,8 +30,8 @@ class SsoController < ApplicationController
end
def login(id)
start_user_session(user)
sso = Sso.find(id)
start_user_session(sso.user)
end
end

@ -0,0 +1,4 @@
class Sso < ActiveRecord::Base
belongs_to :user
attr_accessible :email, :name, :openid, :password, :school, :sex
end

@ -181,6 +181,8 @@ class User < Principal
has_one :user_wechat
has_one :sso
# add by zjc
has_one :level, :class_name => 'UserLevels', :dependent => :destroy
has_many :memos , :foreign_key => 'author_id'

@ -0,0 +1,16 @@
class CreateSsos < ActiveRecord::Migration
def change
create_table :ssos do |t|
t.references :user
t.string :openid
t.string :name
t.string :password
t.string :email
t.integer :sex
t.string :school
t.timestamps
end
add_index :ssos, :user_id
end
end

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160429030819) do
ActiveRecord::Schema.define(:version => 20160504060751) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1673,15 +1673,6 @@ ActiveRecord::Schema.define(:version => 20160429030819) do
t.datetime "updated_at", :null => false
end
create_table "shield_wechats", :force => true do |t|
t.string "container_type"
t.integer "container_id"
t.string "shield_type"
t.integer "shield_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -1700,6 +1691,20 @@ ActiveRecord::Schema.define(:version => 20160429030819) do
t.integer "project_id"
end
create_table "ssos", :force => true do |t|
t.integer "user_id"
t.string "openid"
t.string "name"
t.string "password"
t.string "email"
t.integer "sex"
t.string "school"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id"
create_table "student_work_projects", :force => true do |t|
t.integer "homework_common_id"
t.integer "student_work_id"

Loading…
Cancel
Save