cockpit
cockpit copied to clipboard
Active Record Store
Right, back again...
I've got the following settings in an initializer:
Cockpit 'active_record' do
site do
default_page_title 'Default Page Title'
default_tagline 'Default Tagline'
default_meta_tags 'Default Meta Tags'
end
end
And the following in a controller:
Cockpit::Settings['site'].each do |setting|
if params[setting.key]
if setting.value != params[setting.key]
setting.value = params[setting.key]
end
end
end
No matter what I do, I can't get the updated key to persist within the database. The updated value will stick around within the Moneta store but no inserts/updates are run and nothing goes into the DB.
Any help would be greatly appreciated.
Fingers crossed you can help...
After some more digging, I can't even seem to get the settings to persist at all in the console: big-whoop:dta-app andypearson$ rails c Loading development environment (Rails 3.0.0) >> Cockpit::Settings['site.default_page_title'] => "Default Page Title" >> Cockpit::Settings['site.default_page_title'] = 'New Title' => "New Title" >> Cockpit::Settings['site.default_page_title'] => "Default Page Title" >> exit
big-whoop:dta-app andypearson$ rails c
Loading development environment (Rails 3.0.0)
>> Cockpit::Settings['site.default_page_title']
=> "Default Page Title"
>> exit
I've started to hack together a failing test, but I'm wondering whether you can shed any light on this, I'm still really keen to use this on a couple of projects.