Ask A Question

Notifications

You’re not receiving notifications from this thread.

Issues with JQuery AtWho

Darion Wood asked in Javascript

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.

Reply

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.

Reply

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.

Reply

Awesome, good luck!

Reply

Thanks!

Reply
I getting undefined value.
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,796+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.