I have this code in my html.erb at many places.
<div id="left-nav">
<%= render :partial => 'tests/tests_left_menu' %>
</div>
Is it a good idea to create helper method for this type of code ?
How to write this code in helper ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I see a few good strategies to use in your situation. Pick and choose based on your project’s specific requirements.
div#left-navand its contents into yet another partial liketests/tests_left_menu_with_wrapper. This saves you a couple of lines.ActionController::Base.layoutmethod, you’ll be able to skip writing the entire segment altogether.content_tag. You’re probably better off using partials or layouts.