Open Exelord opened 6 years ago
Thanks for raising this. I'm not sure what the usecase is to configure a method on an otherwise unused scope, can you provide an example?
In the case when you are using scopes just for categorizing things this is pretty useful. Eg, for different scopes you have a diffrent method which calls the same. Right now I have to define an empty default key for the scope if I want to use a method in it.
Sounds interesting - can you provide an example usage in code?
Sure, eg you can have:
configuration_method cars: :engine_types do
Engines.for.cars
end
configuration_method bikes: :engine_types do
Engines.for.bikes
end
And in that case to have it worked I need to define defaults nil
for :cars
and :bikes
Also, Is there any possibility to access different scope in a method? use-case example:
MyApp.configure do |c|
c.host = 'mydomain.com'
end
configuration_method emails: :email_for do |name|
"#{name}@#{host}"
end
Unfortunately the host
doesn't exist in that context
Bug description
If you want to define
configuration_method
and you don't have another key in the scope, eg.:my
the method won't be defined.