legacy 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/legacy.gemspec +8 -2
- data/lib/legacy.rb +13 -1
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/db/migrate/20110310102359_create_posts.rb +14 -0
- data/test/dummy/db/schema.rb +22 -0
- data/test/legacy_test.rb +10 -0
- metadata +10 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/legacy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{legacy}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roy van der Meij"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-10}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{roy@royapps.nl}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"test/dummy/Rakefile",
|
28
28
|
"test/dummy/app/controllers/application_controller.rb",
|
29
29
|
"test/dummy/app/helpers/application_helper.rb",
|
30
|
+
"test/dummy/app/models/post.rb",
|
30
31
|
"test/dummy/app/views/layouts/application.html.erb",
|
31
32
|
"test/dummy/config.ru",
|
32
33
|
"test/dummy/config/application.rb",
|
@@ -43,6 +44,8 @@ Gem::Specification.new do |s|
|
|
43
44
|
"test/dummy/config/initializers/session_store.rb",
|
44
45
|
"test/dummy/config/locales/en.yml",
|
45
46
|
"test/dummy/config/routes.rb",
|
47
|
+
"test/dummy/db/migrate/20110310102359_create_posts.rb",
|
48
|
+
"test/dummy/db/schema.rb",
|
46
49
|
"test/dummy/public/404.html",
|
47
50
|
"test/dummy/public/422.html",
|
48
51
|
"test/dummy/public/500.html",
|
@@ -67,6 +70,7 @@ Gem::Specification.new do |s|
|
|
67
70
|
s.test_files = [
|
68
71
|
"test/dummy/app/controllers/application_controller.rb",
|
69
72
|
"test/dummy/app/helpers/application_helper.rb",
|
73
|
+
"test/dummy/app/models/post.rb",
|
70
74
|
"test/dummy/config/application.rb",
|
71
75
|
"test/dummy/config/boot.rb",
|
72
76
|
"test/dummy/config/environment.rb",
|
@@ -79,6 +83,8 @@ Gem::Specification.new do |s|
|
|
79
83
|
"test/dummy/config/initializers/secret_token.rb",
|
80
84
|
"test/dummy/config/initializers/session_store.rb",
|
81
85
|
"test/dummy/config/routes.rb",
|
86
|
+
"test/dummy/db/migrate/20110310102359_create_posts.rb",
|
87
|
+
"test/dummy/db/schema.rb",
|
82
88
|
"test/integration/navigation_test.rb",
|
83
89
|
"test/legacy_test.rb",
|
84
90
|
"test/support/integration_case.rb",
|
data/lib/legacy.rb
CHANGED
@@ -1,2 +1,14 @@
|
|
1
1
|
module Legacy
|
2
|
-
|
2
|
+
def method_missing(method_id, *args, &block)
|
3
|
+
super(select_real_method_id(method_id), *args, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def select_real_method_id(method_id)
|
7
|
+
real_method_id = attributes.keys.detect{ |c| c.to_s.downcase == method_id.to_s.downcase.gsub(/=/, '') }
|
8
|
+
return method_id unless real_method_id
|
9
|
+
|
10
|
+
method_id = method_id.to_s
|
11
|
+
method_id[0..(real_method_id.length - 1)] = real_method_id
|
12
|
+
method_id
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20110310102359) do
|
14
|
+
|
15
|
+
create_table "posts", :force => true do |t|
|
16
|
+
t.string "TITLE"
|
17
|
+
t.text "DESCRIPTION"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/test/legacy_test.rb
CHANGED
@@ -4,4 +4,14 @@ class LegacyTest < ActiveSupport::TestCase
|
|
4
4
|
test "truth" do
|
5
5
|
assert_kind_of Module, Legacy
|
6
6
|
end
|
7
|
+
|
8
|
+
test "post can access upcased columns with downcased methods" do
|
9
|
+
post = Post.new
|
10
|
+
post.title = "Testing title"
|
11
|
+
post.description = "Testing description"
|
12
|
+
post.save
|
13
|
+
|
14
|
+
assert_equal "Testing title", post.title
|
15
|
+
assert_equal "Testing description", post.description
|
16
|
+
end
|
7
17
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roy van der Meij
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- test/dummy/Rakefile
|
113
113
|
- test/dummy/app/controllers/application_controller.rb
|
114
114
|
- test/dummy/app/helpers/application_helper.rb
|
115
|
+
- test/dummy/app/models/post.rb
|
115
116
|
- test/dummy/app/views/layouts/application.html.erb
|
116
117
|
- test/dummy/config.ru
|
117
118
|
- test/dummy/config/application.rb
|
@@ -128,6 +129,8 @@ files:
|
|
128
129
|
- test/dummy/config/initializers/session_store.rb
|
129
130
|
- test/dummy/config/locales/en.yml
|
130
131
|
- test/dummy/config/routes.rb
|
132
|
+
- test/dummy/db/migrate/20110310102359_create_posts.rb
|
133
|
+
- test/dummy/db/schema.rb
|
131
134
|
- test/dummy/public/404.html
|
132
135
|
- test/dummy/public/422.html
|
133
136
|
- test/dummy/public/500.html
|
@@ -181,6 +184,7 @@ summary: Bring some magic to ActiveRecord for legacy databases
|
|
181
184
|
test_files:
|
182
185
|
- test/dummy/app/controllers/application_controller.rb
|
183
186
|
- test/dummy/app/helpers/application_helper.rb
|
187
|
+
- test/dummy/app/models/post.rb
|
184
188
|
- test/dummy/config/application.rb
|
185
189
|
- test/dummy/config/boot.rb
|
186
190
|
- test/dummy/config/environment.rb
|
@@ -193,6 +197,8 @@ test_files:
|
|
193
197
|
- test/dummy/config/initializers/secret_token.rb
|
194
198
|
- test/dummy/config/initializers/session_store.rb
|
195
199
|
- test/dummy/config/routes.rb
|
200
|
+
- test/dummy/db/migrate/20110310102359_create_posts.rb
|
201
|
+
- test/dummy/db/schema.rb
|
196
202
|
- test/integration/navigation_test.rb
|
197
203
|
- test/legacy_test.rb
|
198
204
|
- test/support/integration_case.rb
|