Created
January 22, 2011 19:51
-
-
Save joemsak/791400 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<%= render :partial => "/shared/head", :locals => {:theme => true} %> | |
<body> | |
<%= render :partial => "/shared/site_bar" %> | |
<div id='container'> | |
<%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%> | |
<header id='header'> | |
<%= render :partial => "/shared/header" %> | |
</header> | |
<div id="flash_container"> | |
<%= flash.inspect %> | |
<% flash.each do |key, value| %> | |
<div id='flash' class="flash flash_<%= key %>"> | |
<%= value %> | |
</div> | |
<% end %> | |
</div> | |
<%= yield %> | |
</div> | |
<%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js' %> | |
<%= yield :javascripts %> | |
<%= render :partial => '/shared/google_analytics' unless local_request? %> | |
</body> | |
</html> |
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 FriendshipsController < ApplicationController | |
before_filter :require_user | |
def create | |
@friendship = current_user.friendships.build(:friend_id => params[:friend_id]) | |
if @friendship.save | |
friend = @friendship.friend | |
flash[:notice] = "You are now friends with #{friend.login}" | |
redirect_to profile_path(friend) | |
else | |
redirect_to root_url, :error => "#{@friendship.errors}" | |
end | |
end | |
def destroy | |
@friendship = current_user.friendships.find(params[:id]) | |
@friendship.destroy | |
redirect_to profile_path(current_user), :notice => "Removed friendship." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment