pdf.js gem producing errors - ruby-on-rails

I am a rails novice and trying to create my web portfolio in Cloud9. I wanted to display my resume.pdf in the user browser so I installed this gem gem 'pdfjs_rails' now my app doesn't even start in cloud 9. It show the following error messages in the terminal:
Please help me. How can i revert it back? thanks

Doesn't look like anything related to pdfjs (no point in that direction). Are you sure you've selected the right runner in Cloud9? See:
https://community.c9.io/t/error-when-running-ruby-project/11799/4
More in general: if you think an issue would be related to a gem, you can simply remove it from the Gemfile and run gem bundle to 'revert' to a previous state.

Related

Missing Template Error when using Haml in Rails 4

I have been trying to use HAML with Rails 4 for an app but I'm getting a Missing Template Error as shown here.
To get to this point, I followed the following steps:
Added the following gems to my Gemfile and bundle install
My Gemfile here
Added a pages controller Check image
Updated application.html.erb to application.html.haml along with contents Check image
Added home.html.haml in pages view with code:
%h1 home page
I'm not sure why it's not working. Having googled it, I found that gem 'haml-rails' needs to be added, which I did. Yet, I'm unable to see any change.
The tutorial I'm following is here
Please help. Thank you.
I restarted the server and it seems to be working fine. Thank you all.

Issue adding Bootstrap on Ruby on Rails Project

This is what I followed in order to get started with bootstrap on Ruby on Rails.
I followed every step exactly the same. However, I keep running into the same error for some reason. When I do not do any thing (i.e. do not use bootstrap) everything works (but the application looks trashy).
Whenever I use bootstrap, I get:
invalid regexp character
This is the application trace:
(execjs):24299
app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb__337612969_59863020'
I have no clue what is happening.
P.S. I am a beginner. So if the solution is simple then, yeah...
remove #gem 'duktape' from gem file..the issue will be solved

Controller not recognizing installed Gem

Okay, I know this is a bit of a simple question, but I can't seem to get it to work. I have installed the SmarterCSV gem in my Rails 4 app and am trying to use it in my controller like so:
SmarterCSV.process("/files/csv_file.csv")
I can do this exact process in the rails console for this app, but I cannot seem to get it to work in my controller. Every time I just get the Rails Dead Screen saying uninitialized constant MyController::SmarterCSV. I have tried adding the line
require 'smarter_csv'
But that also breaks to the Rails Dead Screen with the error cannot load such file -- smarter_csv
Any help would be greatly appreciated, Im not entirely sure what I can do...
you can try require 'smarter_csv/smarter_csv' as this is the path of the file in the gem https://github.com/tilo/smarter_csv/blob/master/lib/smarter_csv/smarter_csv.rb
Don't forget to restart your application after bundle install

Rails 4.2 + Ember => unexpected identifier

I'm following Vic Ramon's tutorial. I tried to use the latest version of Rails and Ember-source and I get the following error when visiting home page:
After clicking on link next to error I get this:
How can I fix that?
I ran the following commands:
rails g ember:bootstrap -n App --javascript-engine coffee
rails g ember:install
I removed turbolinks. I also created home controller and an empty view for home#index. Root is set to home#index. Also created following view file:
// app/assets/javascripts/templates/application.js.emblem
h1 Hello World
outlet
Ember gems im using:
Using emblem-source 0.3.18
Using ember-data-source 1.0.0.beta.14.1
Using ember-rails 0.16.1
Using emblem-rails 0.2.2
This could be due to some version incompatibilities between your versions of ember-related gems, as there were quite substantial changes in recent versions of ember (e.g. introduction of HTMLBars, etc.)
Your best bet is to clone the original repo and then try to upgrade individual gems and check if it still works after each upgrade. This way you will be able to identify the troubling gem.
I have verified that the original repo code indeed works with the versions of gems in its current Gemfile.lock.
If you are starting a new Rails + Ember app, ember-cli-rails is probably the way to go, giving you the best of both worlds.
Emblem was the culprit. Replacing .emblem with .handlebars fixed the problem. I tried the tip from emblem-rails git page and icluded
gem "emblem-source", github: "machty/emblem.js"
but that didn't change anything.
I also followed this tutorial (alongside a few others) and I encountered several issues alongside the way ranging from handling templates to setting up the JSON API. I don't see your entire source code so I cannot pinpoint the exact problem. However, it seems that we have similar projects, so you can compare your code to my blog project source code and see what is causing these issues. Comparing to Ramon's tutorial, my blog has implemented everything until chapter 15.
https://github.com/Deovandski/Fakktion/tree/Ember-Rails
If you are a beginner like myself, then I recommend avoiding CoffeeScript and Emblem and sticking to Javascript as much as possible for the first months because you will find more resources and examples. Also, let me know if you need assistance in setting up the project as I used .gitignore to hide things like secrets.yml

SCRIPT14: Not enough storage is available to complete this operation, ckeditor gem error on IE

I'm using ckeditor gem in my rails app and its not working on IE. It gives an error
SCRIPT14: Not enough storage is available to complete this operation.
ckeditor.js?body=1, line 63 character 140
I search it on google and saw some result (http://krasimirtsonev.com/blog/article/CKEditor-Not-enough-storage-is-available-to-complete-this-operation and http://ckeditor.com/forums/Support/Not-enough-storage-error-IE7IE8) but I can not understand how can i implement it on my rails app using gem "ckeditor_rails", "~> 4.0.2". please help!
according to http://krasimirtsonev.com/blog/article/CKEditor-Not-enough-storage-is-available-to-complete-this-operation
how to implement it?
1) please copy vendor/assets/javascripts/ckeditor/ckeditor.js from ckeditor_rails gem to app/assets/javascripts/ckeditor/ckeditor.js of your project.
2) find
if(this.$.createStyleSheet)this.$.createStyleSheet
and replace with
if(false)this.$.createStyleSheet
3) cleanup cache of your browser and restart your server to see if it works.
honestly say, I don't try it for IE. But that's how rails assets pipeline works.
the new release v4.1 also has this piece of code. the bug may not be resolved by CKEDITOR team.
also see https://github.com/tsechingho/ckeditor-rails/issues/17

Resources