Using lambda with named scopes in Rails 3
You can define an ActiveRelation named scope inside your model Address, for example, like so:
You can define an ActiveRelation named scope inside your model Address, for example, like so:
Once you destroy a record, the object becomes frozen. Call the frozen? method on the referenced object before and after calling destroy to see the difference. If you try to manipulate the object after the object is ‘frozen’, you’ll get a TypeError: can’t modify frozen hash
I figured out something cool which solves a common database design problem. However, I’m not sure if this is supported in ActiveRecord since the SET data type does not exist in all databases. Let’s say each record in a table has zero or more properties and your set of properties is pre-defined. How would you […]