I ran across this article Tagging in Rails 4 using PostgreSQL arrays demonstrating the power of array data types in Postgres. It seems like it could be useful in many ways, but I never see anyone use it in Rails. Why is this? Is it solely because it's harder to query than, say, a simple join table?
it just presented in Rails 4 and not a lot of people heared about it, and most of who heared about it not want to break his comfortable zone and use it as there is many way to simulate it:
def array_column= arr
write_attribute(:array_column, arr.join(','))
end
def array_column
read_attribute(:array_column).split(',')
end
and here is some articles talk about its usage and no one say it has a drawbacks: http://blog.arkency.com/2014/10/how-to-start-using-arrays-in-rails-with-postgresql/ http://blog.plataformatec.com.br/2014/07/rails-4-and-postgresql-arrays/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.