Git Product home page Git Product logo

Comments (8)

nhocki avatar nhocki commented on May 21, 2024 1

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.

nhocki avatar nhocki commented on May 21, 2024

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.

ryanb avatar ryanb commented on May 21, 2024

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.

ryanb avatar ryanb commented on May 21, 2024

Did you ever get this issue resolved? If so I will close this ticket.

from nifty-generators.

volkanunsal avatar volkanunsal commented on May 21, 2024

Yeah, I realized I should have used products_path, not products_index_path.

from nifty-generators.

marcofang avatar marcofang commented on May 21, 2024

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.

marcofang avatar marcofang commented on May 21, 2024

@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.

nhocki avatar nhocki commented on May 21, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.