ruby on rails 3 - wkhtmltopdf not working (pdfkit)

I'm having trouble generating a PDF out of a html page.I'm using PDFkit. I installed also wkhtmltopdf following the installation instructions. In 'usr/local/bin/' there is now a file called 'wkhtmltopdf'When I run a pdf with PDFkit, it now gives an error:command failed: "/usr/local/bin/wkhtmltopdf" "--margin-right" "0.75in" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-bottom" "0.75in" "--encoding" "UTF-8" "--margin-left" "0.75in" "--quiet" "-" "-"Also, when I try to generate a PDF directly it gives an error:wkhtmltopdf --page-size A...Read more

ruby on rails 3 - pdfkit gem generating pdf links as text (not click-able links)

I'm generating pdf with gem pdfkit (successfully) only issue that I have is that my pdf links are pure text (with color doh) but I cannot click on them Generated pdf file: http://bit.ly/MZBdmLthe HTML<h2>links</h2><p><a href="http://google.com" title="">google.com</a></p><p><a href="http://github.com">github</a></p><p><br></p><p><a href="http://google.sk" title="">http://google.com</a><br></p>Am I missing some option in pdfkit or wkhtmlt...Read more

forms - How to wrap every select of date_select with a div in Rails?

I'm using Ruby on Rails 3 to create a form for the user, where he can save his birthdate. All the actions around the controller and model work just fine. But I'm having trouble with the styling of this form.For every select in my forms I wrap a div around it, to style it, which normally works just fine. The problem with date_select is that it generates three select boxes which all get wrapped into one div. As example in Haml the code for the field looks like this:.select-wrapper = f.date_select :birthday, :start_year => Time.now.year - 120,...Read more

ruby on rails 3 - using Liquid variables inside of a liquid tag call

I made a custom link tag in Liquid and I am trying to be able to pass liquid variables into the call for that tag like so{{ assign id = 'something' }} // this value is actual dynamic while looping through data {% link_to article: id, text: 'Click Me!' %} // my custom tagHowever this results in the article parameter being passed in as 'id' instead of 'something' as per the assign statement above it. Does anyone know how to pass variables into tag calls?...Read more

ruby on rails 3 - How to pass controller params to Liquid filters?

Liquid:asset = {{asset_url | 'screenshot.png'}}View:<img src="{{asset_url | 'screenshot.png'}}" />Helper:I parse it as below:Liquid::Template.parse(asset).render(asset, :filters => [TextFilter]).html_safetext_filter.rb:def asset_url(input) AwsWrapper::S3Object.url_for("\[**asset_id**]\#{input}", [BUCKET_NAME])endI wanted to know how to pass [asset_id] from view to the text_filter so that i will form the url to get the image from s3...Read more

Using Liquid in Rails assets

I'm using Liquid in my CSS. For example, I have test.css.liquid which contains: body { background: {{ 'red' }}; }When I run rake assets:precompile, it's not test.css that's compiled but still test.css.liquid and the Liquid code isn't parsed.Sprockets uses Tilt which has a Liquid parser by default. I have Liquid enabled on my site.Any idea what could be wrong?...Read more

ruby on rails 3 - rendering a partial in liquid layout (rails3)

I have a liquid template where I need to render a partial inside that.Please note @current_page.page_layout.content will load the content from the DBmy liquid layout file is as follows#layouts/public.html.erb<%= Liquid::Template.parse(@current_page.page_layout.content).render('page_content' => yield, 'page_title' => yield(:title)) %>and following is my code, which includes the partial as well{{page_content}}{% include 'this_is_the_partial_name' %}and I'm getting this errorLiquid error: This liquid context does not allow includes.I t...Read more

ruby on rails 3 - Separate REST JSON API server and client?

I'm about to create a bunch of web apps from scratch. (See http://50pop.com/code for overview.) I'd like for them to be able to be accessed from many different clients: front-end websites, smartphone apps, backend webservices, etc. So I really want a JSON REST API for each one.Also, I prefer working on the back-end, so I daydream of me keeping my focus purely on the API, and hiring someone else to make the front-end UI, whether a website, iPhone, Android, or other app.Please help me decide which approach I should take: TOGETHER IN RAILS Mak...Read more

Trouble serving Rails 3 app with nginx + unicorn on EC2

When I point my browser to "rails_app.com", I can view rails_app/public/index.html on the EC2 instance, but when I delete rails_app/public/index.html I get the nginx 403 error, directory index of "/home/www-data/rails_app/public/" is forbidden, instead of being able to see my Rails 3.0.3 rails_app. I'm usingNginx Version 0.8.54Unicorn_rails Version 3.4.0One post I read said that I need to make sure that the correct version of ruby is available for user www-data, which I did. I have the directory owners for the rails_app set for user and...Read more

After installing ruby 1.9.3 rails 3.2.1, getting OpenSSL::SSL::SSLError: on simple requests

Got ruby 1.9.3/rails 2.3.1 installed via rvm (finally worked after installing openssl via rvm pkg.) but now getting OpenSSL::SSL:SSLError trying to connect to github (and probably anything else):-->irb1.9.3-p0 :001 > require 'open-uri'1.9.3-p0 :002 > open('https://github.com/')OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed-- Tried the solution in "Certificate verify failed" OpenSSL error when using Ruby 1.9.3 but that did not work.Not sure if the problem is in Op...Read more

amazon web services - rails application elastic beanstalk timeout

I just uploaded my rails 3.1 app , to elastic beanstalk. And while the database and everything seems setup right . Attempting to open my app up , just causes a browser timeout . theonly error i can see in the logs is :2013/07/10 14:19:33 [error] 1741#0: *4 "/var/app/current/public/index.html" is notfound (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD /HTTP/1.1", host: "0.0.0.0"i have used a static pages controller and have my pages in the view , i don not know what i should be doing to configure passenger , or whet...Read more

ruby on rails 3 - paperclip gem validation error - 'filename' is not recognized by the 'identify' command

I'm trying to get the paperclip gem to upload images on my production server (ubuntu 12.0.4, apache2, phusion passenger and rvm) and for each attachment I get three lots of this validation error: Img one /tmp/villa-0520121006-4333-hdo9wv.jpeg is not recognized by the 'identify' command.ImageMagick is installed properly, as is the libmagickwand-dev package, Rmagick and paperclip.And I've set the correct command_path to where identify and convert are located in my production.rb config file. here is my model if it helps:class Property < Activ...Read more