Last active
September 30, 2015 16:37
-
-
Save smathy/9e950624bc149aeec8e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
has_many :tasks | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[10] pry(main)> t = Task.new | |
=> #<Task:0x007ffd9073ecf0 id: nil, project_id: nil, created_at: nil, updated_at: nil> | |
[11] pry(main)> p = t.build_project | |
=> #<Project:0x007ffd895e2598 id: nil, created_at: nil, updated_at: nil> | |
[12] pry(main)> p.tasks | |
=> [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Task < ActiveRecord::Base | |
belongs_to :project | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment