Error while adding index to rails migration -


I am trying to add an index to a railway migration using the command given below: < pre> generate rail migration Add_user_id_to_pins User_id: integer index

and I get this error:

  irb (main): 014: 0 & Gt; Generate rail travelers Add_user_id_to_pins User_id: integer index: syntax error: (IRB): 14: syntax error, unexpected tLABEL rails generate migration Add_user_id_to_pins User_id: integer index of C ^: /Ruby200-x64/lib/ruby/gems/2.0.0 / Gemstone / railties-4.1.4 / lib / rail / commands / console.rb: 90: 'starting with `C: /Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4 / lib / rail / orders / console.rb: 9: /Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks: in `starting from C ' . rb: 69: /Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb :: 40: console C 'Men` in run_command! '/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands.rb :: 17: From' C 'to & lt; Top (required) & gt; 'From Bin / Rail: 4: In' Requirements' from Bin / Rail: 4: `& lt; Main & gt; '   

If this helps further, then my models are: User class:

  class users & lt; ActiveRecord :: Base # include default develop module others are available: # :, confirmable :, lockable: timeoutable and: omniauthable will :, database_authenticatable :, registerable :, recovery :, rememberable: track-able, : Validatable has_many: pin end   

pins class:

  square pins & lt; ActiveRecord :: Base is_to: User End   

Associations were added after creating two domain classes, the user class was generated by the device and the pin, which generated the rail.

I saw and the syntax seems right. So why is this error going up?

your system console (terminal) instead of this command run rails console or IRB console It should work .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -