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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:33:07+00:00 2026-05-20T08:33:07+00:00

I will try to explain this in a different way so it makes more

  • 0

I will try to explain this in a different way so it makes more sense. In my system there are courses which are made up of steps. There are many types of steps: Video, Quiz, Text, Survey…etc. Each of these steps share common data such as title, summary, client, and position. But each step has a completely different model for its data. A quiz step has many different tables and fields where a Text step, really just has one extra field. Therefore I don’t think Single Table inheritance works.

But the problem comes when I want to view all the steps at once and display and edit link.

Since I have different controller for each step type, I don’t want to do something like this in my controller:

if @step.type=="Quiz"
   edit_step_quiz_path(@step.getSpecificStepObject())
elsif @step.type == "Text"
   edit_step_text_path(@step.getSpecificStepObject())
elsif @step.type=="Video"
   edit_step_video_path(@step.getSpecificStepObject())
end

Should I instead have my main “step” controller’s edit method do the logic and redirect to the appropriate location for editing so my view is clean?

  • 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-20T08:33:07+00:00Added an answer on May 20, 2026 at 8:33 am

    I’m assuming you meant that you are considering putting that code in your view, not your controller. I would define a helper method:

    def edit_step_path(step)
      send("edit_step_#{step.type.downcase}_path".to_sym, step.getSpecificStepObject)
    end

    Then you can just call edit_step_path(@step)

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

Sidebar

Related Questions

I'm going to try to explain this best I can I will provide more
Hmm. I found this which seems promising: http://sourceforge.net/projects/mjpg-streamer/ Ok. I will try to explain
This problem is a little different, so I will try my best to explain
sorry for asking this dumb question i will try to explain as good as
Okay, this scenario is a little complicated, but I will try to explain it
I will try to explain the situation as it is a little bit more
This will be a bit difficult to explain but I will try my best.
I am having difficulty to explain this problem, but I will try anyway. I
I will try to explain the problem that I have with this code. This
Ok I will try to explain this as much as possible. I have a

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.