Plz do favour in active record

hello

I want to do like the below code
name=[‘net’,‘gross’,‘amount’]
avail= Avail.find(1)
return avail.name[0]
but it gets error
I want to give " avail.name[0] " like this, rather than avail.net
directly,
can u guys plz help me, how to do this plz explain with code

advance thx
have a pleasant day

narayana

Narayana,

I think Acts As Enumerated
http://agilewebdevelopment.com/plugins/acts_as_enumerated does what
you’re
trying to do.

Hammed

Hammed M. wrote:

Narayana,

I think Acts As Enumerated
http://agilewebdevelopment.com/plugins/acts_as_enumerated does what
you’re
trying to do.

Hammed

hai hameed
first of all thx to u for spending time for me

with out using the enumeration
name=[‘net’ ,‘amount’]
we can use this avail.net code as avail[name[0]]

ok bye

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