1
votes

Salammobile::Sms.last

Salammobile::Sms Load (106.1ms) SELECT sms.* FROM sms ORDER BY sms.oppid DESC LIMIT 1 ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'international'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Salammobile::Sms.inheritance_column to use another column for that information. from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:153:in rescue in find_sti_class' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:147:infind_sti_class' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:136:in discriminate_class_for_record' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/persistence.rb:53:ininstantiate' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:in block in find_by_sql' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/result.rb:21:inblock in each' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/result.rb:21:in each' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/result.rb:21:ineach' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:in map' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:infind_by_sql' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/relation.rb:585:in exec_queries' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/relation.rb:471:inload' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/relation.rb:220:in to_a' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/relation/finder_methods.rb:340:infind_last' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/relation/finder_methods.rb:123:in last' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:146:inlast' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/activerecord-4.0.0/lib/active_record/querying.rb:3:in last' from (irb):12 from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/railties-4.0.0/lib/rails/commands/console.rb:90:instart' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in start' from /usr/local/rvm/gems/ruby-1.9.3-p448@salamPlanet/gems/railties-4.0.0/lib/rails/commands.rb:64:in' from bin/rails:4:in `require'

2

2 Answers

3
votes

You can't have a database column called type in Rails unless it's being used for ActiveRecord inheritance mechanism. Rename the column to something else.

Try including this at your class definition:

inheritance_column = "class_type"

This should make it ignore the type column.

1
votes
class Salammobile::CountryRate < ActiveRecord::Base
  establish_connection("salammobile")


  self.table_name = 'smusers'
  inheritance_column = :_type_disabled

end

that is not working basically i am using external database that exist on other server and application is working with different server i put this code now its working

class   Salammobile::CountryRate < ActiveRecord::Base
      establish_connection("salammobile")

      self.table_name = 'smusers'

      self.inheritance_column = nil
    end