Comments (8)
Your problem is with the command you used at the scaffold generation. You have to remove the "s" at the end of ProductS
rails g nifty:scaffold Product title:string description:text specification:text images:text
Remember you'll generate the model names in singular and scaffold uses the model name :-)
Hope this helps,
NHI
from nifty-generators.
That's more a routes problem than something related with the generators. Run rake routes in your comand line to get all your routes. If you do map.resources :products you should get the new_product_path and the products_path.
from nifty-generators.
As nhocki mentioned, does adding map.resources :products
to your config/routes.rb
file work for you? the scaffold generator should have done this automatically.
from nifty-generators.
Did you ever get this issue resolved? If so I will close this ticket.
from nifty-generators.
Yeah, I realized I should have used products_path
, not products_index_path
.
from nifty-generators.
I met exactly the same issue under current version (nifty-generators 0.4.6, rails 3.0.6) which I have put resources :products
in my config/routes.rb
file.
I had generated several times and the results were all the same errors, any help would be welcome.
Here's my generate script:
rails g nifty:scaffold Products title:string description:text specification:text images:text
Update:
After digging form_for
helper documents, I found that to add something to the first line of _form.html.erb
will fix the error, which the solution is not obvious for newbies.
Original code: (Line 1 of _form.html.erb)
<%= form_for @products do |f| %>
Change to:
<%= form_for @products, :url => products_path(@products) do |f| %>
from nifty-generators.
@nhocki Indeed the singular name solved the issue ;) I think to pick a countable word is very important, since "news" won't work as well!
from nifty-generators.
@marcofang if you need "news" you can set that as an uncountable object in you config/initializers/inflections.rb file.
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable %w( fish sheep news )
end
Hope that helps :-)
from nifty-generators.
Related Issues (20)
- nifty_authentication.feature failing
- Rails 3.2 issue - layout generation HOT 4
- twitter bootstrap support? HOT 3
- how set up params to action create by any_instance.stubs
- nifty does not check if the model name is permitted
- default string type
- nifty:authentication --help logged_in? error HOT 6
- does not work in plugins/engines
- Could not find generator nifty:scaffold HOT 1
- form_tag isn't rendering any form
- nifty authentication: session variable getting deleted/unset unexpectedly
- Mismatched routing in scaffold HOT 3
- PG::Error: ERROR: zero-length delimited identifier at or near """" -- nifty authentication HOT 3
- There is an issue with Gherkin gem
- Fail to use nifty_authentication
- error in root
- current_user helper method error
- Errror creating Authentication Migration HOT 2
- ruby on rails nifty generators
- [0.4.6] scaffold_generator.rb:85:in `create_migration': wrong number of arguments (given 3, expected 0) (ArgumentError) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nifty-generators.