Skip to content

Completed Pizzeria Lab #7

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

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

Conversation

cmhorsey
Copy link

Completed Rails Pizzeria Lab

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.

Great job, just a few small things to clean up.

Comment on lines +23 to +26
private
def pizza_params
params.require(:pizza).permit(:name,:description, :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.

Suggested change
private
def pizza_params
params.require(:pizza).permit(:name,:description, :pizzeria_id)
end
private
def pizza_params
params.require(:pizza).permit(:name, :description, :pizzeria_id)
end

Comment on lines +4 to +6
validates :name, presence: true
validates :description, presence: true
end
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
validates :name, presence: true
validates :description, presence: true
end
validates :name, :description, presence: true
end

Comment on lines +5 to +14
<%= form_with(model: [@pizzeria, @pizza], local: true ) do |f| %>

<label>Pizza Name: <%= f.text_field :name %></label><br />

<label>Description: <%= f.text_field :description %></label><br />

<%= f.hidden_field :pizzeria_id %>

<%= f.submit %>
<% end %>
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
<%= form_with(model: [@pizzeria, @pizza], local: true ) do |f| %>
<label>Pizza Name: <%= f.text_field :name %></label><br />
<label>Description: <%= f.text_field :description %></label><br />
<%= f.hidden_field :pizzeria_id %>
<%= f.submit %>
<% end %>
<%= form_with(model: [@pizzeria, @pizza], local: true ) do |f| %>
<label>Pizza Name: <%= f.text_field :name %></label><br />
<label>Description: <%= f.text_field :description %></label><br />
<%= f.hidden_field :pizzeria_id %>
<%= f.submit %>
<% end %>


<%= link_to "Tell us about a great pizza you had at #{@pizzeria.name}", new_pizzeria_pizza_path(@pizzeria) %>

<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

This div is not needed.

Comment on lines +7 to +15
<h2>Great eats from: <%= @pizzeria.name %></h2>
<ul>
<% @pizzeria.pizzas.each do |pizza| %>
<br>
<li>
<%= link_to pizza.name, pizza %>
</li>
<% end %>
</ul>
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
<h2>Great eats from: <%= @pizzeria.name %></h2>
<ul>
<% @pizzeria.pizzas.each do |pizza| %>
<br>
<li>
<%= link_to pizza.name, pizza %>
</li>
<% end %>
</ul>
<h2>Great eats from: <%= @pizzeria.name %></h2>
<ul>
<% @pizzeria.pizzas.each do |pizza| %>
<li><%= link_to pizza.name, pizza %></li>
<br />
<% end %>
</ul>

Comment on lines +3 to +6
# get '/pizzerias/new', to: 'pizzerias#new', as: 'new_pizzeria'
# post '/pizzerias', to: 'pizzerias#create', as: 'pizzerias'
# get '/pizzerias/:id', to: 'pizzerias#show', as: 'pizzeria'
# get '/pizzerias', to: 'pizzerias#index'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ewwww

Copy link
Author

Choose a reason for hiding this comment

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

Sorry! I realize I completely neglected this file.

post '/pizzerias', to: 'pizzerias#create', as: 'pizzerias'
get '/pizzerias/:id', to: 'pizzerias#show', as: 'pizzeria'
get '/pizzerias', to: 'pizzerias#index'
resources :pizzas
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure you only define the routes that you are actually using.

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