Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Rails 3: rails g scaffold doesn't work #9

Merged
merged 1 commit into from
@basti

In latest Rails 3 (release candidate) when 'rails g scaffold' is called I get the following error:

Corsica:enumtest $ rails g scaffold
/Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute/rails_helpers.rb:26:in `require': no such file to load -- rails_generator (LoadError)
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute/rails_helpers.rb:26
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute/attribute.rb:7:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute/attribute.rb:7
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute.rb:3:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/bundler/gems/enumerated_attribute-c5e2944/lib/enumerated_attribute.rb:3
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:64:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:64:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:62:in `each'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:62:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:51:in `each'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler/runtime.rb:51:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.0.rc.1/lib/bundler.rb:109:in `require'
from /Users/basti/dev/rails3/enumtest/config/application.rb:7
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.0.0.rc/lib/rails/commands.rb:15:in `require'
from /Users/basti/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.0.0.rc/lib/rails/commands.rb:15
from script/rails:6:in `require'
from script/rails:6
@exceed

I second this. Same behavior with Ruby 1.9.2

@rweng

+1

@khelal

Same here in Rails 1.8.7 (REE)

@matteomelani

Same here with Ruby 1.9.2

@Nsm

Please pull the changes in https://github.com/edave/enumerated_attribute to fix this

@levity

Nsm's fix works. However, that whole ARGV test is... well...

Let's just say, this bug popped up for me only because I was running rspec and one of my test files has the word "scaffold" in its name.

@rosskevin

edave's changes worked for me with rails 3.1rc4

gem "edave-enumerated_attribute", :git => "https://github.com/edave/enumerated_attribute.git"

@turadg

Anyone like to file a pull request?

I'd take the commits from @edave but they change the gem to edave-enumerated_attribute and the new gemspec throws warnings during bundle update.

@raston

trollixx's patch fixes this for me on Rails 3.1. Use this in your Gemfile:

gem "enumerated_attribute", :git => "https://github.com/trollixx/enumerated_attribute.git"
@sylario

I replaced
gem 'enumerated_attribute'
with
gem "enumerated_attribute", :git => "https://github.com/trollixx/enumerated_attribute.git"

and ran bundle update
But now i have those errors :
undefined method `enum_attr' for #Class:0xa88a428

Is there another step when you use git repos as gems?

@turadg turadg merged commit 3d827b0 into jeffp:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2011
  1. @trollixx
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +1 −2  lib/enumerated_attribute/rails_helpers.rb
View
3  lib/enumerated_attribute/rails_helpers.rb
@@ -36,7 +36,6 @@ def enum(*args)
#ARGV is used by generators -- if it contains one of these generator commands - add enumeration support
#unless ((ARGV || []) & ["scaffold", "rspec_scaffold", "nifty_scaffold"]).empty?
if ((ARGV || []).any?{|o| o =~ /scaffold/ })
- require 'rails_generator' rescue nil
begin
require 'rails/generators'
require 'rails/generators/generated_attribute'
@@ -45,7 +44,7 @@ def enum(*args)
end
module Rails
- module Generator
+ module Generators
class GeneratedAttribute
def field_type_with_enumerated_attribute
return (@field_type = :enum_select) if type == :enum
Something went wrong with that request. Please try again.