class ActionBlocks::MountedFormBuilder
Public Instance Methods
after_load()
click to toggle source
validate :validate_mounted_to def validate_mounted_to
return unless [:dashboard, :subspace].include?(@mounted_to) errors.add(:mounted_to, "#{@parent.key} #{type} must be mounted to :dashboard or :subspace but #{@mounted_to.inspect} was specified.")
end
validate :validate_mount_point_matches_model def validate_mount_point_matches_model
# TODO
end
# File lib/action_blocks/builders/workspace_builder.rb, line 262 def after_load # After load is called after all blocks are in the store if form.model.id == @subspace.model.try(:id) @mounted_to = :subspace end if form.model.id == @dashboard.model.try(:id) @mounted_to = :dashboard end end
before_build(parent, *args)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 244 def before_build(parent, *args) @id = args[0] @dashboard = parent @subspace = @dashboard.subspace @form_key = "form-#{@id}" end
hashify(user)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 272 def hashify(user) { type: :mounted_form, form_key: @form_key, mounted_to: @mounted_to } end