Created
May 8, 2014 21:04
-
-
Save dzjin/127a8ad9279a5a739c57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def usertags | |
| if params[:tags] != nil | |
| @tags = params[:tags] | |
| session[:tags] = @tags | |
| @videos = Video.tagged_with(session[:tags]).order("views DESC").page params[:page] | |
| else | |
| session[:tags] = nil | |
| @videos = Video.order(views: :desc).page params[:page] | |
| end | |
| respond_to do |format| | |
| if session[:tags] == nil | |
| redirect_to videos_path, notice: 'Tags have been cleared.' | |
| else | |
| format.js | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment