Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some cleanup to usage file

  • Loading branch information...
commit 7c2610a17ebd06bdec1380c9b7b6d936a7e385be 1 parent c4f72c5
@ffmike authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 generators/model_plus/USAGE
View
10 generators/model_plus/USAGE
@@ -27,17 +27,19 @@ Description:
password:string+vc => validates_confirmation_of :password and
validates_presence_of :password_confirmation
- accessors too:
+ Accessors using the +a token:
title:string+aa => attr_accessor :title
password:string+ap => attr_protected :password
+
You can also use several tokens at once:
username:string+vl6+vu => generates validates_length_of :username and validates_uniqueness_of :username
- A side from validations, you can add other options to your attributes:
+ Defaults and nullability in migrations using the +c token:
- hits:integer+vi+cd0 => validates_numericality_of :hits, :only_integer => true and in the migration t.hits, :integer, :default => 0
- name:string+cn => t.name :string, :null => false
+ hits:integer+vi+cd0 => validates_numericality_of :hits, :only_integer => true and in the migration t.hits, :integer, :default => 0
+ title:string+cd"boss" => t.title :string, :default => "boss"
+ name:string+cn => t.name :string, :null => false
This generates a model class in app/models, a unit test in test/unit,
a test fixture in test/fixtures/singular_name.yml, and a migration in
Please sign in to comment.
Something went wrong with that request. Please try again.