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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:03:06+00:00 2026-06-13T18:03:06+00:00

Consider these simple, Reminder & event models: class Event < ActiveRecord::Base has_many :reminders end

  • 0

Consider these simple, Reminder & event models:

class Event < ActiveRecord::Base
  has_many :reminders
end


class Reminder < ActiveRecord::Base
  belongs_to :event
  accepts_nested_attributes_for :event
end

now, I have build reminders/new.html.haml view in following way:

%h2 Reminders
= form_for(@reminder, html: {class: "form-horizontal"}) do |f|
  = f.fields_for :event do |event|
    = event.collection_select :id, Event.all, :id, :name
  = f.text_field(:issue_date, class: "datepicker", data: {"date-format" =>"dd/mm/yyyy"}, 'date' => "#{Time.new.strftime("%d/%m/%Y")}")
  = f.text_field(:renewal_date, label:"Due Date", class: "datepicker", data: {'date-format' => 'dd/mm/yyyy', 'date' => "#{Time.new.strftime("%d/%m/%Y")}"})
  = f.submit

This view doesn’t throw any errors & reminders minus the <options> tag.
View http://screencloud.net/img/screenshots/f990e124f356330a10839b00cd92f75a.png

What I want to do is to display Event.name in the <options>. So what am I missing here?

[Update]
Changed to form_for & it generates following html markup

<form method="post" id="new_reminder" class="form-horizontal" action="/reminders" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="Yu7Qj4SW+GAMXx9dEL/ohjsqryEkxUXXGy+SHpN97hc=" name="authenticity_token"></div>

                <input type="text" size="30" name="reminder[issue_date]" id="reminder_issue_date" date="20/09/2012" data-date-format="dd/mm/yyyy" class="datepicker">
                <input type="text" size="30" name="reminder[renewal_date]" label="Due Date" id="reminder_renewal_date" data-date="20/09/2012" data-date-format="dd/mm/yyyy" class="datepicker">
                <input type="submit" value="Create Reminder" name="commit">
              </form>

as you may notice <option> tag is missing for some reason.

  • 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-13T18:03:07+00:00Added an answer on June 13, 2026 at 6:03 pm

    I was doing it wrong, this solution doesn’t require accepts_nested_attributes_for. removed it & problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider these pseudo models: class BaseProduct: quantity_available = Integer class Box(BaseProduct): items_in_box = Integer
Consider this simple class: template<class T> class Foo{ public: Foo(T const& val) : _val(val)
To give an idea of my requirement, consider these classes - class A {
Consider these simple CSS rules: jsFiddle div#container { width: 50%; height: 260px; background-image: url('Image.png');
Consider these two classes: class A(object): name = A class B(A): name = Child
Consider this simple class: package net.zomis.test; public class Test { public Test() { }
Consider a simple POJO Java Object: class MyObj { String a, b; Integer c;
So here I am with this simple question Consider these two for cycles and
consider this simple code {$APPTYPE CONSOLE} uses Rtti, SysUtils; type {$M+} TFoo = class
Consider this simple Model and ViewModel scenario: public class SomeModel { public virtual Company

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.