我的应用程序使用 Rails 4.0.0。我有patcial模型users_posts
:
class UsersPost < ActiveRecord::Base
attr_accessible :post_id, :user_id, :example
belongs_to :post, touch: true
和posts
:
class Post < ActiveRecord::Base
has_many :users_posts
这是 users_post 视图:
-cache users_post do
.box.col2
p.center
=status_post_vk(users_post)
=status_post_fb(users_post)
p = check_box_tag "posts_ids[]", users_post.id
p = best_in_place users_post.post, :text, type: :textarea
p = raw users_post.post_url_small.map{|url| image_tag 'http://bla.com/'+url}.join()
p
= link_to 'Show', users_post
= link_to 'Edit', edit_users_post_path(users_post)
= link_to 'Destroy', users_post, data: { confirm: 'Text' }, :method => :delete
当我更改帖子的文本(更新数据库中的属性文本)时,如何使缓存密钥过期best_in_place users_post.post, :text, type: :textarea
?