Yujun W.
2013-May-10 03:45 UTC
Rails 4 strong params error: no implicit conversion of Symbol into String
I am importing the data from a spreadsheet to the app database. The data is parsed by rows. Each parsed row looks like: {:department=>{:school=>"Graduate School of Business", :name=>"Graduate School of Business", :program=>"MBA Program", :url=>"http://www.gsb.stanford.edu/mba", :intro=>"The Stanford MBA Program is a two-year, full-time, residential program.", :students_number=>"Approximately 80 annually", :students_with_aids_number=>nil, :gre_scroe=>nil, :toefl_score=>nil, :world_rank=>nil, :us_rank=>nil, :without_aid_deadline=>nil, :with_aid_deadline=>nil, :salary=>nil, :institute_id=>1}} To create a department: # att is the hash shown above department = Department.new(department_params(att)) if !department.save puts "Error: \n department can''t be save: #{department.errors.full_messages}" end def department_params params params.require(:department).permit(:name,:url,:institute_id) end But I got the error: no implicit conversion of Symbol into String which points to params.require(:department).permit(:name,:url,:institute_id) How could I fix it? Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.