fl-web
fl-web

Reputation: 460

work around rails table naming conventions

I'd like to make friends rails with system with another database naming conventions. Is there possible to work around rails naming conventions? At least database table naming. It would be desirable to key name be just add '_id' suffix to table name. For example result join condition wanted like this 'parent'.'id' = 'child'.'parent_id'. If solution exists what is the invisible underwater rocks of solution?

Upvotes: 0

Views: 132

Answers (1)

Meier
Meier

Reputation: 3880

Yes, it is possible to work around rails naming conventions.

http://guides.rubyonrails.org/active_record_basics.html#overriding-the-naming-conventions

See also the many options you can specify for associations, like class_name, foreign_key, primary_key

http://guides.rubyonrails.org/association_basics.html

If you are a rails beginner, you should just use the rails conventions. All examples you find use them, and you just introduce an additional source of bugs.

For me overriding the naming conventions is only useful when you have an already existing databases.

Upvotes: 1

Related Questions