27 Apr '16, 3pm

Foreign key constraints and cascading deletes in Rails

Referential integrity is a relational database concept that states implied relationships among data should be enforced. Referential integrity ensures that the relationship between rows in two tables will remain synchronized during all updates and deletes. Rails allows us to easily set up these implied relationships, but does nothing to help us enforce referential integrity. It’s very simple to accidentally or intentionally break referential integrity in most Rails applications. An Example Scenario Consider the following minimal set of models describing a blogging engine: class User < ActiveRecord::Base has_many :posts validates :name, presence: true end class Post < ActiveRecord::Base belongs_to :user validates :user, presence: true end Our blogging platform has taken off, but we’ve received requests from some users to delete their accounts. We add an interface for adminis...

Full article: https://robots.thoughtbot.com/referential-integrity-with-...

Tweets

Singapore foreign minister stresses rule of law in South China Sea

Singapore foreign minister stresses rule of law...

japantimes.co.jp 26 Apr '16, 2pm

Singaporean Foreign Minister Vivian Balakrishnan called for enhanced cooperation between Southeast Asian states and Japan ...

Trump's GOP Senate critics fact check him on fo...

militarytimes.com 23 Apr '16, 3pm

A Donald Trump supporter holds up a campaign sign before a rally with the Republican presidential candidate at the Pennsyl...

Victoria (Australia) plans to raise property ta...

propertyguru.com.sg 26 Apr '16, 7am

The state of Victoria plans to introduce new measures to cool overseas demand. The state government of Victoria in Austral...

No list of fugitives given to Singapore by Indo...

straitstimes.com 28 Apr '16, 2pm

JAKARTA - Indonesia has not given Singapore a list of its fugitives as previously reported, said the foreign ministries of...

This cartoon from @beatricebiology illustrates ...

beatricebiologist.com 05 May '16, 4pm

Join the Beatrice the Biologist fan club! Receive early updates on comics, e-rewards like videos and printables, and Beatr...