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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:42:15+00:00 2026-06-09T22:42:15+00:00

I have a model called local this model has many portales like this: class

  • 0

I have a model called local this model has many portales like this:

class Portal < ActiveRecord::Base
    belongs_to :local, :class_name => "Local"   
end

class Local < ActiveRecord::Base
    has_many :portales, :class_name => "Portal", :dependent => :destroy
    accepts_nested_attributes_for :portales, :allow_destroy => true
end

The problem is when i assign the params to a local, the console shows:

NoMethodError Exception: undefined method `portal' for #<Local:0x007f9cd50a7f20>

Here are my controller and my form:

Controller:

def new_portal
    @local = Local.new
    if request.post?
        @local.update_attributes params[:local]
    end
end

Form:

<%= form_for @local, :url => {:action => 'new_portal'}, :html => {:id => 'formulario_local', :multipart => true, :method => 'post'} do |f| %>
    <%= f.fields_for :portal do |portal_form| -%>
      <div id="porcentaje_barra">
        <%= portal_form.select 'opacidad_barra', generate_options_from_hash(@porcentaje_opacidad) %>
      </div>
      <div id="texto_barra">
        <%= image_tag 'editor/texto.png', :size => '30x30'%>
        <h5>Texto</h5>
      </div>
      <div id="tipo_de_letra_barra">
        <%= portal_form.select 'tipo_letra_barra', generate_options_from_hash(@tipos_de_letra),:prompt => 'Selecciona' %>
      </div>
      <div id="estilo_fuente_barra">
        <%= portal_form.select 'estilo_letra_barra', generate_options_from_hash(@estilo_de_letra), style: 'width:70px'%>
      </div>
      <div id="tam_fuente_barra">
        <%= portal_form.select 'tamano_letra_barra', generate_options_from_hash(@tamano_de_letra), style: 'width:50px'%>
      </div>
    <% end %>
<% end %>

And, here goes my inflections:

ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'usuario', 'usuarios'
inflect.irregular 'producto', 'productos'
inflect.irregular 'portal', 'portales'
inflect.irregular 'local', 'locales'
end

I don’t know what is the problem, the view show all the form.

Thanks for your help (and sorry for my English),

Jorge–

  • 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-09T22:42:17+00:00Added an answer on June 9, 2026 at 10:42 pm

    First,

    <%= f.fields_for :portal do |portal_form| -%>
    

    to

    <%= f.fields_for :portales do |portal_form| -%>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model called Event and another called Product. An event has many
I have a model called Contact which has_one guest like so. class Contact <
I have a model called company that has_many users then users belongs_to company. class
I have a model called Person. I want User to inherit from Person. class
I have a model called Answer which has a ForeignKey relationship to another model
I have a model called Customer in google app engine with python: class Customer(db.Model):
I have model called test, and test can have many tests, and should be
I have model called User with a has_many relationship to UserFilter . UserFilter has
I have a activerecord model called game with an paperclip attachment called image. I
Is there some magic in Symfony/doctrine with a model called JosVmOrderHistory? I have this

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.