-
Notifications
You must be signed in to change notification settings - Fork 32
Obj model
Vinicius Stock edited this page Feb 19, 2019
·
4 revisions
Sail.set(:my_model_setting, "Post")
Sail.set(:my_model_setting, Post)
Sail.get(:my_model_setting)
=> Post
Sail.get(:my_model_setting) do |setting_value|
puts setting_value
end
=> Post
Obj model type settings return the class for a given model from the Rails application. One use case of this is testing out two different implementations of a similar model either to compare their performance or to make a safe refactor.
class ArticlesController < ApplicationController
def index
Sail.get(:model_for_articles).where(author: "John")
end
end