Sha256: 5b4cd9c11b606dbe76e151e6728e27ac80e0500a8f7b534a5680297972542cf9
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require "yaml" require "logger" require "active_record" dbconfig = YAML.load_file(File.expand_path("../../config/database.yml", __FILE__))["development"] logger = Logger.new("log/development.log") ActiveRecord::Base.establish_connection dbconfig ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.default_timezone = :local ActiveRecord::Base.logger = logger CachedRecord.setup :redis Redis.new.flushdb class Article < ActiveRecord::Base belongs_to :author, :class_name => "User" has_many :comments has_and_belongs_to_many :tags as_memoized_cache :only => [:title], :include => [:author, :comments, :tags], :expire => 20.seconds end class User < ActiveRecord::Base has_one :foo, :class_name => "Article", :foreign_key => "foo_id" as_memoized_cache :only => [:name], :include => [:foo] end class Comment < ActiveRecord::Base belongs_to :article belongs_to :poster, :class_name => "User" as_memoized_cache :only => [:content], :include => [:poster] end class Tag < ActiveRecord::Base has_and_belongs_to_many :articles as_memoized_cache :only => [:name] end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cached_record-0.1.1 | script/setup.rb |
cached_record-0.1.0 | script/setup.rb |