From 23ce3e5fde42d0af9b77ad014bde8f36401fa3b6 Mon Sep 17 00:00:00 2001 From: Lauro Caetano Date: Wed, 11 Dec 2013 00:05:16 -0200 Subject: Prevent invalid code when using dynamic finders with Ruby's reserved words. The dynamic finder was creating the method signature with the parameters name, which may have reserved words and this way creating invalid Ruby code. Closes: #13261 Example: # Before Dog.find_by_alias('dog name') # Was creating this method def self.find_by_alias(alias, options = {}) # After Dog.find_by_alias('dog name') # Will create this method def self.find_by_alias(_alias, options = {}) --- activerecord/test/schema/schema.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/test/schema') diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 92e2e4d409..ac546fc296 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -245,6 +245,7 @@ ActiveRecord::Schema.define do t.integer :trainer_id t.integer :breeder_id t.integer :dog_lover_id + t.string :alias end create_table :edges, force: true, id: false do |t| -- cgit v1.2.3