Consul 1.3.0 lets you override generated controller methods

Posted . Visible to the public.

When you use the :as option to map a power to a controller method Show archive.org snapshot you can now override the generated method. The original implementation can be accessed with super.

This is useful to chain additional conditions to a scope:

class NotesController < ApplicationController

  power :notes, as: :note_scope

  # ...
  
  private
  
  def note_scope
    super.where(trashed: false)
  end

end
Profile picture of Henning Koch
Henning Koch
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2023-01-27 15:58)