Can I or SHOULD I find an object by the object_id attribute in ruby?

Yes, you can: irb(main):002:0> s1 = “foo” #=> “foo” irb(main):003:0> s2 = ObjectSpace._id2ref(s1.object_id) #=> “foo” irb(main):004:0> s2.object_id == s1.object_id #=> true irb(main):005:0> s2[0] = “z” #=> “z” irb(main):006:0> s1 #=> “zoo” Should you do this? I’ll leave that up to you. There are less geeky ways to store an object with a serializable id (e.g. … Read more

Need two indexes on a HABTM join table?

Close – you most likely want the following: add_index :person_products, [:person_id, :product_id], :unique => true add_index :person_products, :product_id The :unique => true is not strictly required and it depends whether or not it makes sense to have a person associated with a product multiple times. I would say if you’re not sure, you probably do … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)