Sha256: e501e98ea9a26a6bee5bb9f9f7b9a1ccc33680b0e2188f6616e7b8f584c1de0a

Contents?: true

Size: 752 Bytes

Versions: 10

Compression:

Stored size: 752 Bytes

Contents

# -*- encoding : utf-8 -*-
module LoyalCore
  class Ajax::LikeTracksController < ::LoyalCore::AjaxController
    before_filter :authenticate_user!

    def touch
      target_clazz = ::LoyalCore.config.clazz_alias[params[:target_type]]

      result = {}

      if target_clazz && (target_clazz = target_clazz.constantize)
        target = target_clazz.find_by_uuid(params[:target_id])

        _code = target.touch_liked_by!(current_user)

        if target
          result = { 
            :code => _code,
            :count  => target.liked_count
          }
        end
      end

      render :json => {
        :response => {
          :status => 200,
          :code   => :success
        },
        :result => result
      }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
loyal_core-0.0.11 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.10 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.8 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.7 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.6 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.5 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.4 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.3 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.2 app/controllers/loyal_core/ajax/like_tracks_controller.rb
loyal_core-0.0.1 app/controllers/loyal_core/ajax/like_tracks_controller.rb