lib/katapult/elements/model.rb in katapult-0.4.1 vs lib/katapult/elements/model.rb in katapult-0.5.0

- old
+ new

@@ -46,27 +46,31 @@ def db_fields attrs.reject(&:skip_db) end def renderable_attrs - attrs.reject { |a| %w[plain_json json password].include? a.type.to_s } + attrs.select &:renderable? end def editable_attrs - attrs.reject { |a| %w[plain_json json].include? a.type.to_s } + attrs.select &:editable? end + def required_attrs + attrs.select &:required? + end + def add_foreign_key_attrs(belongs_tos) belongs_tos.each do |other_model| attr "#{ other_model.name :variable }_id", type: :foreign_key, assignable_values: "#{ other_model.name(:class) }.all.to_a", allow_blank: true, associated_model: other_model end end - def render - Generators::ModelGenerator.new(self).invoke_all + def render(options = {}) + Generators::ModelGenerator.new(self, options).invoke_all end private attr_accessor :_belongs_tos