Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fiding attributes - method_missing #160

Open
rafaellima opened this issue Feb 21, 2013 · 2 comments
Open

fiding attributes - method_missing #160

rafaellima opened this issue Feb 21, 2013 · 2 comments

Comments

@rafaellima
Copy link

Hi There,

I've just started using Couchdb on my Rails projects (with couchrest_model gem) and I'm missing something like Model.find_by_* methods?

In case it doesn't exist, would it be a good idea to improve this gem to do so?

Cheers,

@samlown
Copy link
Member

samlown commented Feb 22, 2013

Hi. It is possible to do what you suggest, I use it quite a lot in fact. Take the following model and example:

class User < CouchRest::Model::Base
  property :email
  design do
    view :by_email
  end
end

user = User.by_email.key('[email protected]').first
# is the same as:
user = User.find_by_email '[email protected]'

I'd also recommend using the github repo in your project. Its been a while since we released a gem, and the master branch has a lot of useful stuff.

Cheers, sam

@rafaellima
Copy link
Author

Ohhh it was there all the time and I've missed.

Thanks sam!

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

No branches or pull requests

2 participants