I’m using Rails with DB2 Database. The tables in the database are NOT
rails conventions, and there is no ‘id’ column too in the tables.
Can you use the SQL VIEW statement to rename things to Rails’s liking?
VIEW is very powerful, and could fix the “problem” at its source.
In a multi-layered system like a website stack, I always seek to solve
the problem in the most convenient (and efficient) layer…
–
Phlip
You could use the DrySQL Ruby plugin: http://drysql.rubyforge.org
It will automatically identify all your keys, and generate all the
associations and validations for your ActiveRecord data class, even if
you do not follow the ActiveRecord naming conventions.
All you need to do is name your table according to ActiveRecord naming
conventions OR call set_table_name in your class definition, and DrySQL
handles the rest.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.