Skip to content

Instantly share code, notes, and snippets.

@jesseract
Last active August 29, 2015 14:16
Show Gist options
  • Save jesseract/7377efafdbf361e1db12 to your computer and use it in GitHub Desktop.
Save jesseract/7377efafdbf361e1db12 to your computer and use it in GitHub Desktop.
Detailed Rails Questions
What is the difference between form_for and form_tag?
Form_for is required for nested attributes, and is for a specific object. Form_tag can be used generally on the page and doesn't have to target a specific object. form_for @user do
When you submit a form_tag it posts and goes to the same page by default
Form_for goes to create/update by default
-create if the object it's targeting have never been saved, update if it has
What is the difference between render and redirect_to?
Render will render the form or whatever on your web page so you can see it. Redirect will send the user to another page on your site.
What is the difference between development and production?
Development is the environment when you are making your app, and production is the final product. You'll have elements in both environments that you won't have in your the other, such as gems or passwords. When devs are working on something they're working in the development environment. When users are making something, they're working in production. Development is local, on our computers, while production is on heroku or on a server farm.
Big Picture Questions
What do you think about RSpec and MiniTest? Have you used either of them? Which do you think is better?
I haven't used RSpect, but I like using MiniTest because it shows dots for both the tests that passed and the ones that failed, rather than a single line that is red for failure.
RSpec is behavior-driven
What do you try to keep in mind when you're designing your models?
What does the assignment specifically ask for, what have I done in previous assignments that were similar to this.
Modeling the real world in our tables
Important to know that they're more than just a 1-to-1 with database tables
Each model's logic should only pertain to what that model is, and have few dependencies with another model.
Single-model responsibility -- everything in your methods should only do one thing each
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment