Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Rails 4 and jquery not loading on view change?


  • Please log in to reply
3 replies to this topic

#1 Vell

Vell

    Dispatcher

  • Members
  • 45 posts
  • LocationWashington, DC

Posted 19 August 2013 - 08:39 PM

Hello all,

 

I am seeing this very weird issue in rails 4 where I have a navigation section that is housed in my layout.html.erb file. When clicking on the different links, the views that require jquery don't seem to load unless I refresh the page. Has anyone found a reason for this or a way that I can get around it so that I don't have to refresh the page right after clicking the link.

 

Example: Events page has a jquery date picker. I click on new event link then click the text field to bring up the date picker but nothing happens. I refresh that same page then click on teh text field and the date picker now works.

 

I also see this in the case of monitoring a text field to do an onChange action where I post an action for updating a drop down list. This also doesn't work unless I refresh the page where this action resides.

 

Any help in understanding would be greatly appreciated.



#2 Ohm

Ohm

    Guard

  • Members
  • 179 posts
  • LocationCopenhagen

Posted 19 August 2013 - 09:09 PM

I'm not that familiar with Rails 4 yet, however I think this might be a problem with Turbolinks which is standard in Rails 4. Could you try commenting out Turbolinks from your Gemfile?


Blog: http://ohm.sh | Twitter: madsohm


#3 egb3

egb3

    Passenger

  • Members
  • 1 posts

Posted 19 August 2013 - 09:53 PM

Read this: https://github.com/r...queryturbolinks



#4 Vell

Vell

    Dispatcher

  • Members
  • 45 posts
  • LocationWashington, DC

Posted 21 August 2013 - 04:42 AM

Thanks for the assitance guys. I would have responded earlier but I wans't notified that I had responses. I will definitely read the links and see see if I need turbolinks at all.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users