$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')
If you need the table names:
$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
| #!/usr/bin/ruby | |
| require 'rss' | |
| # Usage | |
| # $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
| # episodes.rss | |
| # OR | |
| # $ ./railscasts.rb | |
| p 'Downloading rss index' |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| RuralTown.create!([ | |
| {:rural_district_id=>1, :id=>"Abuma", :name=>"Abuma"}, | |
| {:rural_district_id=>1, :id=>"Amaebem", :name=>"Amaebem"}, | |
| {:rural_district_id=>1, :id=>"Amaeke", :name=>"Amaeke"}, | |
| {:rural_district_id=>1, :id=>"Amakpofia", :name=>"Amakpofia"}, | |
| {:rural_district_id=>1, :id=>"Amankwu", :name=>"Amankwu"}, | |
| {:rural_district_id=>1, :id=>"Amasa", :name=>"Amasa"}, | |
| {:rural_district_id=>1, :id=>"Amatiti", :name=>"Amatiti"}, | |
| {:rural_district_id=>1, :id=>"Amodu", :name=>"Amodu"}, |
| git ls-files | grep '\.swp$' | xargs git rm |
| Area | |
| Postcode | |
| State | |
| Street | |
| Town | |
| Zone | |
| namespace :urban do | |
| [ | |
| # returns all the state in Nigeria |
| Demo |
| ActiveRecord::Schema.define(version: xxxxx) do | |
| create_table "areas", force: :cascade do |t| | |
| t.integer "town_id" | |
| t.string "name" | |
| end | |
| add_index "areas", ["town_id"], name: "index_areas_on_town_id" | |
| create_table "post_codes", force: :cascade do |t| |
$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')
If you need the table names:
$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
| #!/bin/env ruby | |
| # lazy hack from Robert Klemme | |
| module Memory | |
| # sizes are guessed, I was too lazy to look | |
| # them up and then they are also platform | |
| # dependent | |
| REF_SIZE = 4 # ? | |
| OBJ_OVERHEAD = 4 # ? |
Gregg Pollack's Founder's Talk 1
25 Lessons: