sti

    0熱度

    1回答

    我想在Rails中進行STI。 class AbstractUser < ActiveRecord::Base self.table_name = 'users' belongs_to :organization, :inverse_of => :users # reporter user has_many :requests, :dependent =

    2熱度

    2回答

    我正在開發使用設計和Rolify一個Rails 3.2.13應用程序,我需要有3種用戶類型如下: class User < ActiveRecord::Base rolify ... end class UserTypeOne < User .... end class UserTypeTwo < User .... end class U

    2熱度

    1回答

    我有一些STI的設置是這樣的: class Document < ActiveRecord::Base attr_accessible :name, description # Basic stuff omitted end class OriginalDocument < Document has_many :linked_documents, foreig

    1熱度

    1回答

    鑑於用戶的表: create_table :users do |t| t.string :email t.string :website t.string :type end Class User < ActiveRecord::Base ,並從用戶 Class Subscriber < User 插入一個用戶時,我應該使用的類型列什麼實際值繼承的用戶?

    0熱度

    1回答

    剛剛完成Michael Hartl的教程,所以這是一個新手問題。但是,經過大量的搜索,我還沒有確信這是一個很好的解決方案:我有一個用戶模型捕獲標準屬性(名稱,電子郵件,密碼等)。用戶的驗證&也使用MH的RoR教程完成。 現在,註冊後,我希望新用戶能夠選擇學生用戶或教師用戶。另外,我希望任何一種類型的用戶都能夠爲自己創建一個配置文件。 Student_Profile將是非常基本的,而Teacher_

    0熱度

    1回答

    我有一個STI表(Vote),其中有許多子項(Tag::Vote,User::Vote,Group::Vote等)。所有的孩子類共享,看起來像這樣一個非常類似的方法: def self.cast_vote(params) value = params[:value] vote = Tag::Vote.where(:user_id => User.current.id,

    1熱度

    1回答

    我有一個使用STI模型: class Contributor::Name < Contributor::NameBase ... end 從這個模型: class Contributor::NameBase < ActiveRecord::Base ... end 每當Contributor::Name被實例化時,我收到此錯誤: 看來,代替查找表contributo

    0熱度

    2回答

    我試圖設置一個父級具有一些屬性和子級模型的結構,這些屬性和子級模型會繼承這些屬性並保持其自己的屬性。 理想情況下,我想的 class Parent attr_accessible :some_attribute, some_attribute2, some_attribute3 end class Child < Parent attr_accessible :some_

    1熱度

    3回答

    我有Vehicle和STI型號Car和Motorcycle。 我目前已經配置的路線如下: resources :vehicles resources :cars resources :motorcycles 不過,我想它應該是這樣的漂亮: /vehicles/ #all the methods of vehicles_controller /vehicles/cars/ #all the

    1熱度

    2回答

    我有以下型號: User Athlete < User Coach < User 在我的路線,我有以下幾點: devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations" } 我想創造每個sign_up路徑