1

I got problem with make form where i can chose between true or false.
In model ticket i got:
type:boolean

When i'm making check_box in form i got this error msg:

Invalid single-table inheritance type: 1 is not a subclass of Ticket

My form code:
<%= form_for [@movie, @seance, @ticket] do |f| %>
<div>
<%= f.label :type %>
<%= f.check_box :type %>
<%end%>

2 Answers 2

3

type is a reserved word in ruby-on-rails, used for STI.

Change your column name to, say, :ticket_type

Sign up to request clarification or add additional context in comments.

Comments

0

You can change the Single Table Inheritance 'type' column, changing the name for something else.

self.inheritance_column = :fake_column

https://devblast.com/b/single-table-inheritance-with-rails-4-part-1

1 Comment

please try to improve your answer making it more clear. If you want you can copy & paste relevant information from the page you linked devblast... just put between quotes. Also it is not clear why he/she is getting the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.