undefined method `by_email' #1

Open
amhill opened this Issue Aug 10, 2011 · 5 comments

Comments

Projects
None yet
4 participants
@amhill

amhill commented Aug 10, 2011

Ive been using this example code to try and understand how to use Couch and Devise together. The example seems to work fine except that once I have signed up I cannot then sign in. I am unsure where this error is coming from.

NoMethodError in Devise/sessionsController#create

undefined method `by_email' for #<CouchRest::Model::Base::OrmAdapter:0x00000002651a88>

The gem versions Im using are as follows..

rails 3.0.5
couchrest 1.1.2
couchrest_model 1.1.2
devise 1.4.2
devise_couch 0.1.2
orm_adapter 0.0.5

@ocdavid

This comment has been minimized.

Show comment Hide comment
@ocdavid

ocdavid Oct 19, 2011

I also see this problem, only I am using the orm_adapter 0.0.3, from git://github.com/shenoudab/orm_adapter.git.

ocdavid commented Oct 19, 2011

I also see this problem, only I am using the orm_adapter 0.0.3, from git://github.com/shenoudab/orm_adapter.git.

@ocdavid

This comment has been minimized.

Show comment Hide comment
@ocdavid

ocdavid Oct 21, 2011

Solved by adding "view_by :email" to the User model.

ocdavid commented Oct 21, 2011

Solved by adding "view_by :email" to the User model.

@leondu

This comment has been minimized.

Show comment Hide comment
@leondu

leondu Nov 9, 2011

added

  view_by :email

still seeing this when login.

gem 'couchrest_model'
gem 'orm_adapter', :git => 'git://github.com/shenoudab/orm_adapter.git'
gem 'devise', '1.4.2'
gem 'devise_couch'

@daviduw
any idea?

leondu commented Nov 9, 2011

added

  view_by :email

still seeing this when login.

gem 'couchrest_model'
gem 'orm_adapter', :git => 'git://github.com/shenoudab/orm_adapter.git'
gem 'devise', '1.4.2'
gem 'devise_couch'

@daviduw
any idea?

@leondu

This comment has been minimized.

Show comment Hide comment
@leondu

leondu Nov 9, 2011

solved the problem, 'klass' is missing,
couchrest_model.rb #38, should be:

        # Find the first instance matching conditions
        def find_first(conditions)
          if conditions.keys.first == :id
            klass.get(conditions.values.first)
          else
            klass.send("by_#{conditions.keys.first}", {:key => conditions.values.first, :limit => 1}).first
          end
        end

leondu commented Nov 9, 2011

solved the problem, 'klass' is missing,
couchrest_model.rb #38, should be:

        # Find the first instance matching conditions
        def find_first(conditions)
          if conditions.keys.first == :id
            klass.get(conditions.values.first)
          else
            klass.send("by_#{conditions.keys.first}", {:key => conditions.values.first, :limit => 1}).first
          end
        end
@benwoody

This comment has been minimized.

Show comment Hide comment
@benwoody

benwoody Dec 19, 2011

Reproducing this error as well in this example and in my other apps. I've added the view_by :email and edited the couchrest_model.rb as leondu said.

Using:
rails 3.1.3
couchrest 1.1.2
couchrest_model 1.1.2
devise 1.5.3
devise_couch 0.1.2
orm_adapter 0.0.3 dcf9cd3 (from git://github.com/shenoudab/orm_adapter.git)

Reproducing this error as well in this example and in my other apps. I've added the view_by :email and edited the couchrest_model.rb as leondu said.

Using:
rails 3.1.3
couchrest 1.1.2
couchrest_model 1.1.2
devise 1.5.3
devise_couch 0.1.2
orm_adapter 0.0.3 dcf9cd3 (from git://github.com/shenoudab/orm_adapter.git)

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