Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yuriyivanenko
Copy link

Create all needed features.

Copy link
Contributor

@stephenmckeon stephenmckeon left a 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
Copy link
Contributor

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.'
Copy link
Contributor

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.

Comment on lines +2 to +5
belongs_to :pizzeria
validates :name, presence: true
validates :description, presence: true
validates :pizzeria_id, presence: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines +2 to +4
has_many :pizzas
validates :name, presence: true, uniqueness: true
validates :address, presence: true, uniqueness: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines +15 to +17
<% if @pizzeria.present? %>
<%= f.hidden_field :pizzeria_id, value: @pizzeria.id %>
<% end %>
Copy link
Contributor

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]
Copy link
Contributor

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.

Suggested change
resources :pizzas, only: [:new, :create, :show]

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants