In my controller I have:
def index
@title = 'asdsadas'
@kategoris = Tag.where("name like ?", "%#{params[:q]}%")
respond_to do |format|
format.html
format.json { render :json => @kategoris.map(&:attributes).map{|d| d.map{|d| d.map{|d| d.force_encoding("UTF-8") } } } }
end
end
I get this error in view:
RuntimeError in Admin::TagsController#index
can't modify frozen string
You can't force_encoding
on a frozen string since that would modify it. What you can do is work with a copy:
d.map{ |d| d.dup.force_encoding("UTF-8") }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With