Class: AdminAssistant::VirtualColumn::FormView
- Inherits:
-
Column::View
- Object
- Column::View
- AdminAssistant::VirtualColumn::FormView
- Includes:
- Column::FormViewMethods
- Defined in:
- lib/admin_assistant/virtual_column.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Column::View
Instance Method Summary collapse
Methods included from Column::FormViewMethods
#after_html, #description, #errors, #field_id, #html, #html_from_helper_method, #render_from_custom_template, #set_instance_variables_from_options
Methods inherited from Column::View
#check_box_and_hidden_tags, #controller, #custom_template_file_path, #file_option_for_custom_template_render, #initialize, #label, #name, #paperclip?, #sort_possible?, #string, #value
Constructor Details
This class inherits a constructor from AdminAssistant::Column::View
Instance Method Details
#default_html(form) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/admin_assistant/virtual_column.rb', line 47 def default_html(form) object = form.object input_name = "#{@column.model_class.name.underscore}[#{name}]" input = @input || :text_field html = if input == :check_box (input_name, value(object)) else @action_view.send("#{input}_tag", input_name, string(object)) end if has_matching_errors?(object) html = "<div class=\"field_with_errors\">#{html}</div>" end html end |
#has_matching_errors?(record) ⇒ Boolean
62 63 64 65 |
# File 'lib/admin_assistant/virtual_column.rb', line 62 def has_matching_errors?(record) record.respond_to?(:errors) && record.errors.respond_to?(:[]) && record.errors[name] end |