Class: Ishapi::NewsitemsController
Instance Method Summary
collapse
#home, #long_term_token, #vote
Instance Method Details
#destroy ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/ishapi/newsitems_controller.rb', line 8
def destroy
n = Newsitem.find params[:id]
puts! n.map.creator_profile.id, 'ze id'
puts! current_user.profile.id, 'ze2 id'
authorize! :destroy, n
flag = n.destroy
if flag
render json: { status: 'ok' }, status: :ok
else
render json: { message: "No luck: #{n.errors.full_messages.join(", ")}." }, status: 400
end
end
|
#index ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/ishapi/newsitems_controller.rb', line 23
def index
if params[:domain]
resource = Site.find_by( :domain => params[:domain], :lang => :en )
else
resource = current_user.profile
end
authorize! :show, resource
@newsitems = current_user.profile.newsitems
end
|