Newbie : question about Rails naming conventions

Hi, I’m really new to Ruby on Rails and I’m going to use it for my
personal webpage.

I would also like to use for one of my profesional projects, the problem
is that our Database admin has its own conventions that does not respect
Rails’ ones.

He uses its own conventions for naming tables AND fields names.

Is it possible to set up the table name and fields names for a model?
The field names that my DBA uses are really not human readable (for
example : ARPONA5164 for the field name “title”) and I don’t want to use
them in my code. I would like to setup them once and after use them like
Post.title and not Post.ARPONA5164.

Hi again.

I’ve just read ActiveRecord::Base “Overwriting default accessors” part
on Rails API. Is it a good solution to write this kind of code for each
field name :

def title=(val)
  write_attribute(:ARPONA5164, val)
end

def title
  read_attribute(:ARPONA5164)
end

?

Thanks.

Nicolas B. wrote:

Hi, I’m really new to Ruby on Rails and I’m going to use it for my
personal webpage.

I would also like to use for one of my profesional projects, the problem
is that our Database admin has its own conventions that does not respect
Rails’ ones.

He uses its own conventions for naming tables AND fields names.

Is it possible to set up the table name and fields names for a model?
The field names that my DBA uses are really not human readable (for
example : ARPONA5164 for the field name “title”) and I don’t want to use
them in my code. I would like to setup them once and after use them like
Post.title and not Post.ARPONA5164.

On 8/10/06, Nicolas B. [email protected] wrote:

Is it possible to set up the table name and fields names for a model?
The field names that my DBA uses are really not human readable (for
example : ARPONA5164 for the field name “title”) and I don’t want to use
them in my code. I would like to setup them once and after use them like
Post.title and not Post.ARPONA5164.

Yes, you can alias more readable names. You’ll just need to do some
config
in your model with Active Record.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs