以前我创建了一个运行良好的模型,但现在可能通过生成的一些脚手架停止工作,我的模型称为Motivonoventa
,复数为Motivosnoventa
。
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'motivonoventa', 'motivosnoventa'
我将Motivonoventa.last
放在rails终端中,但是我收到以下错误:
ActiveRecord::StatementInvalid: Invalid object name 'motivonoventa'.: EXEC sp_executesql N'SELECT [motivonoventa].* FROM [motivonoventa] ORDER BY [motivonoventa].[IdMot] DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY'
from /home/luis/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-sqlserver-adapter-4.2.15/lib/active_record/connection_adapters/sqlserver/database_statements.rb:352:in `each'
这是我的模特:
class Motivonoventa < ActiveRecord::Base
self.primary_key = "IdMot"
end
是inflections.rb
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'motivonoventa', 'motivosnoventa'
inflect.irregular 'vent', 'venta'
inflect.irregular 'no_venta', 'noventas'
end