Module: Opinio::Schema
- Included in:
- Orm::ActiveRecord::Schema
- Defined in:
- lib/opinio/schema.rb
Instance Method Summary collapse
-
#apply_opinio_schema(name, type, options = {}) ⇒ Object
Overwrite with specific modification to create your own schema.
- #opinio(options = {}) ⇒ Object
Instance Method Details
#apply_opinio_schema(name, type, options = {}) ⇒ Object
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 |
#opinio(options = {}) ⇒ Object
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 |