Hey
I am adding another database to my first one and i created the html to work
showing the data but when i want to create a new entry this error occurs. I
have a new controller with everything in it but not sure why it doesnt work.
ActionController::UrlGenerationError in Shopping#new
Showing *C:/Sites/blog/app/views/shopping/new.html.erb* where line *#2*
raised:
No route matches {:action=>"show",
:controller=>"shopping"} missing required keys: [:id]
Extracted source (around line *#2*):
12345
<h1>Shopping#new</h1>
<%= form_for @shop, url: shopping_path do |f| %>
<p>
<%= f.label :title %><br>
<%= f.text_feild :title %>
Rails.root: C:/Sites/blog
Application Trace <http://localhost:3000/shopping/new#> | Framework Trace
<http://localhost:3000/shopping/new#> | Full Trace
<http://localhost:3000/shopping/new#>
app/views/shopping/new.html.erb:2:in
`_app_views_shopping_new_html_erb___572466137_45190848'
Request
*Parameters*:
None
Toggle session dump <http://localhost:3000/shopping/new#>
Toggle env dump <http://localhost:3000/shopping/new#>
Response
*Headers*:
None
*Controller:*
class ShoppingController < ApplicationController
def new
@shop = Shop.new
end
def create
@shop = Shop.new(shop_params)
@shop.save
redirect_to @shop
end
def show
@shop = Shop.find(params[:id])
end
def index
@shopping = Shop.all
end
private
def shop_params
params.require(:shop).permit(:title, :text)
end
end
*HTML FILE*
<h1>Shopping#new</h1>
<%= form_for @shop, url: shopping_path do |f| %>
<p>
<%= f.label :title %><br>
<%= f.text_feild :title %>
</p>
<p>
<%= f.label :text %><br>
<%= f.text_area :text %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
<%= link_to 'Back', shopping_path %>
Regards
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/8fb21730-7dd1-4b48-95e3-0aac13a766e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.