Ruby On Rails and more...
Wednesday, 14 October 2015
write a helper method to generate link_to with in li
application_helper.rb
def link url_path, class_name, title
content_tag :li do
link_to title, url_path, title: title, class: 'class_name'
end
end
usage:
in app.html.erb file:
<ul>
<%= link users_path, 'user', 'user' %>
</ul>
that's it....
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment