Couch potato orm component #849

Closed
froderik opened this Issue May 22, 2012 · 8 comments

Comments

Projects
None yet
5 participants
@froderik

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.

@dariocravero

This comment has been minimized.

Show comment Hide comment
@dariocravero

dariocravero Jan 10, 2013

Contributor

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

Contributor

dariocravero commented Jan 10, 2013

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

@ghost ghost assigned dariocravero Jan 10, 2013

@skade

This comment has been minimized.

Show comment Hide comment
@skade

skade Jan 14, 2013

Member

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).

Member

skade commented Jan 14, 2013

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).

@froderik

This comment has been minimized.

Show comment Hide comment
@froderik

froderik Jan 14, 2013

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.

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.

@dariocravero

This comment has been minimized.

Show comment Hide comment
@dariocravero

dariocravero Jan 14, 2013

Contributor

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?

Contributor

dariocravero commented Jan 14, 2013

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?

@skade

This comment has been minimized.

Show comment Hide comment
@skade

skade Jan 14, 2013

Member

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])
end
Member

skade commented Jan 14, 2013

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])
end
@dariocravero

This comment has been minimized.

Show comment Hide comment
@dariocravero

dariocravero Jan 14, 2013

Contributor

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

Contributor

dariocravero commented Jan 14, 2013

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

@DAddYE

This comment has been minimized.

Show comment Hide comment
@DAddYE

DAddYE Jan 31, 2013

Member

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

Member

DAddYE commented Jan 31, 2013

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

@ujifgc

This comment has been minimized.

Show comment Hide comment
@ujifgc

ujifgc Nov 2, 2016

Member

Closing in favor of #1494

Member

ujifgc commented Nov 2, 2016

Closing in favor of #1494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment