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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:12:01+00:00 2026-05-20T23:12:01+00:00

I have a has_many, through association between videos and topics with topicables as the

  • 0

I have a has_many, through association between videos and topics with topicables as the independent resource. I want to have a link that deletes that specific topicable record aka the association and NOT the video NOR the topic.

I have this method in my topicables controller:

def destroy
  @topicable = Topicable.find(params[:id])
  @topicable.destroy
  respond_to do |format|
    format.html {redirect_to @video}
    format.js
  end
end

I call the above method with this link in my video show view:

<%= link_to "x", topicable_path(@topicable), :method => :delete, :class => 'topic_delete' %>

However, I get this error:

ActiveRecord::RecordNotFound in TopicablesController#destroy

Couldn't find Topicable with ID=474

This is because 474 is the id of the video and not the id of the association between the topic and video in the topicable table. What is wrong with my destroy method above and how can I fix it?

  • 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-20T23:12:02+00:00Added an answer on May 20, 2026 at 11:12 pm

    I’m not sure about that, i would have to test some things, but can you try this please :

    <%= link_to "x", @topicable, :method => :delete %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a has_many through association between videos and topics, with topicable being the
I have a has_many (through accounts) association between the model User and the model
I have a has_many :through association setup between two tables (Post and Category). The
I have a has_many through association setup between a song model and an artist
I have Product model and it has many categories with a has_many :through association
I have the following :has_many, :through association for my models: Group Model: has_many :group_users
Is it possible to have multiple has_many :through relationships that pass through each other
I have a basic has_many :through relationship that is bi-directional: calendars have many calendar_calendar_events
I have an Organization model that has_many users through affiliations. And, in the form
I have a has_many :through association, and I am iterating over the children 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.