Re: Creating a rails 3 app generator executable using thor

Kristian Mandrup
Thu, 28 Jan 2010 17:40:10 -0000

except I run into the following issue

module Nifty
  module Generators
    class ScaffoldGenerator < Base
...
      def initialize(*args, &block)
        super

        args_for_c_m.each do |arg|
          if arg == ''!''
            options[:invert] = true    <<<<<< line 53
...
        if @model_attributes.empty?
          options[:skip_model] = true  <<<<<<<<

end
--
$ nifty_scaffold blip
/opt/local/lib/ruby/gems/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/
thor-0.12.3/lib/thor/core_ext/hash_with_indifferent_access.rb:26:in `
[]
='': can''t modify frozen hash (RuntimeError)
        from /opt/local/lib/ruby/gems/1.9.1/gems/railties-3.0.pre/lib/
rails/
vendor/thor-0.12.3/lib/thor/core_ext/hash_with_indifferent_access.rb:
26:in `[]=''
        from /opt/local/lib/ruby/gems/1.9.1/gems/
very_nifty_generators-0.1.2/
lib/generators/nifty/scaffold/scaffold_generator.rb:53:in `initialize''
--

Is there a nice way to fix this? Do I have to create a non-frozen
custom options collection or someone has a better idea?

Kristian