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

  • Home
  • SEARCH
  • 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 8854409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:52:26+00:00 2026-06-14T13:52:26+00:00

I have the Following Page Model Client Model Business Model There is No Relationship

  • 0

I have the Following

  • Page Model
  • Client Model
  • Business Model

There is No Relationship between any of these Models.

I would like to Have on the Show Template of the Page to have the Form_for’s

  • One for the Client
  • One for the Business

Is This Possible?

Current Have The Following:

<div id="sidebar">
    <%= form_for (@business) do |f| %>
     <div id="contact_form_name">
     <p>Company</p>
     <%= f.text_field :company_name, :class =>'form_input_small'  %>
     <%= f.submit 'Submit', :class => 'button' %>
    <% end %>
</div>

<div id="sidebar">
    <%= form_for (@client) do |f| %>
     <div id="contact_form_name">
     <p>First Name</p>
     <%= f.text_field :first_name, :class =>'form_input_small'  %>
     <%= f.submit 'Submit', :class => 'button' %>
    <% end %>
</div>

Error I am Getting in the Log is the following

 <div id="sidebar">
    78:                                 <%= form_for (@business) do |f| %>
    79:                                         <div id="contact_form_name">
    80:                                         <p>Company</p>
    81:                                         <%= f.text_field :company_name, :class =>'form_input_small'  %>
  app/views/pages/show.html.erb:78:in `_app_views_pages_show_html_erb___1556847543_65073939124600'
  app/controllers/pages_controller.rb:9:in `show'

Routes

 businesses GET    /businesses(.:format)                      {:action=>"index", :controller=>"businesses"}
                           POST   /businesses(.:format)                      {:action=>"create", :controller=>"businesses"}
              new_business GET    /businesses/new(.:format)                  {:action=>"new", :controller=>"businesses"}
             edit_business GET    /businesses/:id/edit(.:format)             {:action=>"edit", :controller=>"businesses"}
                  business GET    /businesses/:id(.:format)                  {:action=>"show", :controller=>"businesses"}
                           PUT    /businesses/:id(.:format)                  {:action=>"update", :controller=>"businesses"}
                           DELETE /businesses/:id(.:format)                  {:action=>"destroy", :controller=>"businesses"}
  • 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-14T13:52:28+00:00Added an answer on June 14, 2026 at 1:52 pm

    Rails doesn’t really care where you have your forms so long as you provide it with the necessary information, & there’s nothing that says you can’t mingle various models together into a single view.

    Assuming you’re making use of RESTful resources(as you should), you’ll have something like:

    resources :pages
    resources :companies
    resources :clients
    

    Setup in your routes.rb, this makes it pretty easy to specify how you want your form_fors to operate.

    For instance on your show action for your Page model you could have something like:

    <h1>New Company:</h1>
    <%= form_for @company, :url => companies_path do |f| %>
    ...
    <% end %> 
    
    <h1>New Client:</h1>
    <%= form_for @client, :url => clients_path do |f| %>
    ...
    <% end %>
    

    Make sure you’re setting the instance variables @company and @client in you pages controller show action like @company = Company.new & @client = Client.new.

    In both of these cases your forms will post to the create action of their respective models. You can check out relying on record identification for further reading.

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

Sidebar

Related Questions

I have the following models: User: hasOne Profile, Page hasMany Comment Comment: belongsTo User,
I have the following types and classes: namespace MVC.Models public class Page { public
I have the following page with a black canvas inside of it: There, the
I have the following script in between the head tags on my page: $.ajax({
I have the following def in the client model: def cli_full_name [f_name, mi, l_name].join('
Let's say I have the following model: class Contest: title = models.CharField( max_length =
Say I have the following in my models.py : class Company(models.Model): name = ...
I have the following page structure: <span>content01</span> <span>content02</span> <span>content03</span> <br/> <span>content04</span> <span>content05</span> <span>content06</span> <br/>
I have the following HTML page and the background color for the content is
I have the following Web page: link to page . If you go to

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.