ruby on rails - TypeError Conversion on has_many relationship -


I have some objects in a rail app ("ticket" and "comment")

 < Code> Class Tickets & lt; ActiveRecord :: Base has has_many: attributes has_many: Comments end class comment & lt; ActiveRecord :: Base is_to: ticket is_to: user end  

with the following schema:

  create_table "comments" ,: force = & gt; Is true T | T.integer "ticket_id" t.integer "user_id" t.text "content" t.datetime "created_at" t.datetime "update_at" end create_table "ticket",: force = & gt; Is true T | T.integer "site_id" t.integer "status" t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" and  

However, for any reason - whenever I get an accident @:

The string can not be converted to an integer

Any thoughts? This is driving me!

I think the row you can stand is:

  has_many: attributes  

"attributes" is a special word in an active record. It refers to the values ​​of the column in the DB.

If you try and override this with a union, then you have problems. My suggestion is that you should not have a model called "specialty" - call it something else, such as "property", and problems will go away.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -