Skip to content

Instantly share code, notes, and snippets.

class Lifo < ActionView::Template::Handler
include ActionView::Template::Handlers::Compilable
def compile(template)
template.source.inspect
end
end
ActionView::Template.register_template_handler :lifo, Lifo
@lifo
lifo / config.ru
Created August 10, 2011 01:55 — forked from tobym/redis_pubsub_demo.rb
Redis PubSub demo with EventMachine (chat service)
require './redis_pubsub_demo'
routes = HttpRouter.new do
get('/').to(HomeAction)
get('/websocket').to(ChatAction)
end
# thin --timeout 0 -V start
run routes
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb
index e7e5f26..61cac59 100644
--- a/activerecord/lib/active_record/relation/spawn_methods.rb
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb
@@ -6,7 +6,7 @@ module ActiveRecord
merged_relation = clone
return merged_relation unless r
- ((Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS) - [:joins, :where]).each do |method|
+ ((Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS) - [:joins, :where, :order]).each do |method|
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index fb42ccb..c110810 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -209,6 +209,12 @@ class BaseTest < ActiveSupport::TestCase
assert_equal "New Subject!", email.subject
end
+ test "translations are scoped properly" do
+ I18n.backend.store_translations('en', :base_mailer => {:email_with_translations => {:greet_user => "Hello %{name}!"}})
require 'cramp/controller'
require 'cramp/model'
require 'twitter'
module Twisocket
class Socket < Cramp::Controller::Websocket
before_start :set_twitter
# Probably cramp should fire all the timer methods before scheduling them via EM periodic timers
on_start :check_tweets
gem 'cramp'
gem 'erubis', '2.6.5'
gem 'usher', "0.6.0"
# Requires Cramp 0.8+
require 'rubygems'
require 'usher'
require 'cramp/controller'
Cramp::Controller::Websocket.backend = :thin
class WebsockAction < Cramp::Controller::Websocket
periodic_timer :send_hello_world, :every => 2
on_data :received_data
[lifo@null rails (master)]$ gem bundle -u
Calculating dependencies...
Cloning git repository at: git://github.com/rails/arel.git
Updating source: http://gems.rubyforge.org
Downloading abstract-1.0.0.gem
Downloading columnize-0.3.1.gem
Downloading erubis-2.6.5.gem
Downloading i18n-0.3.3.gem
Downloading linecache-0.43.gem
Downloading mail-1.5.1.gem
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index af6f1bc..016d7b3 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -1,6 +1,8 @@
begin
require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError
+ $stderr.puts "Running Rails tests requires Bundler. Please 'gem install bundler' and run 'gem bundle' from the Rails checkout path."
+ exit!
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
index 6de1725..0240289 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
@@ -6,11 +6,18 @@ if File.exist?("#{environment}.rb")
# Use 2.x style vendor/rails and RubyGems
else
vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
- if File.exist?(vendor_rails)
- Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }