Closed rwilcox closed 7 years ago
c4bdb5b07ab0a77bea30712789ac5bdead615534 should address some of this. Namely the models themselves. Let me know if you would like anything changed within these models.
On the subject of changes to the existing functionality:
belongs_to :project
?Some notes:
belongs_to :author, class: User
. You have the field in the migration, just missed that partTheoretically this could be three separate tests, as we have three different behaviors in the app:
(So maybe do all the setup in an rspec before
block, then your it
statements can just do simple tests?
Ok, back to your questions:
should Story belongs_to :project?
Please. Make a migration that adds this fields to Story, add a belongs_to
association to Story and a has_many
association to Project.
Can you expand a little more on the Project popup? I'm unsure of what you mean.
So you'll need to manually add a field to app/views/stories/_form.html.erb
, so we can populate what project a story goes with. There's a helper in Rails that puts together this popup, collection_select that does most of the super annoying bits for you.
Does this help?
(You also may need to add project_id
to the story_params
function in StoriesController...)
and manually add that field into the form for Story. (and remember the "remember last setting" feature I wanted, above :) )
(But I'm excited: once we have these three major parts together we can work on how a user actually goes through and does these things!!!)
Alright! So I ran rails g migration AddProjectToStory project:belongs_to
and that did a lot of work for me. I think it covered all of the bases.
I also added belongs_to :author, class_name: User
to project.rb
and added :project_id
to story_params
Honestly I'm not totally sure how to add the FactoryGirl models and tests yet. I'll explore that asap.
If you want to learn from example I could do one for you. Let me know.
Sent from my iPhone
On Sep 7, 2017, at 16:16, Josh notifications@github.com wrote:
Alright! So I ran rails g migration AddProjectToStory project:belongs_to and that did a lot of work for me. I think it covered all of the bases.
I also added belongs_to :author, class_name: User to project.rb
and added :project_id to story_params
Honestly I'm not totally sure how to add the FactoryGirl models and tests yet. I'll explore that asap.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
If you wouldn't mind, that would be great! Thank you!
Fixedin PR #18
Create a Project model:
has_many :users, through: :team_members
def current_team_members self.team_members.current end
Create a Team Members model:
Changes to existing functionality:
belongs_to
association + required database field