aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
-rwxr-xr-xactiverecord/test/base_test.rb3
-rw-r--r--activerecord/test/fixtures/computers.yml3
-rw-r--r--activerecord/test/fixtures/db_definitions/db2.sql3
-rwxr-xr-xactiverecord/test/fixtures/db_definitions/mysql.sql3
-rw-r--r--activerecord/test/fixtures/db_definitions/oci.sql3
-rw-r--r--activerecord/test/fixtures/db_definitions/postgresql.sql3
-rw-r--r--activerecord/test/fixtures/db_definitions/sqlite.sql3
-rw-r--r--activerecord/test/fixtures/db_definitions/sqlserver.sql3
10 files changed, 19 insertions, 9 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index a8a1bf0ad6..26e2981dd3 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added compatibility with camelCase column names for dynamic finders #533 [Dee.Zsombor]
+
* Fixed extraneous comma in count() function that made it not work with joins #1156 [jarkko/Dee.Zsombor]
* Fixed incompatibility with Base#find with an array of ids that would fail when using eager loading #1186 [Alisdair McDiarmid]
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index c11b6d23ed..283eb1070a 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -782,7 +782,7 @@ module ActiveRecord #:nodoc:
def method_missing(method_id, *arguments)
method_name = method_id.id2name
- if method_name =~ /find_(all_by|by)_([_a-z][_a-z\d]*)/
+ if method_name =~ /find_(all_by|by)_([_a-zA-Z]\w*)/
finder, attributes = ($1 == "all_by" ? :all : :first), $2.split("_and_")
attributes.each { |attr_name| super unless column_methods_hash[attr_name.intern] }
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index f0f2682bb1..595450eab9 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -12,6 +12,7 @@ class Smarts < ActiveRecord::Base; end
class CreditCard < ActiveRecord::Base; end
class MasterCreditCard < ActiveRecord::Base; end
class Post < ActiveRecord::Base; end
+class Computer < ActiveRecord::Base; end
class LoosePerson < ActiveRecord::Base
attr_protected :credit_rating, :administrator
@@ -32,7 +33,7 @@ end
class Booleantest < ActiveRecord::Base; end
class BasicsTest < Test::Unit::TestCase
- fixtures :topics, :companies, :projects
+ fixtures :topics, :companies, :projects, :computers
def test_set_attributes
topic = Topic.find(1)
diff --git a/activerecord/test/fixtures/computers.yml b/activerecord/test/fixtures/computers.yml
index 59253e0ce3..daf969d7da 100644
--- a/activerecord/test/fixtures/computers.yml
+++ b/activerecord/test/fixtures/computers.yml
@@ -1,3 +1,4 @@
workstation:
id: 1
- developer: 1 \ No newline at end of file
+ developer: 1
+ extendedWarranty: 1
diff --git a/activerecord/test/fixtures/db_definitions/db2.sql b/activerecord/test/fixtures/db_definitions/db2.sql
index 1097568ce3..6d13c73fbe 100644
--- a/activerecord/test/fixtures/db_definitions/db2.sql
+++ b/activerecord/test/fixtures/db_definitions/db2.sql
@@ -126,7 +126,8 @@ CREATE TABLE binaries (
CREATE TABLE computers (
id int generated by default as identity (start with +10000),
- developer int NOT NULL
+ developer int NOT NULL,
+ extendedWarranty int NOT NULL
);
CREATE TABLE posts (
diff --git a/activerecord/test/fixtures/db_definitions/mysql.sql b/activerecord/test/fixtures/db_definitions/mysql.sql
index da4a69252f..d105090355 100755
--- a/activerecord/test/fixtures/db_definitions/mysql.sql
+++ b/activerecord/test/fixtures/db_definitions/mysql.sql
@@ -126,7 +126,8 @@ CREATE TABLE `binaries` (
CREATE TABLE `computers` (
`id` INTEGER NOT NULL PRIMARY KEY,
- `developer` INTEGER NOT NULL
+ `developer` INTEGER NOT NULL,
+ `extendedWarranty` INTEGER NOT NULL
) TYPE=InnoDB;
CREATE TABLE `posts` (
diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql
index 9fa432ccfb..5650c93475 100644
--- a/activerecord/test/fixtures/db_definitions/oci.sql
+++ b/activerecord/test/fixtures/db_definitions/oci.sql
@@ -164,7 +164,8 @@ create table binaries (
create table computers (
id integer not null primary key,
- developer integer not null references developers initially deferred disable
+ developer integer not null references developers initially deferred disable,
+ extendedWarranty integer not null
);
create table posts (
diff --git a/activerecord/test/fixtures/db_definitions/postgresql.sql b/activerecord/test/fixtures/db_definitions/postgresql.sql
index 9b57866368..6aa095c1a8 100644
--- a/activerecord/test/fixtures/db_definitions/postgresql.sql
+++ b/activerecord/test/fixtures/db_definitions/postgresql.sql
@@ -144,7 +144,8 @@ CREATE TABLE binaries (
CREATE TABLE computers (
id serial,
- developer integer NOT NULL
+ developer integer NOT NULL,
+ extendedWarranty integer NOT NULL
);
CREATE TABLE posts (
diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql
index 4507e2c4b2..07d2ea33fd 100644
--- a/activerecord/test/fixtures/db_definitions/sqlite.sql
+++ b/activerecord/test/fixtures/db_definitions/sqlite.sql
@@ -113,7 +113,8 @@ CREATE TABLE 'binaries' (
CREATE TABLE 'computers' (
'id' INTEGER NOT NULL PRIMARY KEY,
- 'developer' INTEGER NOT NULL
+ 'developer' INTEGER NOT NULL,
+ 'extendedWarranty' INTEGER NOT NULL
);
CREATE TABLE 'posts' (
diff --git a/activerecord/test/fixtures/db_definitions/sqlserver.sql b/activerecord/test/fixtures/db_definitions/sqlserver.sql
index 776ac23610..c96114de89 100644
--- a/activerecord/test/fixtures/db_definitions/sqlserver.sql
+++ b/activerecord/test/fixtures/db_definitions/sqlserver.sql
@@ -113,7 +113,8 @@ CREATE TABLE binaries (
CREATE TABLE computers (
id int NOT NULL IDENTITY(1, 1) PRIMARY KEY,
- developer int NOT NULL
+ developer int NOT NULL,
+ extendedWarranty int NOT NULL
);
CREATE TABLE posts (