Note that there are some explanatory texts on larger screens.

plurals
  1. POgaletahub-simple_captcha gem not displaying StandardError (Error while running convert: convert: unable to read font
    primarykey
    data
    text
    <p>I added the simple_captcha gem and I'm receiving an error in the server when I load up the form that it's located on. I'm not sure how to go about fixing this. Judging my the research I've done on google it appears to be an ImageMagick issue but I'm not entirely sure.</p> <pre><code>SimpleCaptcha::SimpleCaptchaData Load (0.2ms) SELECT "simple_captcha_data".* FROM "simple_captcha_data" WHERE "simple_captcha_data"."key" = '406a6bd66e520eef7f24a13c2cc8c5b23d3749e8' LIMIT 1 CACHE (0.0ms) SELECT "simple_captcha_data".* FROM "simple_captcha_data" WHERE "simple_captcha_data"."key" = '406a6bd66e520eef7f24a13c2cc8c5b23d3749e8' LIMIT 1 StandardError (Error while running convert: convert: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125. convert: Postscript delegate failed `/var/tmp/magick-4563zAoZ5QYyFe6C': No such file or directory @ error/ps.c/ReadPSImage/833. convert: no images defined `/var/folders/6b/tq59gs0d1f7bp_zg41cf6fqm0000gn/T/simple_captcha20130626-4555-1yk8sq1.jpg' @ error/convert.c/ConvertImageCommand/3078. ): </code></pre> <p><strong>simple_capthca.rb</strong></p> <pre><code>SimpleCaptcha.setup do |sc| # default: 100x28 sc.image_size = '120x40' # default: 5 sc.length = 6 # default: simply_blue # possible values: # 'embosed_silver', # 'simply_red', # 'simply_green', # 'simply_blue', # 'distorted_black', # 'all_black', # 'charcoal_grey', # 'almost_invisible' # 'random' sc.image_style = 'simply_green' # default: low # possible values: 'low', 'medium', 'high', 'random' sc.distortion = 'medium' sc.image_magick_path = '/usr/local/bin/' # you can check this from console by running: which convert' end </code></pre> <p><strong>reservations_controller.rb</strong></p> <pre><code> def create @restaurant = Restaurant.find(params[:restaurant_id]) @reservation = @restaurant.reservations.build(date: DateTime.new(params[:date]["date(1i)"].to_i, params[:date]["date(2i)"].to_i, params[:date]["date(3i)"].to_i), time: (params[:time][:hour]).to_i) if @reservation.valid_with_captcha? @reservation.save @restaurant.owner.send_reservation_notification(@reservation) redirect_to restaurant_path(Restaurant.find(params[:restaurant_id])) else flash[:error] = "Captcha incorrect. You enterd the wrong digits." redirect_to :back end end </code></pre> <p><strong>new.html.erb</strong></p> <pre><code>&lt;h1&gt;Reserve your table.&lt;/h1&gt; &lt;br/&gt; &lt;div class="reservation-form"&gt; &lt;%= form_for([@restaurant, @reservation]) do |f| %&gt; &lt;%= date_select :date, "date" %&gt;&lt;br/&gt; &lt;%= select_hour Time.now, :ampm =&gt; true, :prefix =&gt; :time %&gt;&lt;br/&gt;&lt;br/&gt; &lt;%= f.simple_captcha :label =&gt; "Prove that you're not a robot." %&gt;&lt;br/&gt; &lt;%= f.submit "Make reservation", class: "btn btn-primary" %&gt; &lt;% end %&gt; &lt;/div&gt; </code></pre> <p><strong>Reservation.rb</strong></p> <pre><code>class Reservation &lt; ActiveRecord::Base attr_accessible :restaurant_id, :date, :time belongs_to :restaurant apply_simple_captcha end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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