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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:32:07+00:00 2026-05-29T10:32:07+00:00

I’m using ActiveAdmin (0.4.0) with Rails (3.1.1). I can’t find a nice way/hack to

  • 0

I’m using ActiveAdmin (0.4.0) with Rails (3.1.1).

I can’t find a nice way/hack to handle multiple nested resources.

Considerer 3 models as:

class Program < ActiveRecord::Base
  has_many :knowledges, :dependent => :destroy
end

class Knowledge < ActiveRecord::Base
  belongs_to :program
  has_many :steps, :dependent => :destroy
end

class Step < ActiveRecord::Base
  belongs_to :knowledge
end

And the ActiveAdmin resources:

ActiveAdmin.register Program do
end

ActiveAdmin.register Knowledge do
  belongs_to :program
end

ActiveAdmin.register Step do
  belongs_to :knowledge
end

In routes.rb:

namespace :admin do
  resources :programs do
    resources :knowledges do
      resources :steps
    end
  end
end

Here’s the urls for the index of the programs, the knowledges and the steps :
http://localhost:3000/admin/programs
http://localhost:3000/admin/programs/1/knowledges
http://localhost:3000/admin/programs/1/knowledges/1/steps

No problem for the “Knowledge” admin but the “Step” admin don’t keep the nested context.

For example, when I use filters in steps#index I’m redirected to:
http://localhost:3000/admin/knowledges/1/steps?params…
But it must have been:
http://localhost:3000/admin/programs/1/knowledges/1/steps?params…

Same problem when I create a new resource:
http://localhost:3000/admin/knowledges/1/steps/new
Instead of:
http://localhost:3000/admin/programs/1/knowledges/1/steps/new

Same problem with the breadcrumb… etc…

What I’ve tried so far in app/admin/steps.rb:

ActiveAdmin.register Step do

  belongs_to :knowledge

  config.clear_action_items!
  action_item :only => :index do
    link_to('Create Step', new_admin_program_knowledge_step_path(knowledge.program.id, knowledge.id))
  end

  index do
    column :id
    column :knowledge
    column :title
    column "Actions" do |step|
      link_to("Voir", admin_program_knowledge_step_path(step.knowledge.program, step.knowledge, step), :class => "member_link show_link") +\
      link_to("Editer", edit_admin_program_knowledge_step_path(step.knowledge.program, step.knowledge, step), :class => "edit_knowledge member_link edit_link", :id => "knowledge_#{dom_id(knowledge)}") +\
      link_to("Supprimer", admin_program_knowledge_step_path(step.knowledge.program, step.knowledge, step), :class => "member_link delete_link", :method => :delete, :confirm => "Delete?")
    end
  end

  filter :id
  filter :title
  filter :subtitle
  filter :stage_type
  filter :order_by
  filter :created_at
  filter :updated_at

  form :partial => "form"

end

And in app/views/admin/steps/_form.html.erb I must use the activeadmin formbuilder:

<%= semantic_form_for(resource, :url => admin_program_knowledge_steps_path(resource.knowledge.program, resource.knowledge), :builder => ActiveAdmin::FormBuilder) do |f|
  f.inputs "Step" do
    f.input :knowledge, :as => :hidden
    f.form_buffers.last << f.template.content_tag(:li, f.template.content_tag(:label, "Knowledge")+f.template.content_tag(:p, f.object.knowledge.title))
    f.input :title
    f.input :order_by
  end
  f.buttons
end %>

Well… I’m stuck.

How to handle this nicely? Any clues appreciated…

  • 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-29T10:32:08+00:00Added an answer on May 29, 2026 at 10:32 am

    Well, the solution is pretty simple…
    https://github.com/josevalim/inherited_resources

    ActiveAdmin.register Step do
      controller do
        nested_belongs_to :program, :knowledge
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.