nifty-generators icon indicating copy to clipboard operation
nifty-generators copied to clipboard

undefined method `title'

Open gekker opened this issue 15 years ago • 6 comments

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 avatar May 13 '10 19:05 gekker

Sorry for the noise...

rails g nifty:layout

obviously solves the issue.

gekker avatar May 13 '10 20:05 gekker

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

mikbe avatar Apr 24 '11 21:04 mikbe

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

ryanb avatar Apr 28 '11 23:04 ryanb

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!

mikbe avatar Apr 29 '11 00:04 mikbe

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

undefined method `username' What can it be?

victor-rocha avatar Jun 28 '12 17:06 victor-rocha

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

ddd1600 avatar Aug 01 '12 20:08 ddd1600