NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
#=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_on('Button Value') |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
# See your sequence name inside psql console with \ds command. | |
ALTER SEQUENCE seq RESTART WITH 1; | |
# Update sequence | |
UPDATE table_name SET id=nextval('seq'); |
When using Rails 3.0 and later we already get jquery-rails for free. Look in the gemfile and you'll see:
gem "jquery-rails"
You can view the full documentation here: source: https://github.com/indirect/jquery-rails
If you take a look in APP_DIR/app/assets/javascripts/application.js, you'll notice the following lines of code:
define( ['jquery'], function ( $ ) { | |
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' ); | |
$.ajaxSetup( { | |
beforeSend: function ( xhr ) { | |
xhr.setRequestHeader( 'X-CSRF-Token', token ); | |
} | |
}); | |
return token; |
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
http://guides.rubyonrails.org/migrations.html
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
import re | |
import sys | |
import csv | |
import json | |
import urllib2 | |
from datetime import datetime | |
from collections import defaultdict as dd |
-- model | |
some sort of constant hash: | |
HASH_NAME = { | |
0 => "Choose:", | |
1 => "On-Campus Recruiting - CSO",· | |
2 => "CSO Staff Referral", | |
3 => "Faculty Contact",· | |
4 => "Career Day",· | |
5 => "CSO Summer Job Listing",· | |
6 => "Alumni Contact",· |