Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Couch potato orm component #849

froderik opened this Issue · 7 comments

4 participants


I tried out the couchrest thingie first but didn't like it as much as couch potato so I made the switch easily. And then I have tried to integrate the thing as a component also. The main stuff is there but I have some problem with the admin generators. If someone familiar with that code could have a look at my attempt I am sure it is only a matter of minutes before the couch potato support is there. My fork only contains these changes.

More specifically I am getting bad code in controllers/session.rb - the model_name is empty so a couple of methods are missing recievers.


Hey @froderik, thanks for this! I have a working draft with your branch, will push it soon for review. Cheers!

@dariocravero dariocravero was assigned

How do we integrate this into padrino-admin? I have ample experience with couch_potato and came to the conclusion that it is very incompatible with the assumptions that padrino-admin has. (e.g. all querys work via the database object and not by using the model).


Included in the commit is an attempt to simulate what should be needed by padring-admin. I added needed methods to the model for this purpose. It was a while ago now so I don't remember what went wrong but it certainly had to do with me not knowing enough about padrino-admin rather than it not being possible with couch_potato.


Yup @skade you're right, it's quite different but it shouldn't be that much of a trouble. Here's a git diff of @froderik's branch with a couple of patches to get it to work a bit further, it still misses those changes being applied in the controller and a few other places.

The repo is confusing, the author assumes methods like create on the readme that you won't find inside -there's even an issue asking where that method is and nobody answered. @froderik I also thought of adding those extra methods because it's great to consolidate the API with other ORMs but I reckon it's going against the ORM's design. In this case it would be better to create a gem or propose those changes to the library itself.

What do you think?


The reason why I'm asking is that this might also be a design flaw in padrino-admin. The thing we usually ended up with on small projects is just replacing the crucial lines in the admin controllers by their couch_potato equivalents. Its quickly done and painless.

padrino-admin fully relies on the fact that most database layers expose a uniform interface. It could possibly use an adapter pattern instead, with a default adapter for everything that behaves uniform and special adapters for couch_potato for example. Something like this:

get :contacts, :show do
  fetch_model_for_id(Contact, params[:id])

Mmm, yes, I reckon that makes sense. Should we go with that approach @padrino/core-members?


Slate for 1.0, we should write great wrapper for the admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.