Skip to content
Vinicius Stock edited this page Sep 23, 2019 · 1 revision

Set

Setting

Sail.set(:my_set_setting, ["Mark", "John"])
Sail.set(:my_set_setting, "Mark;John")

Getting

Sail.get(:my_set_setting)
=> #<Set: {"Mark", "John"}>

Sail.get(:my_array_setting) do |setting_value|
  puts setting_value
end
=> #<Set: {"Mark", "John"}>

Examples

Set settings can be configured to be used for defining specific lists that may need to be changed live.

class Post < ApplicationRecord
  .
  .
  .

  def belongs_to_promotion?
    Sail.get(:promotion_post_ids).include?(id)
  end
end
Clone this wiki locally