I am unable to access a database table in rails. I am using ruby 1.8.6 (2010-09-02 patchlevel 420) and Rails 2.2.2
"ActiveRecord::Base.connection.table_exists? Modelname.table_name" returns true
"ActiveRecord::Base.connection.table_exists? Modelname" returns false
When i say Modelname.create i am getting the “ORA-02289: sequence does not exist” error message.My model class looks like the below one.
class Modelname < ActiveRecord::Base
end
I have created the table using sql statement instead of migration. Can anyone please let me know why i am facing this problem.
The expectation of Rails is that your model table name is pluralized (because it stores more that one entity), your model name is singularized. You may override that like explained in the API of ActiveRecord by using the following:
It was not clear from your question what your table name is.