1

I'm working on a rails app that uses devise.

I added other models to the app and the links in those new views (default "link_to") are not working. For example, I scaffolded a new model and the links for those views do not change the URL (hard coding in the actual url in the address bar works fine and renders the correct view - the actions even work when adding, editing, deleting data).

I've checked my link_to code - they are set up correctly. Even linking to another site like google.com does not work. When hovering over the link, the correct url shows in the bottom left of the screen, but it does not change the address bar url after clicking.

Does anyone have any idea what may be causing this? It is driving me crazy! Any help is much appreciated!

EDIT: adding some code for illustrate:

link_to example from navigation partial under layouts:

<%= link_to 'Home', root_path %>

routes.rb:

Example::Application.routes.draw do

resources :topics

resources :tutorials

resources :packages

get "/index" => "home#index", :as=>"index"

authenticated :user do
 root :to => 'home#index'
end

devise_scope :user do
 root :to => "home#index"
end

devise_for :users, :controllers => { :registrations => "registrations" }

resources :users do
 get 'invite', :on => :member
end

end
pvskisteak5
  • 4,162
  • 3
  • 24
  • 26
  • 1
    some code would be helpful. what is the link html rendered by the view? can I see an example of how you are using `link_to` in your view? – dward Jan 31 '13 at 20:40
  • 2
    are you sure you dont have any js that blocking your links? This seems more client side issue since you can see link url in bottom of browser – sanny Sin Jan 31 '13 at 20:50
  • That very well could be it but I can't figure out how to troubleshoot - I am using pagescroller (http://pagescroller.com/) for my homepage, which adds js for singe page scrolling to sections. Links that go to a different view from the home page are working just fine, though. Any thoughts? – pvskisteak5 Jan 31 '13 at 20:55
  • 1
    you could find out by letting the page render in a browser and checking if the link tag looks to be in order, something like: `Hello!`. Please give us the html that is rendered by the view so we can decide whether the problem is with the js or internal to framework. – dward Jan 31 '13 at 21:13
  • @sanny Sin - you solved it. The js from pagescroller was causing the problem. Added simple if logic on the application layout to test if on home#index, if so enable js, if not do nothing. THANKS! – pvskisteak5 Jan 31 '13 at 21:20

1 Answers1

1

Thanks for the guidance sanny Sin - upvoted your comment.

Problem was with pagescroller js - had to add an if statement to the application layout to use the js if current_page was home#index, otherwise do not use the script.

pvskisteak5
  • 4,162
  • 3
  • 24
  • 26