$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')
If you need the table names:
$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
#!/bin/bash | |
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/ | |
set -e | |
sourceApp="$1" | |
targetApp="$2" | |
while read key value; do |
require 'resque_mailer' | |
require 'devise/async' | |
# pop and set locale from the args before running | |
module PerformWithLocale | |
def perform(*args) | |
I18n.with_locale(args.pop) do | |
super(*args) | |
end | |
end |
function humanize(num){ | |
var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', | |
'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', | |
'seventeen', 'eighteen', 'nineteen']; | |
var tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', | |
'ninety']; | |
var numString = num.toString(); | |
if (num < 0) throw new Error('Negative numbers are not supported.'); |
$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')
If you need the table names:
$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
# coffeescript rules | |
# Pagination is sticked with model | |
# | |
# Server should response in that way: | |
# { | |
# articles: [{category_id:null, id:308,…}, {category_id:null, id:307,…}, {category_id:null, id:306,…},…] | |
# pagination: {total:34, page:2, per_page:15, cat_id:-1, source_id:-1} | |
# } | |
# To achieve this controller should look like (using will_paginate gem): | |
# per_page = params[:per_page].to_i || 15 |
require 'rubygems' | |
def start_simplecov | |
require 'simplecov' | |
SimpleCov.start 'rails' unless ENV["SKIP_COV"] | |
end | |
def spork? | |
defined?(Spork) && Spork.using_spork? | |
end |
task :deploy => ['deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
task :migrations => [:push, :off, :migrate, :restart, :on, :tag] | |
task :rollback => [:off, :push_previous, :restart, :on] | |
task :push do | |
puts 'Deploying site to Heroku ...' | |
puts `git push heroku` | |
end |