Rails slim syntax errors - config wrong? - ruby-on-rails

I just merged the redesign branch in our rails app, and now we use slim. Everyone seems to have it working fine, but if I try browsing the new website (without any code modification), I get syntax errors like:
unexpected ':', expecting keyword_end
Here is a snippet of the slim file, above error is on the last line, but I'm pretty sure this has nothing to do with the file as others devs don't have the problem, neither does the production site.
#featured-destinations-carousel.carousel.slide data-ride="carousel" data-interval="15000"
.pagination.hidden-sm.hidden-xs
= link_to "#featured-destinations-carousel", 'data-slide': 'prev' do
I was told to upgrade to Ruby 2.2+, I did (with rbenv), but that didn't fix it. Ideas?

Your upgrade hasn't worked properly, the Rails app is still using and older version of Ruby. Make sure your rbenv is set up properly (do ruby -v and which ruby to help debug before running rails s) and that your .ruby-version file has the correct version in it.

You're super close. Just need to change it to
= link_to "#featured-destinations-carousel", 'data-slide' => 'prev' do
instead.

Related

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

IntelliJ Ruby syntax highlighting

I am having some issues with getting IntelliJ to properly recognize my Ruby / Rails application syntax.
Screenshot here:
http://www.evernote.com/shard/s5/sh/4a3072c9-0439-4d31-aa16-85796d1a011a/ed4017710a5dcf700396c751011dae74
I have the Ruby plugin installed. I also have the Rails gem and other gems installed, but no go.
Any idaes?
(The question was posted a while ago but I want to make #mattalxndr's wish come true :-) )
This looks like an issue with the Hash notation and not color highlighting.
The wiggly red line indicates that IntelliJ is not recognizing the {symbol: "value"} syntax. In contrast, {:jobs => #jobs} is valid on the same line.
This syntax was introduced in Ruby 1.9.
Solution: Go to the SDK tab in the Project Structure window and make sure that you are using ruby 1.9 or higher.
BTW, you can switch between the two notations by placing the cursor on the symbol and invoking the "Show intention action" function (in OSX the keys are ⎇⏎).

html_escape seems to be broken after upgrading to Rails 3.1

I have a project that uses the WYSIWYG editor 'wysihat-engine' by Dutch guys from 80beans . It use to work fine with Rails version 3.0.9 , but after upgrading to 3.1.0 the wysihat-engine cannot find 'html_escape' from ERB::Util (ActiveSupport 3.1.0) , giving me this error message :
undefined method `html_escape' for #<ActionView::Helpers::InstanceTag:my-wysihat-editor- instance>
I've fixed it (verrrry lamely , indeed) by defining the 'html_escape' inside 'wysihat-engine.rb' , but I'm sure , there's a reason not to do it this way :).
My questions :
1. Is this a bug of the new version of Rails ?
2. Is there a better choice for WYSIWYG editor for a Rails 3.1 projects ?
Thank you in advance .
The wysihat-engine doesn't seem to be compatible with Rails 3.
I've tried to install it in a fresh Rails 3.1 application, but the generator fails when it tries to generate a database migration:
$ rails generate wysihat
~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:30:in `next_migration_number': NotImplementedError (NotImplementedError)
from ~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:49:in `migration_template'
from ~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/wysihat-engine-0.1.13/lib/generators/wysihat_generator.rb:60:in `install_wysihat'
I'm surprised you even got as far as the html_escape error you posted. Fixing this would take some poking in the source code. You could ask the developer for info.

Rails 2.3.8 tiny mce issue - undefined method `uses_tiny_mce'

I am facing an issue in my application with tiny mce.
All the gem version & ruby version is OK on my system, but it is giving me error
= undefined method `uses_tiny_mce'
Here i installed the tiny_mce gem. COnfigured it correctely, but still there is an issue.
Please help.
Did you include
config.gem 'tiny_mce'
in config/environment.rb?
I have used this gem in the past too, but have stopped using it. I figured it complicated the setup and deployment of my Rails apps. Since then I have just used the TinyMCE editor by itself. Since it is 100% javascript, it does not touch any Ruby code which keeps things better organized.
I was not using this as a plugin.
I have followed the steps given in the,
http://enginey.googlecode.com/svn/trunk/vendor/plugins/tiny_mce/README.rdoc
Steps :
script/plugin install git://github.com/kete/tiny_mce.git
rake tiny_mce:install
my issue got resolved.

rails plugin installation and upgrades

I have a rails plugin written in v 2.1.1. When I install it in a 2.2.2 app, it breaks the app. I'm unable to use polymorphic routes so something like
<%= link_to #object %>
Doesn't work, because it says:
ActionView::TemplateError (undefined method 'polymorphic_path' for #<ActionView::Base:0x1a95c1c>)
If I script/plugin remove the plugin, it's still broken. So I have a two part question:
What is script/plugin install doing besides just copying the files into vender/plugins. From the output after installing it, it just looks like it's copying the files over, but clearly something else is going on behind the scenes, because removing it doesn't fix the problem
What do I need to do to update this plugin for rails 2.2.2. I don't know much about plugins, but I don't see anything that has specific version code in the plugin itself, so I can't figure out what exactly is breaking and what needs to be updated. Obviously this one is kind of tough to answer without seeing the code, but it's not actually the code in the plugin that's breaking, it's the plugin that is affecting my whole rails config.
Does anyone have experience with upgrading plugins to work for newer versions of rails?
Turns out the plugin was overwriting the RouteSet::draw method and just needed to be updated to the 2.2.2 draw code :P

Resources