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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:00:52+00:00 2026-05-19T22:00:52+00:00

If I have Table A with columns title and description , and I want

  • 0

If I have Table A with columns title and description, and I want to create a record in Table B, which also has a title and description column, is there a way to pass that information to new_b_path such that the /views/b/_form.html.erb populates with the data from the A record?

I am using the below code to clone a workout but this is acting within Table A so to speak. I want to clone across tables. Any ideas?

workouts_controller.rb

...
  def new
    @workout_count = Workout.count
    if params[:cloned_workout]
        workout_to_clone = Workout.find params[:cloned_workout]
        @workout = workout_to_clone.clone
      else
    @workout = current_user.workouts.new 
  end
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @workout }
    end
  end
...

/views/workouts/show.html.erb

<%= link_to "Clone Workout", new_workout_url + "?cloned_workout=#{@workout.id}", :class => "float-right" %>
  • 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-19T22:00:52+00:00Added an answer on May 19, 2026 at 10:00 pm

    Hmm. Judging by your explanation it sounds like a better strategy might be to simply create a table called Recommended with two belongs_to relationships that just has a workout_id and user_id column. Then you can associate the recommendation to a user and the workout. You could also have a gym_id or trainer_id column for the gym or trainer that made the recommendation. Make sense?

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

Sidebar

Related Questions

I have the following tables: Category table which has an ID column, a description
If I have a table with a title column and 3 bit columns (f1,
I have a table with the following columns id parent_id title description weight every
I already have a table with 3 column (Id bigint, Title nvarchar(450), Description nvarchar(MAX))
Imagine I have a Table full of Cars, with Columns Id,Title and Description. These
Let's say I have a table tbl with columns id and title . I
i have this three tables. Table: Item Columns: ItemID, Title, Content, NoChange (Date) Table:
As title, how can I set a table's column to have the default value
I have table with 3 columns A B C. I want to select *
I have following tables in my database: SuggestionsLog Table: ID, Title, Description. Employee Table:

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.