| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- # encoding: utf-8
- class Employ < ActiveRecord::Base
- self.table_name = "employs"
- validates :mobile,:user_name,presence: true
- validate :employ_validation
- def employ_validation
- usr = User.where("tel = ?", self.mobile).first
- if !usr.blank?
- wu = WxUser.where("user_id = ?", usr.id).first
- if !wu.blank?
- self.wx_user_id = wu.id
- end
- end
- end
- rails_admin do
- navigation_label '食堂管理'
- weight -500
- list do
- filters [:mobile,:wx_user_id,:user_name]
- field :id
- field :user_name
- field :mobile
- field :wx_user_id
- field :created_at
- # field :updated_at
- end
- show do
- field :id
- field :user_name
- field :mobile
- field :wx_user_id
- field :created_at
- field :updated_at
- end
- edit do
- field :user_name
- field :mobile
- end
- end
- end
|