README.markdown in extend_at-0.1.5 vs README.markdown in extend_at-0.2.0
- old
+ new
@@ -1,12 +1,12 @@
# Extend at
This gem allows you to extend models without migrations: This way you can, i.e., develop your own content types, like in Drupal.
-## NOTE:
+## Status:
-Incompatible with previous versions.
+[](http://travis-ci.org/anga/extend_at)
## Installation
<code>gem install extend_at</code>
@@ -114,12 +114,10 @@
* Time: <code>:timestamp</code>
* Date: <code>:datetime</code>
Else, return <code>:any</code>
-You can use any class, but if you need use boolean values, you must use :boolean.
-
#### Set default value
class User < ActiveRecord::Base
extend_at :extra, :columns => {
:private_photos => {
@@ -157,10 +155,11 @@
Description.where(:user_id => self.id).default
end
end
#### Set validation
+
class User < ActiveRecord::Base
extend_at :extra, :columns => {
:private_photos => {
:type => :boolean,
:default => true
@@ -213,10 +212,25 @@
def must_not_use_strong_language(desc)
errors.add :cofig_profile_description, "You must not use strong language" if desc =~ /(#{STRONG_WORD.join('|')})/
end
end
+### Static columns
+
+If you like to restrict the existent extended columns, you should use <code>:static => true</code>
+
+ class User < ActiveRecord::Base
+ extend_at :extra, :columns => {
+ :private_photos => {
+ :type => :boolean,
+ :default => true
+ }
+ }, :static => true
+ end
+
+Now, <code>User.extra</code> only accept <code>private_photos</code> column
+
### Scopes
You can use scope like:
User.extra_last_loggin_gt_eq(1.week.ago).extra_age_gt_eq(18).where(:column => "value").all
@@ -284,13 +298,8 @@
## Bugs, recomendation, etc
If you found a bug, create an issue. If you have a recomendation, idea, etc., create a request or fork the project.
-## TODO:
-
-* RSpec test
-* Support static columns
-
## License
-This gem is under MIT license.
\ No newline at end of file
+This gem is under MIT license.