Sha256: 67ff05ba484504a23441c3942b74d818e7119f64ccdc6df7d5cc766c4b7ef294

Contents?: true

Size: 821 Bytes

Versions: 126

Compression:

Stored size: 821 Bytes

Contents

require_dependency "ishapi/application_controller"

module Ishapi
  class NewsitemsController < ApplicationController

    before_action :check_profile

    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

    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

  end
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
ishapi-0.1.8.316 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.315 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.314 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.313 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.312 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.310 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.309 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.308 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.307 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.306 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.305 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.304 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.303 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.302 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.301 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.300 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.298 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.297 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.296 app/controllers/ishapi/newsitems_controller.rb
ishapi-0.1.8.295 app/controllers/ishapi/newsitems_controller.rb