-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
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.
Great job, just a few small things to clean up.
private | ||
def pizza_params | ||
params.require(:pizza).permit(:name,:description, :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.
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 |
validates :name, presence: true | ||
validates :description, presence: true | ||
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.
validates :name, presence: true | |
validates :description, presence: true | |
end | |
validates :name, :description, presence: true | |
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 %> |
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.
<%= 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> |
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.
This div
is not needed.
<h2>Great eats from: <%= @pizzeria.name %></h2> | ||
<ul> | ||
<% @pizzeria.pizzas.each do |pizza| %> | ||
<br> | ||
<li> | ||
<%= link_to pizza.name, pizza %> | ||
</li> | ||
<% end %> | ||
</ul> |
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.
<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> |
# 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' |
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.
Ewwww
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.
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 |
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.
Make sure you only define the routes that you are actually using.
Completed Rails Pizzeria Lab