Ruby/Rails lentelių asociacijos: Skirtumas tarp puslapio versijų

S
nėra keitimo aprašymo
S
S
 
Our project objects are now able to respond to methods such as project.portfolio, project.has_project_manager?, and project.create_in_milestones("deadline" => Date.today + 5).
 
 
But how do we represent many-to-many relationships? Currently, it has the slightly clumsy macro of has_and_belongs_to_many, as illustrated below:
 
class Project < ActiveRecord::Base
has_and_belongs_to_many :categories
end
 
This makes it possible to do things like project.add_categories(critical, technical)
134

pakeitimai