Re: [Radiant] Re: Caching and Application/Site Controllers
So do you think it's possible to add the logic to a middleware object and add the middleware object to the stack? Actually... wouldn't that work as long as it was inserted before Rack::Cache? Can someone more familiar with the caching layer confirm/deny? On Oct 21, 2010, at 10:38 PM, Stan Rawrysz wrote: So do you think it's possible to add the logic to a middleware object and add the middleware object to the stack? Put something like the following in the extension? extension_config do |config| config.middleware.use GeoIpRedirect end I'm pretty new to middleware, so I'm not certain that this will get called every time... Stan On Thu, Oct 21, 2010 at 4:25 PM, swartz netv...@gmail.com wrote: As far as I understand if there is a cached page already available the radian sitecontroller doesn't even get executed. The server spits out the generated page. If you wish to have code executed everytime for every page access, you pretty much have to disable caching. If it's only afew specific pages that require this, you want to declare your own page type and define the following: def cache? false end On Oct 21, 2:53 pm, Stan Rawrysz smoo...@gmail.com wrote: I've written an extension that needs to do some processing on every call to a page in the cms. Basically, it checks for a cookie and redirects the user if a certain value is present. I'm running into a problem where that piece of code is not being called after the first call to the app. I believe it's because of caching... When i set cache_timeout to small, it works: SiteController.cache_timeout = 1.second The extension is a SiteController extension: def activate Page.class_eval { SiteController.send :include, IpRedirect::SiteControllerExt } end The controller: module SiteControllerExt def self.included(base) base.class_eval do base.send(:include, InstanceMethods) before_filter :lookup_preferred_language_and_redirect end module InstanceMethods def lookup_preferred_language_and_redirect end Is it possible that the before_filter is not called when caching is turned on? Is there a way to make sure that :lookup_preferred_language_and_redirect is called regardless of caching? I'm on 0.8.2 for this one. Thanks in advance! Stan
Re: [Radiant] Re: Caching and Application/Site Controllers
On Fri, Oct 22, 2010 at 9:18 AM, Josh French j...@digitalpulp.com wrote: So do you think it's possible to add the logic to a middleware object and add the middleware object to the stack? Actually... wouldn't that work as long as it was inserted before Rack::Cache? Can someone more familiar with the caching layer confirm/deny? Yes. As long as it's injected before the cache, you're golden. On Oct 21, 2010, at 10:38 PM, Stan Rawrysz wrote: So do you think it's possible to add the logic to a middleware object and add the middleware object to the stack? Put something like the following in the extension? extension_config do |config| config.middleware.use GeoIpRedirect end I'm pretty new to middleware, so I'm not certain that this will get called every time... Stan On Thu, Oct 21, 2010 at 4:25 PM, swartz netv...@gmail.com wrote: As far as I understand if there is a cached page already available the radian sitecontroller doesn't even get executed. The server spits out the generated page. If you wish to have code executed everytime for every page access, you pretty much have to disable caching. If it's only afew specific pages that require this, you want to declare your own page type and define the following: def cache? false end On Oct 21, 2:53 pm, Stan Rawrysz smoo...@gmail.com wrote: I've written an extension that needs to do some processing on every call to a page in the cms. Basically, it checks for a cookie and redirects the user if a certain value is present. I'm running into a problem where that piece of code is not being called after the first call to the app. I believe it's because of caching... When i set cache_timeout to small, it works: SiteController.cache_timeout = 1.second The extension is a SiteController extension: def activate Page.class_eval { SiteController.send :include, IpRedirect::SiteControllerExt } end The controller: module SiteControllerExt def self.included(base) base.class_eval do base.send(:include, InstanceMethods) before_filter :lookup_preferred_language_and_redirect end module InstanceMethods def lookup_preferred_language_and_redirect end Is it possible that the before_filter is not called when caching is turned on? Is there a way to make sure that :lookup_preferred_language_and_redirect is called regardless of caching? I'm on 0.8.2 for this one. Thanks in advance! Stan -- Jim Gay Saturn Flyer LLC http://www.saturnflyer.com 571-403-0338
Re: [Radiant] Quick question about updating extensions with git
On Tue, Oct 19, 2010 at 2:56 PM, Nate Turnage pixeln...@gmail.com wrote: Hey all, It's been a while since I've worked with Radiant and Git, and I now need to update a couple of apps to, at least, 0.8.2. So I was wondering if somebody could help me out by listing the command used to update an extension that was added as a git submodule? Also, how can I specify which branch/tag to use? off the top of my head (but hopefully close) cd vendor/extension/ext git fetch git checkout -b new_branch repo_branch_name cd ../.. rake radiant:extensions:ext:update rake radiant:extensions:ext:migrate git add vendor/extension/ext [other files] git commit -m 'update ext'
[Radiant] How to filter comments before they are published
I'm getting loads of comments...you can imagine the descriptions!! I can't keep up with deleting them. How do I create a filter so that I must approve comments before they can appear on my site? Thank you so much. -- Posted via http://www.ruby-forum.com/.
[Radiant] Re: How to filter comments before they are published
Jim Gay wrote in post #956414: I just added docs for this, but set Radiant::Config['comments.auto_approve'] = false and you'll need to approve each one. I'd like to make the standard spam-blocking a bit more robust in the future. = Thank you Jim. Where do I put this code? -- Posted via http://www.ruby-forum.com/.