-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not support :defaults and :class_name at same time #57
Comments
Sorry, for delay - but what about this: class Project < ActiveRecord::Base
has_settings :info, :class_name => 'ProjectSettingObject' do |s|
s.key :dashboard, :defaults => { :theme => 'blue', :view => 'monthly', :filter => false }
s.key :calendar, :defaults => { :scope => 'company'}
end
end IMHO it's already possible. Maybe I don't understand your intention. Feel free to enhance your PR #58 with an additional test. BTW, your PR currently breaks the tests. |
I have stumbled with this issue also. Yes, it is possible the way you are showing it, but it would be nice of a key can have a separate class name like this: has_settings do |s|
s.key :call, defaults: { interval: '15' }
s.key :shift, defaults: { start: '12:00', end: '13:00' },
class_name: 'SiteTimeSettingObject'
end |
@frostblooded @ledermann it doesn't work... how to set multiple keys, defaults and class names? I need something like: has_settings :class_name => 'Class_One' do |s| has_settings :class_name => 'Class_Two' do |s| But the second has_settings overrides the first. I have to use different classes to validate. |
@eduanttunes How did you solve this issue? @ledermann Any update on this? Thanks guys |
I want to be able to have validations on settings and also have defaults for them. It would seem this can't be done due to line 27 in configuration.rb.
The text was updated successfully, but these errors were encountered: