require file in rails environment

There are different ways to load particular file in rails application environment if the required file exists. 1. Using RAILS_ROOT if File.exists?(file=File.join(RAILS_ROOT,'config', 'initializers', 'smtp_gmail.rb')) require file end 2. Using Rails.root & join require Rails.root.join('config', 'initializers', 'smtp_gmail.rb') 3. Using Rails.root, join & exists? method. if File.exists?(file = Rails.root.join('config', 'initializers','smtp_gmail.rb')) require file end 4. Using File and … Continue reading require file in rails environment

Page Cache control in radiant cms

Radiant CachingRadiant cms is very powerful and customizable cms as of now which has inbuilt support for page caching.Radiant caching mechanisam is somehow similar to action caching in rails.In latest radiant version i.e. > 0.8 Responsecache has been replaced with Radiant::Cache.By default radiant cache gets automatically invalidated after every 5 minutes and that is configurable.The interval is easily … Continue reading Page Cache control in radiant cms

Fix/Solution for NoMethodError? (undefined method `controller_name’ for nil:NilClass)

This error appears when same action gets called twice. There might be chances to have controller with same name twice inside app as well as pluginsIn my case the error appeared while migrating from rails 2.1 to 2.3.Application was having application.rb and application_controller.rbFiles deleted:trunk/app/controllers/application.rbAnd that solved problem !