Sha256: c373e893be2cff9ca08a92d84444cd114fc1fbf696c3f76a8537d4eff5ab4827
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
module Form class Row < ActiveRecord::Base include Form include Admin::Form::Row self.table_name_prefix = 'form_' belongs_to :structure has_many :fields, through: :structure has_one :viewable, through: :structure, class_name: 'Viewable::Form' validates :structure, presence: true delegate :with_email?, :send_to, :subject, :body, :email_column_key, :header, to: :structure delegate :form_name, to: :viewable def send_from send(email_column_key) if email_column_key end def labelled_values columns = fields.count.times.map{ |i| "column_#{i}" } values = header.attributes.slice(*columns) values.reduce({}) do |values, (column_key, label)| values[label] = send(column_key) values end end def locale_enum I18n.available_locales end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_cms-0.0.2 | app/models/form/row.rb |