-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish Lab #3
base: master
Are you sure you want to change the base?
Finish Lab #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, but room for improvement. Make sure you take the time to go back and clean things up.
@@ -0,0 +1,31 @@ | |||
class PizzasController < ApplicationController | |||
def new | |||
puts params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 weeks of asking you to stop committing this!!!!! If I see this on the actual code challenge, I'm going to fail you immediately.
@pizza = Pizza.new(pizza_params) | ||
|
||
if @pizza.save | ||
redirect_to pizza_path @pizza, notice: 'Pizza was successfully created.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're not handling the notice
, don't include it in the redirect. As of now, it does nothing.
belongs_to :pizzeria | ||
validates :name, presence: true | ||
validates :description, presence: true | ||
validates :pizzeria_id, presence: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
belongs_to :pizzeria | |
validates :name, presence: true | |
validates :description, presence: true | |
validates :pizzeria_id, presence: true | |
belongs_to :pizzeria | |
validates :name, :description, :pizzeria_id, presence: true |
has_many :pizzas | ||
validates :name, presence: true, uniqueness: true | ||
validates :address, presence: true, uniqueness: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has_many :pizzas | |
validates :name, presence: true, uniqueness: true | |
validates :address, presence: true, uniqueness: true | |
has_many :pizzas | |
validates :name, presence: true, uniqueness: true | |
validates :address, presence: true, uniqueness: true |
<% if @pizzeria.present? %> | ||
<%= f.hidden_field :pizzeria_id, value: @pizzeria.id %> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional wouldn't be needed if you set @pizzeria
in the create action.
resources :pizzas, only: [:new, :create, :show] | ||
end | ||
|
||
resources :pizzas, only: [:new, :create, :show] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need this line.
resources :pizzas, only: [:new, :create, :show] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit files/changes that don't involve your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Create all needed features.