Skip to content

Instantly share code, notes, and snippets.

View spastorino's full-sized avatar

Santiago Pastorino spastorino

View GitHub Profile
@spastorino
spastorino / gist:1027174
Created June 15, 2011 14:05
i18n.patch
diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb
index cd9f54e..365841e 100644
--- a/actionpack/test/template/translation_helper_test.rb
+++ b/actionpack/test/template/translation_helper_test.rb
@@ -53,6 +53,12 @@ class TranslationHelperTest < ActiveSupport::TestCase
assert_equal false, I18n.translate(:"translations.missing").html_safe?
end
+ def test_i18n_translate_returns_unsafe_even_if_using_html_rescue_format
+ expected = '<span class="translation_missing" title="translation missing: en.translations.missing">Missing</span>'
diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile
index e7d8ee2..8f2ed1f 100755
--- a/actionmailer/Rakefile
+++ b/actionmailer/Rakefile
@@ -9,7 +9,7 @@ task :default => [ :test ]
# Run the unit tests
Rake::TestTask.new { |t|
t.libs << "test"
- t.pattern = 'test/**/*_test.rb'
+ t.test_files = Dir.glob("test/**/*_test.rb")
diff --git a/Rakefile b/Rakefile
index 24eb59a..388d8e7 100644
--- a/Rakefile
+++ b/Rakefile
@@ -197,6 +197,7 @@ end
vim_plugin_task 'bufexplorer', 'git://github.com/vim-scripts/bufexplorer.zip.git'
vim_plugin_task 'matchit', 'git://github.com/vim-scripts/matchit.zip.git'
+vim_plugin_task 'ruby', 'git://github.com/vim-ruby/vim-ruby.git'
diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb
index 6a593a7..832f2ed 100644
--- a/activerecord/lib/active_record/attribute_methods/write.rb
+++ b/activerecord/lib/active_record/attribute_methods/write.rb
@@ -10,7 +10,9 @@ module ActiveRecord
module ClassMethods
protected
def define_method_attribute=(attr_name)
- generated_attribute_methods.module_eval("def #{attr_name}=(new_value); write_attribute('#{attr_name}', new_value); end", __FILE__, __LINE__)
+ generated_attribute_methods.send(:define_method, "#{attr_name}=") do |new_value|
if (window.propane) {
Object.extend(Campfire.Chat.prototype, {
installPropaneResponder: function() {
if (this["propaneresponder"] == null) {
this["propaneresponder"] = new Campfire["PropaneResponder"](this);
this.listeners.push(this["propaneresponder"]);
}
},
});
cd /Applications/Propane.app/Contents/Resources
cp enhancer.js enhancer.js.orig
curl https://gist.github.com/raw/820001/8ed21af6a44107c43de571e57d6c397128579aa2/propane-gravatars.diff | patch
curl https://gist.github.com/raw/821125/d31fe43f38ad3c2877a1788422bc6327b1ecde8e/propane.diff | patch
--- /Applications/Propane.app/Contents/Resources/enhancer.js 2011-02-10 17:05:02.000000000 -0200
+++ /Applications/Propane.app/Contents/Resources/enhancer.js 2011-02-10 17:00:41.000000000 -0200
@@ -74,7 +74,7 @@
var author = message.authorElement();
if (author.visible()) {
- author.insert({after: '<img alt="'+message.author()+'" width="24" height="24" align="top" style="margin-left: 5px; border-radius:3px" src="http://globase.heroku.com/redirect/gh.gravatars.'+this.authorID(message)+'?default=https://github.com/images/gravatars/gravatar-20.png">'});
+ author.insert({after: '<img alt="'+message.author()+'" width="24" height="24" align="top" style="margin-left: 5px; border-radius:3px" src="'+author.getAttribute('data-avatar')+'">'});
author.hide()
message.bodyCell.insert({top: '<strong>' + message.author() + '</strong>'})
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index a0f9045..efd071f 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -147,9 +147,9 @@ module ActiveModel
# List all validators that being used to validate a specific attribute.
def validators_on(*attributes)
- attributes.inject([]) do |all, attribute|
- all |= _validators[attribute.to_sym] || []
diff --git a/kernel/common/string.rb b/kernel/common/string.rb
index 78c5b35..df6e295 100644
--- a/kernel/common/string.rb
+++ b/kernel/common/string.rb
@@ -1460,9 +1460,13 @@ class String
return if @num_bytes == 0
stop = @num_bytes - 1
+ while stop >= 0 && @data[stop] == 0
+ stop -= 1
(in /Users/santiago/WyeWorks/Projs/rails/actionpack)
/Users/santiago/.rvm/rubies/rbx-head/bin/rbx -w -I"lib:test" "/Users/santiago/.rvm/gems/rbx-head/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/abstract/abstract_controller_test.rb" "test/abstract/callbacks_test.rb" "test/abstract/collector_test.rb" "test/abstract/helper_test.rb" "test/abstract/layouts_test.rb" "test/abstract/render_test.rb" "test/abstract/translation_test.rb" "test/controller/action_pack_assertions_test.rb" "test/controller/addresses_render_test.rb" "test/controller/assert_select_test.rb" "test/controller/base_test.rb" "test/controller/caching_test.rb" "test/controller/capture_test.rb" "test/controller/content_type_test.rb" "test/controller/deprecation/deprecated_base_methods_test.rb" "test/controller/filters_test.rb" "test/controller/flash_test.rb" "test/controller/helper_test.rb" "test/controller/http_basic_authentication_test.rb" "test/controller/http_digest_authentication_test.rb" "test/controller/http_token_authentication_test.rb