Skip to content

Instantly share code, notes, and snippets.

@between40and2
Last active August 29, 2015 14:02

Revisions

  1. between40and2 renamed this gist Jun 16, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. between40and2 revised this gist Jun 16, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions rails-c.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # `rails console`


    ## Model
    @@ -16,11 +17,14 @@ This actually uses method [ActiveRecord::ConnectionHandling.connection](http://a


    > ActiveRecord::Migration.add_column

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

    > JxRailsMd::Aa::Account.all

    Refs
    ##Refs

    see-all-tables-all-records-from-console
    [see-all-tables-all-records-from-console](http://stackoverflow.com/questions/4572249/see-all-tables-all-records-from-console)



  3. between40and2 created this gist Jun 16, 2014.
    26 changes: 26 additions & 0 deletions rails-c.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@


    ## Model





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


    This actually uses method [ActiveRecord::ConnectionHandling.connection](http://api.rubyonrails.org/classes/ActiveRecord/ConnectionHandling.html#method-i-connection)





    > ActiveRecord::Migration.add_column
    > JxRailsMd::Aa::Account.all

    Refs

    see-all-tables-all-records-from-console