Skip to content

Instantly share code, notes, and snippets.

@RSpace
RSpace / Gemfile
Created April 23, 2011 12:49
Running Capybara and RSpec without Rails
source 'http://rubygems.org'
gem 'rspec'
gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'ruby-debug19'
function Location(id, data) {
// Public variables
this.id = id;
this.latitude = data["location"]["latitude"];
this.longitude = data["location"]["longitude"];
this.postal_district_id = data["location"]["postal_district_id"];
this.area_from = data["location"]["area_from"];
this.area_to =
class CustomFailure < Devise::FailureApp
# Never do http authentication through Devise
def http_auth?
false
end
def redirect_url
send(:"new_#{scope}_session_path", :format => (request.xhr? ? 'js' : nil ))
end
class User < ActiveRecord::Base
devise :database_authenticatable, :openid_authenticatable, :recoverable, :rememberable, :trackable, :validatable
# Handle creation of user authenticated via OpenID
def self.create_from_identity_url(identity_url)
User.new(:identity_url => identity_url)
end
# Set email as a required field from the Open ID provider
...
gem 'devise'
gem 'warden_oauth'
source :gemcutter
gem 'rails', '2.3.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'rails', '2.3.8'
gem 'postgres'
gem 'aws-s3', '0.6.2'
Mime::Type.register "application/vnd.ms-excel", :xls
ActionController::Renderers.add :xls do |object, options|
instance = object.respond_to?(:first) ? object.first : object
options = instance.respond_to?(:xls_options) ? instance.xls_options : {}
self.send_data object.to_xls_data(options), :type => :xls
end
<%= form_for(@production) do |form| %>
<%= form.label :title, 'Title' %>
<%= form.text_field :title %>
<%= form.fields_for :employee_roles do |role_form| %>
<%= form.label :employee_id %></dt>
<%= form.select :employee_id, ... %>
<%= form.label :role_id %></dt>
<%= form.select :role_id, ... %>
<% end %>
Rails.configuration.to_prepare do
# Makes the the send_later_with_i18n method available to all objects
Object.send(:include, LocalizedJob::InstanceMethods)
end
module LocalizedJob
module InstanceMethods
def send_later_with_i18n(method, locale, *args)
locale ||= I18n.locale
job = LocalizedJob::LocalizedMethod.new(self, method.to_sym, args)
job.locale = locale
Delayed::Job.enqueue job
end
end