marcandre / backports

The latest features of Ruby backported to older versions.
MIT License
437 stars 52 forks source link

error in rails model generator #37

Closed dfugere closed 13 years ago

dfugere commented 13 years ago

/Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/backports-2.0.1/lib/backports/tools.rb:146:in coerce_to': Coercion error: [].to_str => String failed: (TypeError) (undefined methodto_str' for []:Array) from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/backports-2.0.1/lib/backports/tools.rb:108:in convert_to_path' from (eval):2:injoin' from (eval):2:in map' from (eval):2:injoin' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.5/lib/rails/generators/active_record/model/model_generator.rb:20:in create_model_file' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:insend' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in run' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:ininvoke_task' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in invoke_all' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/backports-2.0.1/lib/backports/tools.rb:104:inmap' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/core_ext/ordered_hash.rb:75:in each' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:inmap' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in invoke_all' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:indispatch' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:109:in send' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:109:ininvoke' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:269:in _invoke_for_class_method' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/shell.rb:74:inwith_padding' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:258:in _invoke_for_class_method' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:134:in_invoke_from_option_orm' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in send' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:inrun' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in invoke_task' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:ininvoke_all' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/backports-2.0.1/lib/backports/tools.rb:104:in map' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/core_ext/ordered_hash.rb:75:ineach' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in map' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:ininvoke_all' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in dispatch' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/base.rb:389:instart' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.5/lib/rails/generators.rb:163:in invoke' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.5/lib/rails/commands/generate.rb:10 from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inrequire' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in new_constants_in' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require' from /Users/davidfugere/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.5/lib/rails/commands.rb:17 from script/rails:6:inrequire' from script/rails:6

dfugere commented 13 years ago

The command that caused the error was : rails g model contact_information name:string value:string kind:string contactable_type:string contactable_id:integer

migration was generated, but not the model file....

marcandre commented 13 years ago

Ah! Just learned that File.join can accept arrays... Fixed in 2.0.3. I should make RubySpec more precise about wether paths inside arrays are converted with to_path or not, and backport if need be.