Module: Opinio::Schema
- Included in:
- Orm::ActiveRecord::Schema
- Defined in:
- lib/opinio/schema.rb
Instance Method Summary (collapse)
-
- (Object) apply_opinio_schema(name, type, options = {})
Overwrite with specific modification to create your own schema.
- - (Object) opinio(options = {})
Instance Method Details
- (Object) apply_opinio_schema(name, type, options = {})
Overwrite with specific modification to create your own schema.
16 17 18 |
# File 'lib/opinio/schema.rb', line 16 def apply_opinio_schema(name, type, ={}) raise NotImplementedError end |
- (Object) opinio(options = {})
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/opinio/schema.rb', line 4 def opinio( = {}) null = [:null] || false default = .key?(:default) ? [:default] : ("" if null == false) apply_opinio_schema :owner_id, :integer, :null => false apply_opinio_schema :commentable_id, :integer, :null => false apply_opinio_schema :commentable_type, :string, :null => false apply_opinio_schema :title, :string, :default => default, :null => null if [:title] apply_opinio_schema :body, :text, :null => false end |