rwilcox / odyssey

Rails, React, and deployment patterns
0 stars 0 forks source link

Project model #16

Closed rwilcox closed 7 years ago

rwilcox commented 7 years ago

Create a Project model:

Create a Team Members model:

Changes to existing functionality:

jcarvin commented 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:

rwilcox commented 7 years ago

Some notes:

Theoretically 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 :) )

rwilcox commented 7 years ago

(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!!!)

jcarvin commented 7 years ago

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.

rwilcox commented 7 years ago

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.

jcarvin commented 7 years ago

If you wouldn't mind, that would be great! Thank you!

rwilcox commented 7 years ago

Fixedin PR #18