Home link_to_if throwing an error
Reply: 0

link_to_if throwing an error

user616 Published in May 21, 2018, 10:48 pm

Im trying to fathom out link_to_if,

While calling:

<%= link_to_if(!current_user.nil?, "My profile", profile_path(current_user.profile)) %> <br>
<%= link_to_if(!current_user.nil?, "Edit profile", edit_profile_path(current_user.id) {}) %> <br>

Its throwing this error.

undefined method `profile' for nil:NilClass

of course because i have logged out but shouldn't the link_to_if stop profile_path(current_user.profile) from being called or i have i implemented it incorrectly?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.245714 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO