I have the following code:
class SupportsController < ApplicationController before_action :set_support, only: [:show, :edit, :update, :destroy] ....
Is it possible to pass a string to the method set_support
to be applied for all 4 view methods? Is it possible to pass a different string to the method set_support
for each method in the view?
before_action only: [:show, :edit, :update, :destroy] do set_support("value") end
You can use a lambda:
class SupportsController < ApplicationController before_action -> { set_support("value") }, only: [:show, :edit, :update, :destroy] ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With