Rails 关于 push 提醒功能

stephen · 2012年01月12日 · 最后由 huacnlee 回复于 2012年02月04日 · 2575 次阅读

准备实现这个功能,现在在研究 ruby-china 的相关代码

def link_mention_user(text, mentioned_user_logins)   
  return text if mentioned_user_logins.blank?    
  source = String.new(text.to_s)    
  source.gsub!(/@(#{mentioned_user_logins.join('|')})/i) do |mention_token|     
  user_name = $1     
  link_to(mention_token, user_path(user_name),  :class => "at_user", :title => mention_token)    
  end    
  source  
end

这个函数只是把相关@xxx转换成连接吧! 在 def format_topic_body(text, options = {}) 这个函数里调用!

现在问题是,def format_topic_body 在哪里调用了,而且把这条消息加入数据库中和提醒等后续操作是哪些代码?

看看 mention 和 topic 的代码,model 部分有 after_save

format_topic_body 在 View 里面调用的,项目查找可以找到啊

需要 登录 后方可回复, 如果你还没有账号请 注册新账号