lucasrenan / CouchRest-Model-ORM-for-Devise

It integrates Devise with CouchDB
17 stars 2 forks source link

Error when I try to edit the user information. #1

Open guivinicius opened 14 years ago

guivinicius commented 14 years ago
undefined method `keys' for nil:NilClass

lib/orm/couchrest_model.rb:42:in `find'

Session Dump

_csrf_token: "lKg0osqDZjezPbRJ9E5w/dt0Kou9OZjWiYW0KpPo1BE="
session_id: "fdc13e860dd86847a01a39f83b1b8a21"
warden.user.user.key: ["User", "guivinicius"]

View

link_to "Edit User", edit_user_registration_path

UPDATE 09/29

Actually I'm getting this erros, everytime I send a find request for my model. It's like, the session is passing empty values for the method.

JamesHayton commented 14 years ago

I get the same error.

kssia commented 14 years ago

the same error too

lucasrenan commented 14 years ago

This error is related to the way that Devise does the queries to find users. For the autetication Devise passes a hash with a "conditions" option, but when the find method was called passing just an id, it didn't find the options[:conditions].keys. Now the bug was fixed, then the find method also can be called like this:

User.find "some_user_id"

kssia commented 14 years ago

Nice =D thanxx

baphled commented 14 years ago

I was having the same issue up until I pulled down the latest changes, now I'm getting the following error:

undefined method `errors' for nil:NilClass Extracted source (around line #4):

1: Edit <%= resource_name.to_s.humanize %> 2: 3: <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> 4: <%= devise_error_messages! %> 5: 6:

<%= f.label :email %>
7: <%= f.text_field :email %></p

lucasrenan commented 14 years ago

This form that you are using was generated by Devise?

baphled commented 14 years ago

yeah

lucasrenan commented 14 years ago

Try to comment this line:

<%= devise_error_messages! %>

I m thinking that s a couchrest model problem, please, give me some days to analyse it.

baphled commented 14 years ago

I did that and it fixed that issue up until I try to update a user from there come up with another devise based error...

NoMethodError in Devise/registrationsController#update

undefined method `update_with_password' for nil:NilClass

lucasrenan commented 14 years ago

I tried to edit by default devise update users form http://localhost:3000/users/edit

and updated successfully. What's the version of devise and couchrest model?

baphled commented 14 years ago

I'm using devise (1.2.rc 721843c) and couchrest_model (1.0.0.beta8 cc2b183), though I had the same issue when I was using devise 1.1.3

lucasrenan commented 14 years ago

Please try:

Couchrest model 1.0.0.beta7 Devise 1.1.3

baphled commented 14 years ago

There seems to be a typo in 1.0.0.beta7's uniqueness validations

/home/baphled/.rvm/gems/ruby-1.9.2-rc2/gems/couchrest_model-1.0.0.beta7/lib/couchrest/model/validations/uniqueness.rb:1: unknown encoding name: urf-8 (ArgumentError)

I remember encountering that before and was why I tried out 1.0.0.beta8

lucasrenan commented 14 years ago

I'll run devise testes with this ORM, please, wait a while.

baphled commented 14 years ago

no problem

jaycee74 commented 13 years ago

baphled, I had exactly the same problems as you describe, however I am not using couchrest. I had overloaded the RegistrationsController for devise and removed the prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy] line at the top of the class adding this line again fixed the problem, does couchrest overload the RegistrationsController?

lucasrenan commented 13 years ago

as far as I know, CouchRest not overload controllers. Did you try with the updated versions of devise and couch rest model?