D
D
dexdev2013-12-07 15:26:33
Ruby on Rails
dexdev, 2013-12-07 15:26:33

Why don't rails 4 and gem letsrate drop data into the database?

Installed the letsrate gem, everything works, except that the data does not fall into the database ... I think the problem is in strong parameters, I don’t know how to add strong parameters to the rater_controller, can anyone come across it?
or maybe the problem is something else, Google is silent (strange)

class RaterController < ApplicationController 

  def create                                  
    if current_user.present?
      obj = eval "#{params[:klass]}.find(#{params[:id]})"     
      if params[:dimension].present?
        obj.rate params[:score].to_i, current_user.id, "#{params[:dimension]}"       
      else
        obj.rate params[:score].to_i, current_user.id 
      end

      render :json => true 
    else
      render :json => false        
    end
  end                                        


end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dexdev, 2013-12-07
@AdilA

as suggested by @sl_bug , you need to remove attr_accessible from app/models/rate.rb and that's it, and you also need to change dimensions.each do |dimension| change as shown here: https://github.com/murrekatt/letsrate/commit/c682f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question