On Aug 22, 2009, at 5:40 AM, Spiralis wrote:
> > I am trying to use the http://github.com/Squeegy/rails-settings plugin > for handling my application's settings. This plugin defines it's own > Settings object, which is a ActiveRecord descendant, but of course not > a hobo-model. > > I have tried to just generate a hobo_controller for Setting, hoping > that this should give me something to work on. > > The first thing I noticed was that the plugin uses the Settings > (plural) model, so I thought I could patch it to the right model by > doing something like this: > > class Admin::SettingsController < Admin::AdminSiteController > hobo_model_controller Settings > auto_actions :all > end > > However, the plugin-based Settings model doesn't seem to available at > the time the controllers are set up. Here's the error: > --- > NoMethodError > > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.model_name > --- > > Anyone have an idea on how to make this work? It *might* be possible to do this, but it's going to be a lot of work. The hobo_model_controller code relies on quite a few methods that are added to the model objects, and you'd have to essentially duplicate or stub those. Then there's the permissions... Also, the stock model_controller stuff isn't going to gel particularly well with Settings - it give you an interface where you have to go to a separate page for each setting. Your best bet is to simply write a regular Rails controller and view for this - it's not that difficult, and lets you have more control over the presentation. I'm assuming that you've got a fairly small number of settings... Alternatively, it would make a useful Hobo plugin to have a compatible version. --Matt Jones --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
