Closed ghost closed 10 years ago
on rate_controller.rb, it will be cleaner to use, on line: @obj = eval "#{params[:klass]}.find(#{params[:id]})" (don't use eval) but @obj = params[:klass].constantize.find(params[:id]) (inside private set_obj)
Version 1.0.9 is released you can use it on Rails 4.
Hello,
I find two other problem resolved like this:
1 on rate.rd model file, change attr_accessible by attr_accessor 2 on rater_controller.rb, just before last "end" class call, add : private def set_obj @obj= (ligne 7 copie/paste eval line) end def obj_params params.require(:rater).permit(:klass, :stars, :dimension, :score, :rate) end then, take off the ligne 7 (obj=eval.....) and add "before_action :set_obj, only: [:create]" just after class declaration
(this was for strong_parameter process for rails-4)
3 on gem file of letsrate (model.rb) change: line 9: r.rater_id = user_id.id (and not user_id) line 45: ......and rater_id=#{user_id.id}...... (and note user_id)
this will work good and not make error 500 server for mysql. Also, no more warning for strong_parameter in rails-4
I try to find a way for call "klass" controller without "eval" ruby function...