mini_record-compat 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +0 -2
- data/lib/mini_record/auto_schema.rb +0 -10
- data/lib/mini_record/version.rb +1 -1
- data/spec/models.rb +7 -7
- metadata +5 -5
data/README.md
CHANGED
@@ -44,8 +44,6 @@ end
|
|
44
44
|
Post.auto_upgrade!
|
45
45
|
```
|
46
46
|
|
47
|
-
If you don't like `col` there are also few aliases: `key, field, property, attribute`
|
48
|
-
|
49
47
|
Instead of `:as => :my_type` you can use `:type => :my_type`
|
50
48
|
|
51
49
|
Option `:as` or `:type` if not provided is `:string` by default, you can use all ActiveRecord types:
|
@@ -39,32 +39,22 @@ module MiniRecord
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
alias :key :col
|
43
|
-
alias :property :col
|
44
|
-
alias :field :col
|
45
|
-
alias :attribute :col
|
46
42
|
|
47
43
|
def reset_table_definition!
|
48
44
|
@_table_definition = nil
|
49
45
|
end
|
50
|
-
alias :reset_schema! :reset_table_definition!
|
51
46
|
|
52
47
|
def schema
|
53
48
|
reset_table_definition!
|
54
49
|
yield table_definition
|
55
50
|
table_definition
|
56
51
|
end
|
57
|
-
alias :keys :schema
|
58
|
-
alias :properties :schema
|
59
|
-
alias :fields :schema
|
60
|
-
alias :attributes :schema
|
61
52
|
|
62
53
|
def add_index(column_name, options={})
|
63
54
|
index_name = shorten_index_name connection.index_name(table_name, :column => column_name)
|
64
55
|
indexes[index_name] = options.merge(:column => column_name, :name => index_name)
|
65
56
|
index_name
|
66
57
|
end
|
67
|
-
alias :index :add_index
|
68
58
|
|
69
59
|
def connection?
|
70
60
|
!!connection
|
data/lib/mini_record/version.rb
CHANGED
data/spec/models.rb
CHANGED
@@ -10,30 +10,30 @@ end
|
|
10
10
|
class Post < ActiveRecord::Base
|
11
11
|
include SpecHelper
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
col :title
|
14
|
+
col :body
|
15
|
+
col :category, :as => :references
|
16
16
|
belongs_to :category
|
17
17
|
end
|
18
18
|
|
19
19
|
class Category < ActiveRecord::Base
|
20
20
|
include SpecHelper
|
21
21
|
|
22
|
-
|
22
|
+
col :title
|
23
23
|
has_many :posts
|
24
24
|
end
|
25
25
|
|
26
26
|
class Animal < ActiveRecord::Base
|
27
27
|
include SpecHelper
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
col :name, :index => true
|
30
|
+
add_index :id
|
31
31
|
end
|
32
32
|
|
33
33
|
class Pet < ActiveRecord::Base
|
34
34
|
include SpecHelper
|
35
35
|
|
36
|
-
|
36
|
+
col :name, :index => true
|
37
37
|
end
|
38
38
|
class Dog < Pet; end
|
39
39
|
class Cat < Pet; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_record-compat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-26 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153710260 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153710260
|
26
26
|
description: ! "\nWith it you can add the ability to create columns outside the default
|
27
27
|
schema, directly\nin your model in a similar way that you just know in others projects\nlike
|
28
28
|
\ DataMapper or MongoMapper.\n "
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.10
|
72
72
|
signing_key:
|
73
73
|
specification_version: 3
|
74
74
|
summary: Alternate gem published by Seamus Abshere for ActiveRecord 3.0 support. MiniRecord
|