vendredi 17 avril 2015

Removing utf8=✓ from Database

I have an API that returns info straight from the database and noticed Rails is storing a utf8 check mark and the authenticity token. What is the best way to remove this before it is saved?



{"achievements":[{"utf8":"✓","authenticity_token":"XDzrmNqNyt6OfhWpAzu3j7LhMd/sRcr/4oLsPxRMrDY=","achievement":"Big Guns",...


An example of the controller code:



def achievements
if params.include?(:ach)
@achievement = Achievement.new(params[:ach])
if @achievement.save
redirect_to action: :achievements and return
end
end
end


Example of the view:



<%= form_tag '', multipart: true do %>
<div class="four columns">Name <input name="ach[achievement]" type="text" ></div>
<div class="five columns">Description <input name="ach[description]" type="text" ></div>
<% end %>

Aucun commentaire:

Enregistrer un commentaire