Sha256: c7264f423fa9dcc55a9e62370189695d60f78dbabc3bed3c3319ab44195abf47

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

# Encoding: utf-8
class RatingsController < ApplicationController
  respond_to :json

  def create
    @rating = ::ActsAsStarrable::Rating.new(:starrable_type => params[:stype],
                                            :starrable_id => params[:id],
                                            :rating => params[:value])
    if @rating.save
      render :json => @rating, :status => :created
    else
      render :json => @rating.errors, :status => :unprocessable_entity
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_starrable-0.0.1 app/controllers/ratings_controller.rb