Sha256: 4efd1cf88289eaeaeff620530b84b0c2970c11acc360bdbef2a38b1bdff12714
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
module Rao module ResourcesController::AwesomeNestedSetConcern extend ActiveSupport::Concern def reposition @resource = load_resource @dropped_resource = load_resource_scope.find(params[:dropped_id]) @dropped_resource.move_to_right_of(@resource) label_methods = [:human, :name, :email, :to_s] target_resource_label = nil label_methods.each do |method_name| if @resource.respond_to?(method_name) target_resource_label = @resource.send(method_name) break end end inserted_resource_label = nil label_methods.each do |method_name| if @dropped_resource.respond_to?(method_name) inserted_resource_label = @dropped_resource.send(method_name) break end end redirect_to after_reposition_location, notice: I18n.t("awesome_nested_set.flash.actions.reposition.notice", target_resource: target_resource_label, inserted_resource: inserted_resource_label) end private def after_reposition_location collection_path end end end
Version data entries
4 entries across 4 versions & 1 rubygems