Rails + tinymce-rails weird error - ruby-on-rails

I'm using tinymce-rails for a form .... until last night everything worked fine ... this morning when I came in and tried to run the form I get this error
undefined local variable or method 'tinymce'
the weird part is if I save the controller with :w in vim without making any changes to the file ... the error disappears and everything works ... any ideas ?

I had similar issue (rails 3.1), may be because i was using the advance theme.
then added this in application.js
//= require tinymce
//= require tinymce-jquery
and the theme folder from tinymce to assets folder
Worked for me... not sure if it helps.

I fixed it by adding helper(TinyMCE::Rails::Helper) in the controller but I still have no idea what happened

gem update tinymce-rails
bundle update
And you should get your gem updated

Related

How do I get Filterrific Javascript and Assets to run on Rails 6?

I used the code from demo and the scopes and form work by themselves.
When I added Materialize forms, I noticed that the form and filtering doesn't anymore.
Apparently filterrific doesn't load its javascript library (I loaded Jquery for materialize, which works fine).
From my understanding
//= require filterrific/filterrific-jquery
in assets/javascript/application.js won't work (also tried).
I also get an asset error
Asset `filterrific/filterrific-spinner.gif` was not declared to be precompiled in production.
Declare links to your assets in `app/assets/config/manifest.js`.
The gem seems Rails 6 ready (says the table on github), but there is no documentation on how to make it work with Rails 6 and WebPacker.
Add the following line to app/assets/config/manifest.js
//= link filterrific/filterrific-spinner.gif

How to completely remove all of turbolinks from a Rails 5 project

I've read through the other available questions and answers and they don't solve my issue. I recently looked to remove turbolinks from my project because I was having problems setting up event listeners. Suggestions for modifying the jquery to use the turbolinks equivalents weren't working, so I decided to remove it entirely for now to unblock myself.
I've done the following:
Remove the gem from Gemfile
Bundle (confirmed in the bundle turbolinks is no longer listed)
Removed turbolinks attributes from links in the head
Removed the require from the application JS
Restored my JS file to the original jQuery implementation
However, the problem persists on production (Heroku). Everything continues to work locally. I was inspecting the source assets on production and noticed I can find traces of turbolinks in the compiled js file. I don't know if this is causing the problem and I don't know where it's coming from so I haven't been able to remove it to test.
My JS file is set up like so:
$(document).ready(function() {
console.log('Listener setup working...');
....
Any ideas greatly appreciated.

Highcharts in the Rails Assest Pipeline not Loading

I'm working in development and am migrating from Rails 3.x to Rails 4.2.5 with Ruby 2.1. In the previous version of rails, Highcharts was working perfectly. Now I am trying to use the asset pipeline for the first time.
Within my applcation.html.erb file, I have included the line:
<%= javascript_include_tag "application" %>
Within assets/javascripts, I've verified the file "application.js" exists. Within that file I have included the lines:
//= require jquery.min
//= require rails
//= require highcharts
//= require_tree .
I have verified the files just listed above also exist in the asset/javascript. I thought that was all I needed, but I always get a blank screen when I try to display the chart. The log file says the view with the chart was rendered, but nothing is displayed. It worked perfectly in the previous version of rails, so I am ruling out the creation, handling and data values of the chart as being the source of the problem.
So what else am I missing to get Highcharts to run again? If more info is needed to help answer the question, please just let me know. Any help is greatly appreciated.
Problem solved. There was an extra comma buried within my Highcharts function call. I was able to find this by using #taglia comments about using a browser console, which in the future I will know to use as part of my debugging tool box.
Thanks to everyone for your help and insights.

Application.css.scss causing issue with rails 4

So i've been learning ruby on rails and i decided to add some style to my new posts page on a myrubyblog app. Everything was working. After a few days i decided to import scss from the posts.scss file into the application.css.scss and well i get this error
RuntimeError in Home#index
Showing c:/Sites/myrubyblog/app/views/layouts/application.html.erb where line #5 raised:
Current ExecJS runtime does't support ES5. Please install node.js.
(in c:/Sites/myrubyblog/app/assets/stylesheets/application.css.scss)
Extracted source (around line #0):
After removing my application.css.scss file, the pages were working. Upon removing the actual scss code and leaving the application.css.scss the page began to give problems again. I decided to leave the application.css.scss file deleted. This for some reason allows for the styles i set in it to show up even though the stylesheet itself has been deleted.
Installing Node.js seemed to have worked. I just had to reboot.... twice...
Thx guys i guess.

rails asset pipeline asset group not precompiling datatables

I started building a rails project that uses jquery-datatables-rails. When I put that into my Gemfile I did NOT put it into the assets group. Everything worked fine in development. When I went to put it into production I re-read the documentation and saw that it should be in the assets group so I moved that line in my Gemfile. Then I performed a rake assets:precompile and then ran rails server -e production.
The datatable doesn't work. In fact, the only way I can make it work is to take that line out of the assets group in my Gemfile and run in development mode. I've read a lot of conflicting information on the Internet about this.
Did I screw anything up by moving the line from outside the assets group into the assets group? I would like to be able to run this in production and I want to have a Gemfile that is consistent with the jquery-datatables-rails documentation.
A while back in response to a different problem that I was having, I moved require twitter/bootstrap above require jquery in app/assets/javascripts/application.js. As a result the javascript wasn't working right. Moving it into the right place solved the problem and inexplicably did not cause the old problem to return.
So the fix is, make sure that jquery is at the top of your application.js file.

Resources