0

移行を実行した次の内容の Devise User モデルがあります。

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :token_authenticatable, :confirmable, :lockable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :role
  # attr_accessible :title, :body


  ROLES = ['admin', 'network/system admin', 'manager', 'programmer']

  def role?(base_role)
    ROLES.index(base_role.to_s) <= ROLES.index(role)
  end

end

後で、以下の 2 行を同じモデルに追加し、チケット、プロジェクト、割り当ての移行を実行しました。

  has_many :projects, :through => :assignments
  has_many :tickets

上記により、ユーザーとチケットおよびプロジェクトの関連付けが更新されますか? 同じモデルの移行を実行した後、モデル内の関連付けを変更する際に問題はありますか? 現在Railsアプリを開発しているので知りたいです。

ありがとう :)-

4

1 に答える 1