Migrations are versioned in Rails 5 | BigBinary Blog
Rails 5 migration classes look like this now:
class CreateUsers < ActiveRecord::Migration[5.0]
Mind the [5.0]
at the end.
They do this to evolve the ActiveRecord::Migration API without breaking your historical migrations in db/migrate
.
Related cards:
MySQL: How to create columns like "bigint" or "longtext" in Rails migrations, and what :limit means for column migrations
Rails understands a :limit
options when you create columns in a migration. Its meaning depends on the column type, and sometimes the supplied value.
[The documentation](http://apidock.com/rails/ActiveRecord/ConnectionAdapters/TableDefinition/co...
Building and Scaling a Startup on Rails: 12 Things We Learned the Hard Way - Axon Flux - A Ruby on Rails Blog
There are a bunch of basic functional elements to building out a popular Rails app that I've never really seen explained in one place, but we had to learn the hard way while building Posterous.
How to write complex migrations in Rails
Rails gives you migrations to change your database schema with simple commands like add_column
or update
.
Unfortunately these commands are simply not expressive enough to handle complex cases.
...
Make Sure Your Rails Application is Actually Caching (and not just pretending) - Alfa Jango Blog ยป Blog Archive
It occurred to me that many Rails/Passenger/Apache applications may have caching set up in a way that it appears to be caching, when it is not actually caching.
Relevance Blog : Insurance on Rails
hat's the dirty little secret of our industry; green screen apps are usually pretty darn fast. They aren't simple, though. They are designed for trained users, users who have long since added their app usage patterns to their muscle memory.
MailStyle: A HTML Email Plugin for Ruby on Rails | Purify Blog
MailStyle allows you to write the css for your html emails as you normally would, then writes the styles inline when you send your emails. It also makes sure that your image paths are absolute rather than relative.
Rails < 5: How to get after_commit callbacks fired in tests
If you use transactional_fixtures
or the database_cleaner gem with strategy :transaction
, after_commit
callbacks will not be fired in your tests.
Rails 5+
Rails 5 has a [fix](https://...
PSA: "index: true" in Rails migrations does not work as you'd expect
Several Rails migration methods accept index: true
as an option to create an index. In some cases (like #add_column
), this option is silently discarded. Know what you are doing, or use #add_index
instead.
Example
Consider the following ...
How to combine "change", "up", and "down" in a Rails migration
Rails migrations allow you to use a change
method whose calls are automatically inverted for the down path. However, if you need to some path-specific logic (like SQL UPDATE
statements) you can not define up
and down
methods at the same ti...
How to disable Rails raising errors on pending migrations in development
Rails 4 introduced raising an error on pending migrations. This is most annoying when you are crafting a migration but need to play with your application to figu...