Frage

Ich habe meine App konfiguriert mit Settingslogic , die ich liebe. Meine Frage ist, wie ich eine Seite auf meiner Rails-Anwendung zu machen, wo Administratoren Änderungen an den Einstellungen angegeben machen können in config/settings.yml ??

Mir sagt assume Seite entsprechende Formularfelder für alle Werte in der YAML-Datei lesen würde und anzuzeigen, und speichert diese Werte zu config/settings.yml zurück? Würden diese Einstellungen werden sofort wirksam oder würde der Server muss neu gestartet werden?

Bit hier verloren. Danke.

Siehe auch: Rails-Anwendung Einstellungen

?
War es hilfreich?

Lösung

I couldn't figure this out, so I've switch from Settingslogic to rails-settings, which allows me to store settings equally easy in the database, which makes them far easier for me to set up editing by the end user.

If anyone figures this out with Settingslogic, I'd really love to hear a solution!

Andere Tipps

I think you were on the right path. What I'd do is to create some kind of fake model using ActiveModel that would allow you to create an easy form for modifying each individual setting. After the form is submitted simply write to the settingslogic source file by calling .to_yaml on your returned object.

Lastly, to reload your settings you can invoke Settings.reload! without having to restart the entire application.

I realize this is well after you asked your question, but thought I'd provide an answer in case others stumble upon it too.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top