Skip to content

Instantly share code, notes, and snippets.

@Nursultan91
Created May 17, 2017 16:06
Show Gist options
  • Save Nursultan91/8e712d722378830fdc075308339634ac to your computer and use it in GitHub Desktop.
Save Nursultan91/8e712d722378830fdc075308339634ac to your computer and use it in GitHub Desktop.
То как я все сделал
#Вот модель task.rb
class Task < ActiveRecord::Base
extend FriendlyId
friendly_id :title, use: [:slugged, :finders]
has_many :taskstatus
has_many :users, through: :taskstatus
#Вот модель user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
validates :name, presence: true, length: {maximum: 25}
has_many :taskstatus
has_many :tasks, through: :taskstatus
#Вот модель Taskstatus
class Taskstatus < ActiveRecord::Base
belongs_to :user
belongs_to :task
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment