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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:54:36+00:00 2026-05-26T11:54:36+00:00

I have 2 nested models: class Interstate include Mongoid::Document field :name, :type => String

  • 0

I have 2 nested models:

class Interstate
  include Mongoid::Document
  field :name, :type => String
  field :url, :type => String
  field :time_zone, :type => String
  embeds_many :roadmaps
end

class Roadmap
  include Mongoid::Document
  field :title, :type => String
  field :privacy, :type => Integer
  field :interstate_id, :type => Integer
  embedded_in :interstate, :inverse_of => :roadmaps
end

I’m not sure about the difference between has_many|belongs_to and embeds_many|embedded_in, but according to documentations last is better for me, anyway both doesn’t work. Also I have nested resources:

 resources :interstates do
   resources :roadmaps
 end

And Error appears when I’m trying to create Roadmap in Interstate.

Roadmap controller is standard scaffold with before_filter method for Interstate defining:

 private
 def get_interstate
   @interstate = Interstate.find(params[:interstate_id])
 end

In case with embeds_many :roadmaps and embedded_in :interstate other error occurs:

NoMethodError in Roadmaps#new

Showing /home/alder/RubymineProjects/interstate/app/views/roadmaps/_form.html.haml where line #1 raised:

undefined method `delete' for :format:Symbol

Extracted source (around line #1):

1: = simple_form_for(@interstate, @roadmap) do |f|
2:   = f.error_notification
3: 
4:   .inputs

Trace of template inclusion: app/views/roadmaps/new.html.haml

Rails.root: /home/alder/RubymineProjects/interstate
Application Trace | Framework Trace | Full Trace

app/views/roadmaps/_form.html.haml:1:in `_app_views_roadmaps__form_html_haml___160176716082020505_38930380'
app/views/roadmaps/new.html.haml:3:in `_app_views_roadmaps_new_html_haml__4577296702858298215_34853620'
app/controllers/roadmaps_controller.rb:31:in `new'

Console:

undefined method `delete' for :format:Symbol (ActionView::Template::Error)
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/mongoid-2.3.2/lib/mongoid/persistence/operations.rb:80:in `notifying_parent?'                                                                                 
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/mongoid-2.3.2/lib/mongoid/persistence/operations/embedded/remove.rb:30:in `block in persist'                                                                  
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/mongoid-2.3.2/lib/mongoid/persistence/deletion.rb:23:in `prepare'                                                                                             
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/mongoid-2.3.2/lib/mongoid/persistence/operations/embedded/remove.rb:29:in `persist'                                                                           
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/mongoid-2.3.2/lib/mongoid/persistence.rb:56:in `remove'                                                                                                       
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/actionpack-3.1.1/lib/action_view/helpers/form_helper.rb:392:in `apply_form_for_options!'                                                                      
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/actionpack-3.1.1/lib/action_view/helpers/form_helper.rb:365:in `form_for'

Full stack

So, maybe I should add some options to cancel notifying, but more intresting why format is Symbol, I guess it should be Some Model Object. Perhaps @interstate is not the model.

This code works with sqlite db correctly.

  • 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-26T11:54:36+00:00Added an answer on May 26, 2026 at 11:54 am

    The issue was in round brackets instead of squared.

    simple_form_for [@interstate, @roadmap]

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

Sidebar

Related Questions

I have such models: Class User has_many :comments # have field 'name' in DB
I have a nested form with the following models: class Incident < ActiveRecord::Base has_many
I have theses models: class Year(models.Model): name = models.CharField(max_length=15) date = models.DateField() class Period(models.Model):
I have some nested attributes in some models as such: class Employee < ActiveRecord::Base
I have two models nested with accepts_nested_attributes_for : class Place < ActiveRecord::Base # Relations..
I have some nested models that look something like: class Company has_many :managers end
I have a model with nested attributes : class Foo < ActiveRecord::Base has_many :bar
So far I have encountered adjacency list, nested sets and nested intervals as models
Is it possible for a model to belong_to, two models and have a nested
I've been following RailsCast 197 to try this nested models/forms and have cracked my

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.