Class: IshManager::FriendsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::FriendsController
- Defined in:
- app/controllers/ish_manager/friends_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/ish_manager/friends_controller.rb', line 11 def create @friend = ::IshModels::UserProfile.find_by( :email => params[:friend][:email] ) # .includes( :shared_galleries ) :friends_new, @friend me = current_user.profile me.friends << @friend if me.save flash[:notice] = 'Added Friend' else flash[:alert] = "Cannot add friend: #{me.errors.}" end redirect_to :action => 'index' end |
#index ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/controllers/ish_manager/friends_controller.rb', line 3 def index :friends_index, IshModels::UserProfile @new_friend = IshModels::UserProfile.new @friends = current_user.profile.friends friend_ids = @friends.map &:id end |