Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8500 (reopened defect)

Opened 3 years ago

Last modified 1 year ago

rails bin raises: undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)

Reported by: zinger Assigned to: core
Priority: normal Milestone: 2.x
Component: Railties Version:
Severity: normal Keywords: ubuntu freebsd
Cc: tarmo

Description

zinger@zombie:/var/lib/gems/1.8/gems$ rails
/var/lib/gems/1.8/gems/rails-1.2.3/bin/../lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
        from /var/lib/gems/1.8/gems/rails-1.2.3/bin/../lib/rails_generator/base.rb:89
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /var/lib/gems/1.8/gems/rails-1.2.3/bin/../lib/rails_generator.rb:34
        from /var/lib/gems/1.8/gems/rails-1.2.3/bin/rails:14:in `require'
        from /var/lib/gems/1.8/gems/rails-1.2.3/bin/rails:14

zinger@zombie:/var/lib/gems/1.8/gems$ ruby -v
ruby 1.8.5 (2006-08-25) [i486-linux]

zinger@zombie:/var/lib/gems/1.8/gems$ uname -a
Linux zombie 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

This is from a fesh install of rails-1.2.3 with dependencies from a fresh install of rubygems. I even tried uninstalling everything and installing each dependency manually from gems.

Change History

05/28/07 21:19:50 changed by zinger

Same result on x86_32 and x86_64 version of Ubuntu 7.04 (feisty)

05/28/07 21:48:43 changed by bitsweat

  • keywords set to ubuntu.
  • status changed from new to closed.
  • resolution set to worksforme.
  • milestone changed from 1.x to 1.2.4.

You're missing some Ruby packages and it's preventing Active Support, which has write_inheritable_attribute, from loading.

Try

require 'rubygems'
require 'activesupport'

in irb and see whether it raises a LoadError.

07/06/07 02:55:42 changed by tailorcai

  • status changed from closed to reopened.
  • resolution deleted.

i reproduced the defect. the cause is i install activesupport using gem and the folder is activesupport-1.4.2 something. but i noticed in rails_generator.rb,

line2: $:.unshift(File.dirname(FILE) + "/../../activesupport/lib")

after i rename the autogenerated folder activesupport-1.4.2 to activesupport, everything is fine.

08/25/07 07:45:34 changed by tarmo

  • cc set to tarmo.

tailorcai, if you installed activesupport from a gem then it should be in "activesupport-1.4.2". The unshift line is just to make sure that if gems are not used (for example vendor/rails is used) then activesupport gets loaded from the proper directory.

02/12/09 17:17:40 changed by pops_head

  • keywords changed from ubuntu to ubuntu freebsd.
  • version deleted.
  • milestone changed from 1.2.7 to 2.x.

This happened with a new install of rails 2.2.2:

[pops_head@whackadoodle /usr/local/rails]$ rails floog
/usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/bin/../lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/bin/../lib/rails_generator/base.rb:90
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/bin/../lib/rails_generator.rb:34
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/bin/rails:13
        from /usr/local/bin/rails:19:in `load'
        from /usr/local/bin/rails:19

I'm running:

FreeBSD whackadoodle 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

With Ruby: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-freebsd7]

Gems: 1.3.1

If I install rails 2.1.0, then "rails floog" works perfectly.