dry_scaffold icon indicating copy to clipboard operation
dry_scaffold copied to clipboard

Generating a dry_scaffold with versions 0.3.6 or 0.3.7 you get a non working scaffold!

Open albertoperdomo opened this issue 15 years ago • 7 comments

Hi,

the generated scaffolds seem to be broken.

When generating a dry_scaffold wrong variable names are rendered in the views (using the default options).

Example: ruby script/generate dry_scaffold Book ...

In index.html.haml the collection variable is referenced as @collection where it should be @books (as defined in the corresponding controller).

In new.html.haml, edit.html.haml and show.html.haml the instance variable is referenced as @resource where it should be @book

The titles in the views are also generated wrong: "New resource" "Editing resource..." etc. instead of "New book", etc. etc.

albertoperdomo avatar Jan 05 '10 13:01 albertoperdomo

This is not broken in the latest release from github 0.3.5.

albertoperdomo avatar Jan 05 '10 14:01 albertoperdomo

Are you using InheritedResources?

grimen avatar Jan 06 '10 00:01 grimen

same thing here (using inherited resources and the gem dry_scaffold-0.3.7)

angelf avatar Jan 06 '10 08:01 angelf

Yes, i'm using InheritedResources.

From what i understand, im my example with the model Book and the action index, the variable referenced in the view should be either @books, or collection, not @collection.

From the InheritedResources doc:

In your views, you will get the following helpers:

resource        #=> @project
collection      #=> @projects
resource_class  #=> Project

albertoperdomo avatar Jan 06 '10 15:01 albertoperdomo

I'm seeing this bug too. Yes, using inherited resources and dry_scaffold-0.3.7 gem.

kevinold avatar Jan 25 '10 20:01 kevinold

Has this been fixed? I'm getting the same errors..

connor-t avatar Mar 19 '10 16:03 connor-t

I have patched it in my repo: http://github.com/albertoperdomo/dry_scaffold You can try and see if it works well for you.

albertoperdomo avatar Mar 19 '10 16:03 albertoperdomo