Commit 510777853a64ab98d4245e9dca948518fc0057e8

Authored by Artur Faria
1 parent 58e58d38

Create controller action

Signed-off-by: Artur Bersan de Faria <artur_bersan@hotmail.com>
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
app/controllers/my_profile/followed_people_controller.rb
... ... @@ -1,10 +0,0 @@
1   -class FollowedPeopleController < MyProfileController
2   -
3   - def index
4   - @followed_people = Person.all.limit(10).paginate(:per_page => 5, :page => params[:npage])
5   - end
6   -
7   - def set_category
8   - render :partial => "set_category_modal"
9   - end
10   -end
app/controllers/my_profile/followers_controller.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class FollowedPeopleController < MyProfileController
  2 +
  3 + def index
  4 + @followed_people = Person.all.limit(10).paginate(:per_page => 5, :page => params[:npage])
  5 + end
  6 +
  7 + def set_category
  8 + render :partial => "set_category_modal"
  9 + end
  10 +end
... ...
app/controllers/public/profile_controller.rb
... ... @@ -155,6 +155,18 @@ class ProfileController &lt; PublicController
155 155 end
156 156 end
157 157  
  158 + def follow
  159 + if !current_person.follows?(profile)
  160 + current_person.follow(profile)
  161 + end
  162 + end
  163 +
  164 + def unfollow
  165 + if current_person.follows?(profile)
  166 + current_person.unfollow(profile)
  167 + end
  168 + end
  169 +
158 170 def check_friendship
159 171 unless logged_in?
160 172 render :text => ''
... ...