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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:25:46+00:00 2026-06-14T14:25:46+00:00

I have a recommendation that is nested below Categories and Awards. So Category/:id/awards/:id/recommendations/:id I

  • 0

I have a recommendation that is nested below Categories and Awards.

So Category/:id/awards/:id/recommendations/:id

I have an Assets model that handles paperclip attachments to the Recommendation. A Recommendation has_many Assets, Assets belong_to :recommendation

In my Recommendation new/edit views I am rendering a form partial (as is normal) that gives the user the option to upload several assets.

If there are Assets already related, then it lists them. I am working on setting up a custom delete action on the recommendations controller.

My current link_to:

<%= link_to "Delete Attachment", 
                {:controller => :recommendations, :action => :destroy_asset, :id => asset.id }, 
                {:remote => "true", :confirm => "Are you sure you want to delete this image?"} 
         %>

My Controller action:

def destroy_asset
    #@recommendation = Recommendation.find(params[:id])
    @asset = Asset.find(params[:id])
    @asset.destroy
    respond_to do |format|
      format.js
    end
  end 

routes:
resources :recommendations
resources :categories do
resources :awards do
resources :recommendations
end
end

I am still learning remote => true, and how to route this sucker. Not sure if I need to have the route nested or not. I tend to think not. Since I have an Asset.id in my loop, I should just be able to execute the destroy without needing the Recommendation at all.

So the question/s: do I need a route to access a custom action in my recommendations_controller?
thanks

  • 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-14T14:25:47+00:00Added an answer on June 14, 2026 at 2:25 pm

    Try this:

    resources :categories do
        resources :awards do
            resources :recommendations 
               member do
                  get :destroy_asset
               end
            end
        end 
    end
    

    Or If you only want only destroy_asset action under recommendation controller, do something like this :

    resources :recommendations 
        member do
            get :destroy_asset
        end
    end
    

    Or If you want custom match, do something like this :

    match "asset/:id/destroy_asset", :to => "recommendations#destroy_asset", 
    :as=> "destroy_asset"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any recommendations for tools that you can add to Eclipse, Netbeans
Does anyone have any recommendations for applications or browser plugins that make browsing and
I've seen recommendations (Juval Lowy, et al) that a service contract should have no
Does anyone have any recommendation on a simple but effective method of confirming that
Does anyone have a recommendation for an excellent reference on Microsoft's ReportViewer (VS 2008
Anyone have good book / article recommendation for procedural generation of background music? (No
Anyone have recommendations for a good C editor for Windows? Any improvement over the
Does anyone have recommendations on the best Online Store for non-technical users of Joomla?
Does anyone have any recommendations of resources for learning ASP.NET specifically? I have a
I am starting to test Haskell for linear algebra. Does anyone have any recommendations

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.