Commit a39726260c24de895562dca9201ae4ebf4971629

Authored by ikeqiao
1 parent 669d28c3
Exists in master

fixbug create_magic_fields to create_magic_field

Showing 2 changed files with 8 additions and 8 deletions   Show diff stats
@@ -41,15 +41,15 @@ Add magic fields to your model: @@ -41,15 +41,15 @@ Add magic fields to your model:
41 41
42 ```ruby 42 ```ruby
43 @charlie = Person.create(:email => "charlie@example.com") 43 @charlie = Person.create(:email => "charlie@example.com")
44 -@charlie.create_magic_fields(:name => "first_name") 44 +@charlie.create_magic_field(:name => "first_name")
45 ``` 45 ```
46 46
47 Supply additional options if you have more specific requirements for your fields: 47 Supply additional options if you have more specific requirements for your fields:
48 48
49 ```ruby 49 ```ruby
50 -@charlie.create_magic_fields(:name => "last_name", :is_required => true)  
51 -@charlie.create_magic_fields(:name => "birthday", :datatype => :date)  
52 -@charlie.create_magic_fields(:name => "salary", :default => "40000", :pretty_name => "Yearly Salary") 50 +@charlie.create_magic_field(:name => "last_name", :is_required => true)
  51 +@charlie.create_magic_field(:name => "birthday", :datatype => :date)
  52 +@charlie.create_magic_field(:name => "salary", :default => "40000", :pretty_name => "Yearly Salary")
53 ``` 53 ```
54 54
55 The `:datatype` option supports: `:check_box_boolean`, `:date`, `:datetime`, `:integer` 55 The `:datatype` option supports: `:check_box_boolean`, `:date`, `:datetime`, `:integer`
@@ -107,14 +107,14 @@ To see all the magic fields available for a type_scoped(User) child from its par @@ -107,14 +107,14 @@ To see all the magic fields available for a type_scoped(User) child from its par
107 To add magic fields, go through the parent or child: 107 To add magic fields, go through the parent or child:
108 108
109 ```ruby 109 ```ruby
110 -@alice.create_magic_fields(...)  
111 -@account.create_magic_fields(…,:type_scoped => "User") 110 +@alice.create_magic_field(...)
  111 +@account.create_magic_field(…,:type_scoped => "User")
112 ``` 112 ```
113 113
114 All User children for a given parent will have access to the same magic fields: 114 All User children for a given parent will have access to the same magic fields:
115 115
116 ```ruby 116 ```ruby
117 -@alice.create_magic_fields(:name => "salary") 117 +@alice.create_magic_field(:name => "salary")
118 @alice.salary = "40000" 118 @alice.salary = "40000"
119 119
120 @bob = User.create(:name => "bob", :account => @account) 120 @bob = User.create(:name => "bob", :account => @account)
has_magic_fields.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s| @@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10 s.email = ["zhzsi@126.com"] 10 s.email = ["zhzsi@126.com"]
11 s.description = %q{Custom fields forActiveRecord models, suppport Rails 4!} 11 s.description = %q{Custom fields forActiveRecord models, suppport Rails 4!}
12 s.summary = %q{Allow addition of custom 'magic' fields to ActiveRecord models.} 12 s.summary = %q{Allow addition of custom 'magic' fields to ActiveRecord models.}
13 - s.homepage = "git@github.com:ikeqiao/has_magic_fields.git" 13 + s.homepage = "https://github.com/ikeqiao/has_magic_fields"
14 s.license = "MIT" 14 s.license = "MIT"
15 15
16 s.files = `git ls-files`.split($/) 16 s.files = `git ls-files`.split($/)