module ChatsHelper def chat_frame :sidebar_chat end def chat_view_path(chat) return new_chat_path if params[:chat_view] == "new" return chats_path if chat.nil? || params[:chat_view] == "all" chat.persisted? ? chat_path(chat) : new_chat_path end end