Getting error while generation of model in JRuby
-
13-07-2021 - |
Question
Hi I am getting error while I am generating the model. Following the error stack i am facing.
rails generate model id:string name:string userid:string groupid:string bookmarktype:string typeid:string additionaldata:string
include_class is deprecated. Use java_import.
include_class is deprecated. Use java_import.
Resolved collector.newrelic.com to 204.93.223.153
invoke active_record
NameError: wrong constant name Id:string
const_defined? at org/jruby/RubyModule.java:2608
class_collisions at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/railties-3.2.3/lib/rails/generators/base.rb:267
each at org/jruby/RubyArray.java:1612
class_collisions at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/railties-3.2.3/lib/rails/generators/base.rb:249
check_class_collision at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/railties-3.2.3/lib/rails/generators/named_base.rb:183
__send__ at org/jruby/RubyBasicObject.java:1667
send at org/jruby/RubyKernel.java:2060
run at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/task.rb:21
invoke_task at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/invocation.rb:118
invoke_all at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/invocation.rb:124
each at org/jruby/RubyHash.java:1192
map at org/jruby/RubyEnumerable.java:715
invoke_all at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/invocation.rb:124
dispatch at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/group.rb:226
__send__ at org/jruby/RubyBasicObject.java:1694
send at org/jruby/RubyKernel.java:2072
invoke at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/invocation.rb:109
_invoke_for_class_method at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/group.rb:269
with_padding at /home/anand/.rvm/gems/jruby-1.7.0.preview2/gems/thor-0.14.6/lib/thor/shell.rb:74
Following is the output of rvm list
rvm list
rvm rubies
=* jruby-1.7.0.preview2 [ i386 ]
ruby-1.9.3-p194 [ i686 ]
# => - current
# =* - current && default
# * - default
I am using Ubuntu 12.04. How to resolve this problem?
Solution
You need to provide the model name while generating with the fields. For example,
rails generate model UserDetails id:string name:string userid:string groupid:string bookmarktype:string typeid:string additionaldata:string
'UserDetails' is the model name.
It's might be the problem. Not sure what you are asking clearly. Cheers!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow