Skip to content
Browse files

remove all the aliases, bump minor

  • Loading branch information...
1 parent 619f9ce commit 254ca66e190cdf4b5ca6f6426a4bfe522051c723 @seamusabshere committed
Showing with 8 additions and 20 deletions.
  1. +0 −2 README.md
  2. +0 −10 lib/mini_record/auto_schema.rb
  3. +1 −1 lib/mini_record/version.rb
  4. +7 −7 spec/models.rb
View
2 README.md
@@ -44,8 +44,6 @@ end
Post.auto_upgrade!
```
-If you don't like `col` there are also few aliases: `key, field, property, attribute`
-
Instead of `:as => :my_type` you can use `:type => :my_type`
Option `:as` or `:type` if not provided is `:string` by default, you can use all ActiveRecord types:
View
10 lib/mini_record/auto_schema.rb
@@ -39,32 +39,22 @@ def col(*args)
end
end
end
- alias :key :col
- alias :property :col
- alias :field :col
- alias :attribute :col
def reset_table_definition!
@_table_definition = nil
end
- alias :reset_schema! :reset_table_definition!
def schema
reset_table_definition!
yield table_definition
table_definition
end
- alias :keys :schema
- alias :properties :schema
- alias :fields :schema
- alias :attributes :schema
def add_index(column_name, options={})
index_name = shorten_index_name connection.index_name(table_name, :column => column_name)
indexes[index_name] = options.merge(:column => column_name, :name => index_name)
index_name
end
- alias :index :add_index
def connection?
!!connection
View
2 lib/mini_record/version.rb
@@ -1,3 +1,3 @@
module MiniRecord
- VERSION = "0.2.1"
+ VERSION = "0.3.0"
end
View
14 spec/models.rb
@@ -10,30 +10,30 @@ class Person < ActiveRecord::Base
class Post < ActiveRecord::Base
include SpecHelper
- key :title
- key :body
- key :category, :as => :references
+ col :title
+ col :body
+ col :category, :as => :references
belongs_to :category
end
class Category < ActiveRecord::Base
include SpecHelper
- key :title
+ col :title
has_many :posts
end
class Animal < ActiveRecord::Base
include SpecHelper
- key :name, :index => true
- index :id
+ col :name, :index => true
+ add_index :id
end
class Pet < ActiveRecord::Base
include SpecHelper
- key :name, :index => true
+ col :name, :index => true
end
class Dog < Pet; end
class Cat < Pet; end

0 comments on commit 254ca66

Please sign in to comment.
Something went wrong with that request. Please try again.