Rails 4 strong params error: no implicit conversion of Symbol into String -
i importing data spreadsheet app database.
the data parsed 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 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 department:
# att hash shown above department = department.new(department_params(att)) if !department.save puts "error: \n department can't save: #{department.errors.full_messages}" end def department_params params params.require(:department).permit(:name,:url,:institute_id) end
but got error:
no implicit conversion of symbol string
which points
params.require(:department).permit(:name,:url,:institute_id)
how fix it? thanks!
getting rails-api , strong_parameters work together
i think it'll similar. need include actioncontroller::strongparameters
not require described in linked question.
in case adding new initializer with
actioncontroller::api.send :include, actioncontroller::strongparameters
Comments
Post a Comment