ryanb / nifty-generators

A collection of useful Rails generator scripts.
MIT License
1.98k stars 283 forks source link

undefined method `title' #34

Open gekker opened 14 years ago

gekker commented 14 years ago

I get

ActionView::Template::Error (undefined method `title' for #<#Class:0x00000104e331b8:0x00000104e31458>) on line #1 of /Users/user/src/blah/app/views/articles/index.html.erb: 1: <% title "Articles" %>

for the nifty:scaffold generator, this is with the latest gem version, rails 3 beta 3, and ruby 1.9.2dev

rails generate nifty:scaffold Article title:string description:text

gekker commented 14 years ago

Sorry for the noise...

rails g nifty:layout

obviously solves the issue.

mikbe commented 13 years ago

That fixes it but it shouldn't be a separate step. Since nifty:layout is required by nifty:authentication it should be run automatically.

ryanb commented 13 years ago

@mikbe, once you generate the nifty:layout once then it shouldn't be re-generated again, that's why it isn't included in the authentication/scaffold generators. However I'm open to ideas on how to make this more intuitive.

mikbe commented 13 years ago

Thanks for the reply Ryan. The issue is I had not run the nifty:layout method since I wasn't interested in the layout code. I just wanted to look at the authentication code to see how you were do it.

The easiest fix, if you consider it broken, would be to just run nifty:layout when nifty:auth is run. Then the user can decide if they want to overwrite files (like other rails generators do) but if nifty:layout has never been run then there's no confusing error.

Thanks again for the reply and also all the awesome work you do!

victor-rocha commented 12 years ago

Im getting this after run the rails g nifty:layout:

undefined method `username' What can it be?

ddd1600 commented 12 years ago

@gekker That's not noise dude, even on Stack Overflow. (I had the same problem)