HTML in url to on Rails -


i want have link html content in rails 5 it's seems code doesn't work:

<%= link_to "<i class="fa fa-dashboard"></i> <span>dashboard</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span>".html_safe, admin %> 

i've got syntaxerror in admin::indexcontroller#index want go admin/index controller index action...

thanks.

if can't make route helpers work, use explicit url_for syntax instead. can pass block put html in links more easily:

<%= link_to url_for(:controller => 'admin/index', :action => :index) %>   <i class="fa fa-dashboard"></i> <span>dashboard</span>   <span class="pull-right-container">     <i class="fa fa-angle-left pull-right"></i>   </span> <% end %> 

running rake routes (or rails routes, rails 5) show route helpers have available, , identify 1 need. aware helper listed helper prefix, not entire helper name - add _path complete method name. in case, means helper admin_path, not admin.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -