Created
January 19, 2012 20:58
-
-
Save chuckbergeron/1642546 to your computer and use it in GitHub Desktop.
Append to an array, create the array first if it doesn't already exist
This file contains 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
class AnnouncementsController < ApplicationController | |
# Creates an array (if needed) and stores that array in the session so we know which | |
# announcements the current_user has seen | |
# | |
# @todo: Add test | |
# | |
def hide | |
( session[:announcement_ids] ||= [] ) << params[:id] | |
render( :nothing => true, :status => :ok ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment