Module: LiveRecord::ActionViewExtensions::ViewHelper
- Defined in:
- lib/live_record/action_view_extensions/view_helper.rb
Instance Method Summary collapse
- #live_record_destroyable(record) ⇒ Object
- #live_record_element(record) ⇒ Object
- #live_record_updatable(record, attribute) ⇒ Object
Instance Method Details
#live_record_destroyable(record) ⇒ Object
13 14 15 |
# File 'lib/live_record/action_view_extensions/view_helper.rb', line 13 def live_record_destroyable(record) raw " data-live-record-destroy-from='#{record.class.name}-#{record.id}' " end |
#live_record_element(record) ⇒ Object
4 5 6 |
# File 'lib/live_record/action_view_extensions/view_helper.rb', line 4 def live_record_element(record) raw " data-live-record-element='#{record.class.name}-#{record.id}' " end |
#live_record_updatable(record, attribute) ⇒ Object
8 9 10 11 |
# File 'lib/live_record/action_view_extensions/view_helper.rb', line 8 def live_record_updatable(record, attribute) raise ArgumentError, "[#{record.class}] does not have an attribute named [#{attribute}]" unless record.attribute_names.include? attribute.to_s raw " data-live-record-update-from='#{record.class.name}-#{record.id}-#{attribute}' " end |