Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9254935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:35:51+00:00 2026-06-18T11:35:51+00:00

I have an html.erb file that does not render anything when the following is

  • 0

I have an html.erb file that does not render anything when the following is used:

<% form_for :profile do |form| %>

when this is used (note the “=” sign):

<%= form_for :profile do |form| %>

this is the output of the html:

web page

Partial html code:

<%= form_for :profile do |form| %>

<%= text_field_for form, "first_name" %>
<%= text_field_for form, "last_name" %>
<div class="form_row">
    <label for="gender">Gender:</label>
    <%= radio_button :profile, :gender, "Male" %> Male
    <%= radio_button :profile, :gender, "Female" %> Female
</div>
<div class="form_row">
    <label for="birthdate">Birthdate:</label>
    <%= date_select :profile, :birthdate,
                    :start_year => Profile::START_YEAR,
                    :end_year => Time.now.year,
                    :include_blank => true,
                    :order => [:month, :day, :year] %>
</div>

Form_for definition:

def text_field_for(form, field,
                  size=HTML_TEXT_FIELD_SIZE,
                  maxlength=DB_STRING_MAX_LENGTH)
 label = content_tag("label", "#{field.humanize}:", :for => field)
 form_field = form.text_field field, :size => size, :maxlength => maxlength
 content_tag("div", "#{label} #{form_field}", :class => "form_row")
end    

Part of controller:

def edit
 @user = current_user
 @user.profile ||= Profile.new
 @profile = @user.profile
 if param_posted?(:profile)
   if @user.profile.update_attributes(params[:profile])
    flash[:notice] = "Changes saved."
    redirect_to :controller => "users", :action => "index"
   end
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:35:52+00:00Added an answer on June 18, 2026 at 11:35 am

    In your text_field_for helper you need to declare that the string passed as the content of your DIV tag generated by your helper is safe, and thus should not be sanitized. This is done with html_safe.

    def text_field_for(form, field,
      size =HTML_TEXT_FIELD_SIZE,
      maxlength =DB_STRING_MAX_LENGTH)
      label = content_tag("label", "#{field.humanize}:", :for => field)
      form_field = form.text_field field, :size => size, :maxlength => maxlength
      content_tag("div", "#{label} #{form_field}".html_safe, :class => "form_row")
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .js.erb file that has the following line $(#<%= user#{current_user.id}_following %>).html(<%= escape_javascript(link_to(pluralize(@count,'tag'),
I have the following code in my .html.erb file that work just as expected:
I have this code to render a file into another file: $(#edit_topics_link).click(function(e){ e.preventDefault(); $(.topic_form).load(/topic_form.html.erb);
I have the following in a html.erb file: <%= @location_list = [['test',2]] %> <script
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have a class in a .html.erb view file that I want to give
I have the following code in my html.erb file in my ROR application. <%
I have a html.erb file where I have html code. I inserted this piece
In my Ruby on Rails code, I have the following edit.html.erb file for tasks:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.