我正在设置Amazon CloudFront以分发S3存储桶的内容,当我使用亚马逊给我的xxxxxxx.cloudfront.net时它可以正常工作.
但是,我想使用static.mydomain.com来访问我的文件.我已按照亚马逊的说明添加了从static.mydomain.com到xxxxxx.cloudfront.net的CNAME记录,并且我还在CloudFront分配属性中指定了CNAME(static.mydomain.com).
不过,我无法从static.mydomain.com访问我的文件.
我使用MediaTemple,static.mydomain.com只为我提供默认的MediaTemple服务器页面.当我请求static.mydomain.com/myfile.css时,它会给我'抱歉,无效请求'.
任何的想法?
我已将"Content-Encoding:gzip"标题添加到我的S3文件中,现在当我尝试访问它们时,它返回"错误330(net :: ERR_CONTENT_DECODING_FAILED)".
请注意,我的文件只是图像,js和css.
我该如何解决这个问题?
我有两个模型,我使用多态的has_many通过关联链接在一起,我想添加一个counter_cache但似乎Rails/ActiveRecord不支持开箱即用的这个功能.
class Classifiable < ActiveRecord::Base
has_many :classifications, :as => :classifiable, :foreign_key => :classifiable_id
end
class Taxonomy < ActiveRecord::Base
has_many :classifications, :as => :taxonomy, :foreign_key => :taxonomy_id
end
class Question < Classifiable
has_many :categories, :through => :classifications, :as => :classifiable, :source => :taxonomy, :source_type => "Category"
end
class Category < Taxonomy
has_many :questions, :through => :classifications, :source => :classifiable, :source_type => "Question"
end
class Classification < ActiveRecord::Base
attr_accessible :classifiable, :classifiable_id, :classifiable_type,
:taxonomy, :taxonomy_id, :taxonomy_type
belongs_to :classifiable, :polymorphic => true
belongs_to :taxonomy, …Run Code Online (Sandbox Code Playgroud) polymorphism activerecord ruby-on-rails has-many-through counter-cache