Closed shivabhusal closed 7 years ago
I think this error is originating from
pry(#<#<Class:0x00000005c108b8>>)> @table
=> #<RailsDb::Table:0x00000005274e30
@data=#<RailsDb::TableData:0x00000005274638 @table=#<RailsDb::Table:0x00000005274e30 ...>>,
@model=
#<Class:0x0000000526bc68>(id: integer, first_name: string, last_name: string, phone_number: string, address: string, city: string, state: string, zip: string, date_of_birth: date, gender: integer, metadata: json, type: string, ..... , updated_at: datetime),
@name="users">
pry > @model.class.name
=> "Class"
# I think it should have been "User" or "VehicleOwner"
# That is why its throwing error "ActiveRecord::SubclassNotFound: Invalid single-table inheritance type: VehicleOwner is not a subclass of "
# did you notice, there is nothing after "of"
# rails_db-1.3.3/app/controllers/rails_db/tables_controller.rb:49
def create_model(table_name, &block)
klass = Class.new(ActiveRecord::Base) do
def self.model_name
ActiveModel::Name.new(self, nil, table_name)
end
self.table_name = table_name
end
klass.class_eval(&block) if block_given?
klass
end
try now
thanks @igorkasyanchuk
It still shows this error when I click on my users
table link in sidebar. I have used STI: Customer
and Admin
are derived from User
model.
ActionView::Template::Error (Invalid single-table inheritance type: Customer is not a subclass of ):
79: </tr>
80: </thead>
81: <tbody>
82: <% @records.each do |record| %>
83: <tr class="row_<%= record[@table.primary_key] %>">
84: <%= render 'row', record: record %>
85: </tr>
ok, will check again @Snick555 please let's check again tomorrow
@shivabhusal try now ... with latest version 1.4.1 of gem
@igorkasyanchuk wow awesome!! the problem is gone now.
When I clicked the
users
link to see data-records, nothing happended. When I pried at Browser console, I saw500
error.I saw the error in server log.
Schema of
User
modelSystem attributes
Data in Table
users
Backtrace
activerecord (5.0.0.1) lib/active_record/inheritance.rb:189:in 'find_sti_class'