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 7158873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:08:17+00:00 2026-05-28T13:08:17+00:00

I have following controller: def personalization @title = t generic.forms.personalization end def update_personalization begin

  • 0

I have following controller:

  def personalization
    @title = t "generic.forms.personalization"
  end

  def update_personalization
    begin
      @user.user_data.birthdate = Date.civil(params[:user_data][:"birthdate(1i)"].to_i,params[:user_data][:"birthdate(2i)"].to_i,params[:user_data][:"birthdate(3i)"].to_i)
    rescue
      wrong_data = 1
    end
    if @user.user_data.update_attributes(params[:user_data])
      if wrong_data
        flash[:Error] = t "generic.messages.error.wrong_data"
        redirect_to :back and return
      end
      flash[:Success] = t "generic.messages.success.account_updated"
      redirect_to :back
    else
      flash[:Error] = @user.user_data.errors.full_messages.join(".<br>")
      redirect_to :back
    end
  end

and following view:

<div id="ProfileEditForm" class="ContentBorders">

  <h1 class="FormsHeading"><%= t @title %></h1>
  <div class="FormsSpacing">

  <%= form_for(@user.user_data, :html => { :id => "UpdateUserForm", :class => "EditForms"}, :url => {:action => 'update_personalization'}) do |f| %>
  <% flash.each do |key, value| %>
    <div class="FormsMargins <%= key %>"><%=raw value + "." %></div>
  <% end %>

      <div class="Field"><div class="LabelInline"><%= t "generic.site.first_name" %>:</div>
      <%= f.text_field :first_name, :id => "EditFirstName", :class => "Rounded5", :maxlength => "30" %></div>

      <div class="Field"><div class="LabelInline"><%= t "generic.site.last_name" %>:</div>
      <%= f.text_field :last_name, :id => "EditLastName", :class => "Rounded5", :maxlength => "30" %></div>

      <div class="Field DateSelection"><div class="LabelInline"><%= t "generic.site.birthdate" %>:</div>
        <%= date_select("user_data", "birthdate", :start_year => 1901, :end_year => 2011, :include_blank => true) %>
      </div>

      <div class="Field GenderSelection"><div class="LabelInline"><%= t "generic.site.gender" %>:</div>
        <%= f.radio_button :gender, "0", :id => "EditGenderMale" %> <span><%= t "generic.site.male" %></span>
        <%= f.radio_button :gender, "1", :id => "EditGenderFemale" %> <span><%= t "generic.site.female" %></span>
      </div>

      <div class="Field EducationSelection"><div class="LabelInline"><%= t "generic.site.educational_level" %>:</div>
        <%= f.select :education_level, options_for_select({
          " " => 0, (t "generic.site.education_levels.first") => 1, (t "generic.site.education_levels.second") => 2,
          (t "generic.site.education_levels.third") => 3, (t "generic.site.education_levels.fourth") => 4,
          (t "generic.site.education_levels.fifth") => 5, (t "generic.site.education_levels.sixth") => 6,
          (t "generic.site.education_levels.seventh") => 7 }, @user.user_data.education_level) %>
      </div>

      <div class="Action"><%= f.submit (t "generic.forms.update_data"), :id => "EditSubmit", :class => "ProfileEditAction Shadow1 Rounded5 AcceptButtonsBorder" %></div>

  <% end %>

  </div>

</div>
<%= render :partial => 'profile_panel' %>

Now. The problem is with date_select method. Each of form field works properly (data from database fills them up), except that which was generated from data_select.

If I select some proper data, and click update button, then it saves that proper data to the db. Problem comes with the moment, when it is generated, and it doesn’t come with any values (it’s always empty when loaded).

Any ideas, how can that be fixed?

  • 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-05-28T13:08:18+00:00Added an answer on May 28, 2026 at 1:08 pm

    maybe…

    you have:

    <%= date_select("user_data", "birthdate", :start_year => 1901, :end_year => 2011, :include_blank => true) %>
    

    you need:

    <%= f.date_select("user_data", "birthdate", :start_year => 1901, :end_year => 2011, :include_blank => true) %>
    

    just put the “f”

    <%= f.date_select ... 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following methods in my controller: def create @user = User.new(params[:user]) if
I have the following: In my controller: def gettingstarted @title = Getting Started respond_to
In my messages_controller I have the following private method: def find_message_or_404(slug) message = user.messages.find_by_slug(slug)
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it
I have a rails code that sends emails. Following is in my controller: def
I have the following code in a view: def controller_details(request, object_id): controller = Controller.objects.get(pk=object_id)
(rails 2.3) I have the following actions in the controller: def new @entity =
I have the following controller code: def calculate_quote @mouldings = Moulding.find( params[:id].split(,), :select =>
Hello I have the following in my Create Controller: def create @requestable = find_requestable
I have the following controller: class FirstController < ApplicationController helper_method :contoller_method private def contoller_method

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.