hi guys
i have a product model with many columns like
cat1,cat2,cat3,name,desc,price,qty etc.
along with that i have a virtual attribute call full_name in model
attr_accessor :full_name
def full_name
cat1+cat2+cat3+name #something like this
end
when i do Product.find(:all)
in the product array the product’s hash object does not have a attrubute
with the name full_name.
although i know if i write prod.full_name it will work
i want that attribute to be in the hash as a key-value pair
as i want to convert the whole array to json.
what is the simplest way of doing this.
i had tried this but did not work
def after_find
full_name
end
thanks
jags