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

The Archive Base Latest Questions

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

My application is using a namespace for administrative purposes. I recently tried to start

  • 0

My application is using a namespace for administrative purposes. I recently tried to start using action caching however I ran into some problems trying to expire the cache using expire_action. Basically I have a index action in my default namespace newsposts controller that is cached using action caching like this:

class NewspostsController < ApplicationController

  caches_action :index, :layout => false

  def index
    @posts = Newspost.includes(:author).order("created_at DESC").limit(5)
  end

end

This caches the view under views/host/newsposts.

The default namespace has no actions for modifying data, they are all in my admin namespace. In my Admin::NewspostsController I am trying to expire this cache in the create action like this:

expire_action(:controller => 'newsposts', :action => 'index')

however this will expire a cache file located under views/host/admin/newsposts. Obviously it can not work since im in the admin namespace and rails is (rightfully) looking to expire cache for this namespace. Sadly I can not pass a namespace parameter to the axpire_action method, so how can i expire the action cache in another namespace?

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

    after some more digging I finally found the solution. It’s a bit hinted in the url_for method:

    In particular, a leading slash ensures no namespace is assumed. Thus, while url_for :controller => ‘users’ may resolve to Admin::UsersController if the current controller lives under that module, url_for :controller => ‘/users’ ensures you link to ::UsersController no matter what.

    So basically,

    expire_action(:controller => '/newsposts', :action => 'index')
    

    Will expire in the default namespace, and

    expire_action(:controller => 'admin/newsposts', :action => 'index')
    

    in the admin namespace (when in default).

    RailsCast

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

Sidebar

Related Questions

I'd like to add caching capabilities to my application using the System.Runtime.Caching namespace, and
I tried using the boost deadline_timer in this simple test application, but had some
Whenever I specify a resource using the Spring Data Hadoop namespace, by application throws
I tried using this code in this thread: How can I uninstall an application
I am embedding a C# script engine into my application using Roslyn and so
I am developing an application using Symfony2 and DQL for building some queries in
I'm currently writing an application, which communicates with another application using boost::interprocess . However
I can't include Microsoft.Security.Application using Microsoft.Security.Application; Gives this error: The type or namespace name
Consider this simple console application: using System; namespace Demo { class Program { static
In the application where the complete code is #include <iostream> #include <string> using namespace

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.