Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Issues with JQuery AtWho

Javascript • Asked by Darion Wood

Hello, I enjoyed your screencast on implementing the @ functionality for user interactions. What I'm trying to figure out is how to handle the index.json.jbuilder when using devise

jQuery ->
$('[data-behavior ="autocomplete"]').atwho(
at: "@",
'data': "/users.json"

I cannot access the /users.json url with this approach. I created a separate UsersController for building profiles and displaying them. Otherwise, I'm puzzled on how I would get atWho to play nicely with Devise. I have a friendly_id slug for the username as well.

Hey Darion, sorry for the late reply! Got distracted with the holidays. :)

Devise overrides some of the URLs for /users like you mentioned (I think they do everything except index and show). You could just add the resources :users route because I believe Devise does not make a GET /users route so it would match with your resources and controller. You should be safe here as long as you're

The other option would be to namespace that route with something like /api/users which would be a way for you to separate out the two. It doesn't make for usable URLs in your app, but it might be a nice way to dedicate a controller entirely to the atwho behavior.

Alright, I will use the first method of adding resources for the users_controller.rb. I'll post an update to let you know how everything goes. I'm working on a feature implementation as we speak. Thank you.

Awesome, good luck!

I getting undefined value.

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 29,763+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.