RailsCasts Pro episodes are now free!

Learn more or hide this

Leandro Moreira's Profile

GitHub User: leandromoreira

Site: http://leandromoreira.com.br

Comments by Leandro Moreira

Avatar

If you face the problem with mongoid problem:

MONGO MOP Can't canonicalize query: BadValue unknown operator: $oid

Make sure you change current_user method:

   def current_user
-    @current_user ||= User.find(session[:user_id]) if session[:user_id]
+    @current_user ||= User.find(session[:user_id]["$oid"]) if session[:user_id]
   end

https://github.com/liziane/Cookbook/commit/128a9aeee392b8e680d86fdad35ac258846cedd6

Avatar

I would like to know (links) how to keep user logged in info inside cookies safety.

Avatar

If I would opt by using an external table (properties -> name, value); how it would looks like?

I think the models could be something like this.

class Product
  has_many :proprieties 
#...
end

class Property
  belongs_to :product
end

But, what are the best way to bind this to the view?

Avatar

Perfect, I was using Simple Form then I had to use a different css path for that.