Sha256: 9dee589263648ee15bfc32bc89e42b68f4903e0631ce4229f9b330bdc6501898
Contents?: true
Size: 679 Bytes
Versions: 2
Compression:
Stored size: 679 Bytes
Contents
require 'active_model' require 'pr/form' module PR module ActiveForm def self.included other other.send :include, Form other.send :include, ActiveModel::Validations other.send :attr_accessor, :id other.extend Compatibility end module Compatibility def model_name ActiveModel::Name.new self end end def to_partial_path name = self.class.model_name.to_s.downcase [name.pluralize,name].join '/' end def to_model self end def persisted? !(id.nil?) end def to_key [:id] if persisted? end def to_param id.to_s if persisted? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pr-1.0.0 | lib/pr/active_form.rb |
pr-0.0.7 | lib/pr/active_form.rb |