GithubHelp home page GithubHelp logo

grimen / dry_scaffold Goto Github PK

View Code? Open in Web Editor NEW
125.0 125.0 14.0 243 KB

Rails: A Rails scaffold generator that generates DRYer, cleaner, and more useful code. IMPORTANT: Not maintained anymore.

License: MIT License

Ruby 100.00%

dry_scaffold's People

Contributors

akitaonrails avatar grimen avatar pelle avatar semarco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dry_scaffold's Issues

undefined method `total_pages'

When I generate a dry_scaffold, run the migration, and go to the index page, I received the error

undefined method `total_pages'

Why does this happen?

--skip-resourceful doesn't

After experiencing some issues with the inherited_resources bits I decided to just skip them for now. But when I run "script/generate dry_scaffold Zebra name:string about:text --skip-resourceful" in my project the resourceful controller and views are still created.

:Fuzz

Does not create route

When generating a new scaffold the routes are not updated. I don't know if this is the intentional behaviour or not...

dscaffold can't find default configuration file

Generator fails for some reason:

$ dscaffold ...
No such file or directory - /opt/local/lib/ruby/gems/1.8/gems/grimen-dry_scaffold-0.2.3/generators/dscaffold/../dry_scaffold/../../config/scaffold.yml

fgirl option in config file

Setting 'fgirl' option to true in a config does not seem to work. Looking at code option should probably be 'factory_girl' but setting that to true does not work as expected either.

README-typo

Should be:

config.gem 'grimen-dry_scaffold', :lib => false

Factories only created sporadically

I generated 3 scaffolds and 2 models on the command line, specifying --fgirl for each one, yet a Factory was only generated for one of the five.

Use inherited_resources paths

Use collection_path, resource_path, etc. unless skipping inherited_resources.
Also, perhaps use the longer method for creating the form tag...

- semantic_form_for resource, :url => edit_resource_path(resource) do |form|

This will allow belongs_to/polymorphic controllers without any updates to the views.

rais3

Hi!

This is a wonderful asset when creating apps and I use it al of the time. Curious, is there a Rails3 branch for this gem?

I know that Rails3 provides a new way of doing generators and templates where you could create something like this pretty easily. I do like the way you currently do it with dry_scaffold.

Thanks in advance,
Mark

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

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.

RSpec-support

Add option to generate RSpec-tests instead of Test::Unit/Shoulda.

config/scaffold.yml doesn't seem to be honoring...

my:

resourceful: false
shoulda: true

I've done this a couple times today to make sure - here's a gist:

http://gist.github.com/224563

If I pass it on the command line - it works just fine:

./script/generate dry_scaffold Zebra name:string about:text --skip-resourceful --shoulda

I may be doing something wrong - but I just want to:

create a rails app
add dry_scaffold
add a simple model/controller with your scaffold generator
have the basic tests pass

And I can't seem to be able to do that - like I said, I may be doing something wrong, but am not sure what.

InheritedResorces testing issue

Contact José regarding the InheritedResources-issue:

  1. ActionController::RoutingError: parrot_url failed to generate from {:controller=>"parrots", :id=>#<Parrot id: nil, name: "Hello", created_at: "2009-07-21 18:53:25", updated_at: "2009-07-21 18:53:25">, :action=>"show"}, expected: {:controller=>"parrots", :action=>"show"}, diff: {:id=>#<Parrot id: nil, name: "Hello", created_at: "2009-07-21 18:53:25", updated_at: "2009-07-21 18:53:25">}
    (eval):16:in parrot_url' /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/url_helpers.rb:194:inresource_url'
    /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/base_helpers.rb:311:in send' /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/base_helpers.rb:311:inparse_redirect_url'
    /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/base.rb:79:in create' /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/respond_to.rb:301:incall'
    /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/respond_to.rb:301:in respond_any' /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/respond_to.rb:233:inrespond_to'
    /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/base_helpers.rb:283:in respond_to_with_dual_blocks' /opt/local/lib/ruby/gems/1.8/gems/josevalim-inherited_resources-0.7.3/lib/inherited_resources/base.rb:78:increate'
    haml (2.0.9) rails/./lib/sass/plugin/rails.rb:19:in process' /test/functional/donkeys_controller_test.rb:8:intest_create'

test 'create' do
Donkey.any_instance.expects(:save).returns(true)
@donkey = donkeys(:basic)
post :create, :donkey => @donkey.attributes # <<<<<<<<<<<<< donkeys_controller_test.rb:8
assert_response :redirect
end

  1. test_destroy_with_failure(DonkeysControllerTest) [/test/functional/donkeys_controller_test.rb:45]:
    expected to not be nil.

test 'destroy with failure' do
Donkey.any_instance.expects(:destroy).returns(false)
@donkey = donkeys(:basic)
delete :destroy, :id => @donkey.to_param
assert_not_nil flash[:error] # <<<<<<<<<<<<< donkeys_controller_test.rb:45
assert_response :redirect
end

Generate links for actions in _actions only

This action:
./script/generate dscaffold Duck name:string about:text _actions:new,create,index,quack

Generates "edit" links on the _item view.

Of course, if _actions isn't specified, it can be assumed that the default _actions are set.

Option toggling

Come up with a smooth way to disable an option that is true by default, i.e. negative toggle.

@resource and @collection throw errors in views

Right now the following order generates errors (with all the dependencies installed):
./script/generate dscaffold Duck name:string about:text _actions:new,create,index,quack

The errors are:

  1. On apps/views/duck/index.html.haml
    @collection.each do |resource| #gives an error (@collection is nil)
  2. On apps/views/duck/new.html.haml
    semantic_form_for(@resource) do |form| #gives an error (@resource is nil)

I believe the second error will also happen on edit - I just didn't generate a view for the action.

If I change @collection and @resource to @ducks and @duck the errors go away.

"Best practices" tests

Write even better functional tests for REST-actions. Goal: Killer-tests, i.e. "best practice"-tests. Suggestion: Routing, formats, ...

build_object reads wrong option

build_object reads 'factory_framework' but it is not set in scaffold.yml. in the yaml file, some other options are set 'true/false'

dry_scaffold not working (Can't convert nil to String)

The command I'm running is the line below. The line immediately following is the only response I get from the attempt. This is on an established project that has no other (apparent) issues.

generate dry_scaffold User name:string email:string
can't convert nil into String

I'm running Rails 2.3.5.

i18n of table & page headings, attribute names, links and buttons

The following command:
./script/generate dscaffold Duck name:string about:text _actions:new,create,index,quack

Will generate the following in app/views/duck/index.html.haml

= "Resources" # I believe this was meant to say "Ducks"?
...
%th.name= 'Name'
%th.about= 'About'
%th.actions= 'Actions'

This makes i18n generation difficult. I suggest ussing human_name & human_attribute_name for the header & attributes, and t('Actions) for the Action header:
= Duck.human_name(:count => 2)
...
%th.name= Duck.human_attribute_name(:name)
%th.about= Duck.human_attribute_name(:about)
%th.actions= t('Actions')

Similarly, the links & buttons can be made i18n-compliant quite easily. The following lines:
= form.commit_button 'Create'
= link_to 'Show', resource_path(resource)
= will_paginate(@collection)
would become:
= form.commit_button t('Create')
= link_to t('Show'), resource_path(resource)
= will_paginate(@collection, :previous_label => t('Previous'), :next_label => t('Next') )

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.