I''m trying to implement Devise but new to it. When I request .../api/v1/projects.json, I get ''undefined method admin? for nil:NilClass'', which I''m assuming happens because params[:token] is not being set. See below for code snippets -- does anyone know how/where to set params[:token] with Devise? class Api::V1::ProjectsController < Api::V1::BaseController def index respond_with(Project.for(current_user)) end end -- class Project < ActiveRecord::Base ... def self.for(user) user.admin? ? Project : Project.readable_by(user) end end -- class User < ActiveRecord::Base before_save :ensure_authentication_token devise :database_authenticatable, :registerable, :token_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :confirmable ... end -- class Api::V1::BaseController < ActionController::Base before_filter :authenticate_user respond_to :json private def authenticate_user @current_user User.find_by_authentication_token(params[:token]) end def current_user @current_user end end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.