Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rails console tips

rails console


> { |t| "#{t} => " + ActiveRecord::Base.connection.execute("select count(*) from #{t}").fetch_row.first}

This actually uses method ActiveRecord::ConnectionHandling.connection

> ActiveRecord::Migration.add_column 

You need to konw the Model name, and access (both read and write) here.

> JxRailsMd::Aa::Account.all



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment