Note that there are some explanatory texts on larger screens.

plurals
  1. POrails auto_html gem is not persisting results
    text
    copied!<p>I am new to rails development and I am trying to get the auto_html gem to work, but nothing ever gets saved to the body_html field of the DB. I am not getting any errors either, so it seems like the gem just isn't getting called.</p> <p>I have included the gem in my gemfile and ran bundle install. Am I not doing something correctly? My thought was that I didn't need to call any auto_html method anywhere because I have the auto_html_for in the model. </p> <p>I am on Rails 3.2.1 and ruby 1.9.3p125 and auto_html 1.5.1</p> <p>Model:</p> <pre><code>class Video &lt; ActiveRecord::Base belongs_to :campaign auto_html_for :body do html_escape image youtube(:width =&gt; 400, :height =&gt; 250) link :target =&gt; "_blank", :rel =&gt; "nofollow" simple_format end end </code></pre> <p>Controller:</p> <pre><code>class VideosController &lt; ApplicationController def new @video = Video.new respond_to do |format| format.html # new.html.erb format.json { render json: @video } end end def create @video = Video.new(params[:video]) respond_to do |format| if @video.save format.html { redirect_to videos_path(:campaign =&gt; "#{@video.campaign_id}"), notice: 'Video was successfully created.' } format.json { render json: @video, status: :created, location: @video } else format.html { render action: "new" } format.json { render json: @video.errors, status: :unprocessable_entity } end end end </code></pre> <p>View:</p> <pre><code>= simple_form_for @video do |f| .field = f.hidden_field :campaign_id, :value =&gt; "#{params[:campaign]}" = f.text_area :body .actions = f.submit 'Save' </code></pre> <p><strong>EDIT:</strong> videos table definition from schema.rb</p> <pre><code>create_table "videos", :force =&gt; true do |t| t.text "body" t.text "body_html" t.integer "campaign_id" t.datetime "created_at", :null =&gt; false t.datetime "updated_at", :null =&gt; false end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload