Having an issue with custom setters I want to define. I keep getting a stack level too deep. I wonder what is the best practice?
class CampaignSetupPage
include Virtus.model
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
attribute :url, String
attribute :custom_title, String
attribute :crawled_title, String
attribute :keywords, Array
attribute :scraper, ShoppageScraper
def url=(new_url)
if new_url.is_a? String
prefixed = LinkHelper.prefix_with_protocol_if_no_protocol(url_string: new_url)
self[:url] = prefixed
else
super
end
end
end
Having an issue with custom setters I want to define. I keep getting a stack level too deep. I wonder what is the best practice?