Ruby on Rails - devise users/sign_out not working

前端 未结 4 2108
抹茶落季
抹茶落季 2021-02-07 03:26

I\'m using devise sign_in and sign_up urls are working

but, when I try the url: http://localhost:3000/users/sign_out

it gene

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 03:32

    I had exactly the same symptoms, but I was also using jquery-turbolinks with masonry-rails to have images in the site transition and position "nicely".

    I found that having this "broke" the transitions:

    //= require jquery_ujs
    

    so I removed it, and transitions worked like a charm... but when I went to log out, I got the above error even though my rake routes showed the existence of the path.

    The "fix" for me turned out to be adding //= require rails-ujs and re-arranging my tree somewhat, so I ended up with:

    //= require rails-ujs
    //= require jquery
    //= require jquery.turbolinks
    //= require twitter/bootstrap
    //= require masonry/jquery.masonry
    //= require masonry/jquery.imagesloaded.min
    //= require masonry/modernizr-transitions
    //= require turbolinks
    //= require_tree .
    

    As an aside, anyone that has found this error while working in masonry should also add "transitions-enabled infinite-scroll clearfix" to the div with the id of the resource of what they want to operate on... in my case "bookads"

    <% @books.each do |book| %>

    <%= book.title %>

    ... etc

    Note the id of the individual elements I used is called "box"

    In your coffeescript:

    $ ->
      $('#bookads').imagesLoaded ->
        $('#bookads').masonry
          itemSelector: '.box'
          isFitWidth: true
          isAnimated: true
    

    and to get "smooth" animation I also added masonry/jquery.imagesloaded.min and masonry/modernizr-transitions as shown in the tree above.

    Hopefully this answer will save someone the few hours I spent looking for a solution.

提交回复
热议问题