Tag Archives: rails4

[rails 4] add a reference to a table with another name

They default way in rails 4 to add foreign keys is simply add_reference :people, :user And this will add a column user_id to the people table, if the table exists. I have been looking in the rails code where this is handled, and it is really straightforward. Note that standard rails does not really do […]

How to clean assets in rails 4

Gentle reminder, do not forget, in rails 4 rake assets:clean seems to work, but actually does nothing. That is not entirely true: it only cleans the old assets, leaving the three most recent versions of the assets intact. So it is a like a mild cleaning, a throw-away-the-garbage-clean, a bring-those-old-clothes-you-never-wear-to-the-thriftstore-clean. But sometimes that does not […]