app/helpers/searches_helper.rb
# Return the model to be searched based on params.
Return the model to be searched based on params.
Return the model to be searched based on params .
def search_type
    if params[:controller] == "forums" or params[:model] == "ForumPost"
        "討論區內容" 
    elsif params[:controller] == "messages" or params[:model] == "Message"
        "我的收件匣"
    elsif params[:controller].include?("groups") or params[:model] == "Group" or params[:action].include?("groups")
        "群組內容"
    elsif params[:controller] == "events" or params[:model] == "Event"
        "活動事件"
    elsif params[:controller] == "friends" or params[:model] == "Friendship"
        "朋友"
    else
        "使用者"
    end
  end
def search_type if params [ :controller ] == "forums" or params [ :model ] == "ForumPost" "討論區內容"  elsif params [ :controller ] == "messages" or params [ :model ] == "Message" "我的收件匣" elsif params [ :controller ] . include? ( "groups" ) or params [ :model ] == "Group" or params [ :action ] . include? ( "groups" ) "群組內容" elsif params [ :controller ] == "events" or params [ :model ] == "Event" "活動事件" elsif params [ :controller ] == "friends" or params [ :model ] == "Friendship" "朋友" else "使用者" end end
Return the model to be searched based on params.
Return the model to be searched based on params .