Skip to content

Conversation

@bhh
Copy link

@bhh bhh commented Apr 22, 2013

needed a lowercase version for legacy reasons (preferably

everything else on the string class should also be possible.
i also think about allowing .camelcase(:lower)

let me know what you think about it.

first i thought i wanted something like directly give a name to the model. but that wont work very well with the .get on different types

@samlown
Copy link
Member

samlown commented Dec 3, 2013

Hi. I see where you're going with this, but I think my recommended approach would be to have a single model_type_value method that can be overwritten in the class definition. This would fit nicely with model_type_key. I'll see if I get chance to add this soon.

@samlown samlown closed this Dec 3, 2013
@bhh
Copy link
Author

bhh commented Dec 3, 2013

that was my first intention too. but isnt that impossible atm with the current implementation of "build_from_database"

i guess at least the last feature on this page needs to be dropped http://www.couchrest.info/model/querying.html

@samlown samlown reopened this Dec 3, 2013
@samlown
Copy link
Member

samlown commented Dec 3, 2013

You're right. I'd forgotten about building from the database.

For these fringe use-cases however, I think its acceptable if a few features don't work. To be honest, I can't think many people actually depend on this anyway, its just there really for added bit of security against fetching models of the wrong type.

I've updated the master repo with a model_type_value method, should you want to try it out.

@bhh
Copy link
Author

bhh commented Dec 3, 2013

yeah you're right the use case is quite strange. it was just because a customer already had a couchdb which many other apps writing data with the type in lowercase and i really wanted to use couchrest_model and dont break anything. i already use my github version of this. i just wanted to share what i've done in case you think it's a usable solution

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants