Closed obrie closed 13 years ago
Paweł Kondzior commented
For ActiveRecord::Base.inspect solution can be setting just
self.abstract_class = true for the model, maybe it should be set by default with macro acts_as_enumeration ?
Paweł Kondzior commented
For the second issue it seems that source is create() method:
@@@ class TicketStatus < ActiveRecord::Base self.abstract_class = true acts_as_enumeration
column(:id, :integer) column(:name, :string)
create(:id => 1, :name => ’Registered’) create(:id => 2, :name => ’Opened’) create(:id => 3, :name => ’Suspended’) create(:id => 4, :name => ’Resolved’) create(:id => 5, :name => ’Completed’) create(:id => 6, :name => ’Closed’) end @@@
For that model TicketStatus.new will generate 5 errors in development.log
TicketStatus Columns (0.0ms) Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses
TicketStatus Columns (0.0ms) Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses
TicketStatus Columns (0.0ms) Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses
TicketStatus Columns (0.0ms) Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses
TicketStatus Columns (0.0ms) Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses
Thanks for the report!
As of today, acts_as_enumeration (now called enumerate_by) no longer uses tableless models (meaning you shouldn’t run into this problem anymore).
This change was made in http://github.com/pluginaweek/enumerate_by/commit/9f65588a48b9b33d3ef530904400a533a5dad515.
Paweł Kondzior opened this issue
In rails 2.3.1 simple model with is acting as enumeration can’t handle case when there is no table in db, example:
@@@ class TicketStatus < ActiveRecord::Base acts_as_enumeration end @@@
in console
@@@
And fallowing errors in log:
Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM
ticket_statuses
original LH ticket
This ticket has 0 attachment(s).