gem install rails --pre
rails new my_app -T
# Simple bijective function | |
# Basically encodes any integer into a base(n) string, | |
# where n is ALPHABET.length. | |
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047 | |
ALPHABET = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//) | |
# make your own alphabet using: | |
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join |
# taken from http://railsbros.de/2010/11/29/a-custom-irbrc-for-rails-3.html | |
# config/application.rb that is | |
module MyApp | |
class Application < Rails::Application | |
# config stuff comes here | |
def load_console(sandbox=false) | |
super | |
if File.exists?(project_specific_irbrc = File.join(Rails.root, ".irbrc")) | |
puts "Loading project specific .irbrc ..." |
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
You are trying to install in deployment mode after changing | |
your Gemfile. Run `bundle install` elsewhere and add the | |
updated Gemfile.lock to version control. | |
You have deleted from the Gemfile: | |
* guard-pow | |
* rb-fsevent |
The new rake task assets:clean removes precompiled assets. [fxn]
Application and plugin generation run bundle install unless --skip-gemfile
or --skip-bundle
. [fxn]
Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]
Template generation for jdbcpostgresql #jruby [Vishnu Atrai]
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
module ApplicationHelper | |
def private_cache (name = {}, &block) | |
if @user.blank? | |
yield and return #note.. I had to add this return..otherwise it rendered twice | |
else | |
cache(name, &block) | |
end | |
end | |
end |
require 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
...cucumber and capybara requires... | |
require 'database_cleaner' |
module NullifyBlankAttributes | |
def write_attribute(attr_name, value) | |
new_value = value.presence | |
super(attr_name, new_value) | |
end | |
end |