Twitter Bootstrap 2 breaks Rails 3.1 page scripts? - ruby-on-rails-3.1

In attempting to upgrade to Bootstrap 2 (using twitter-bootstrap-rails gem), it seems that page-specific scripts are rendered unusable: all scripts must be loaded from the Asset Pipeline to work. Even a simple $ alert function called from a page script tag doesn't appear to load, even if yielded into the head after the AP loads. The original Bootstrap played fine with page scripts.
I understand that scripts should usually be loaded through the AP as a practice, but has anyone else experienced this behavior, and is this something that can be remedied easily, or is this something unique to my setup? (Rails 3.1.3, rvm, ruby 1.9.3, xCode 4.1)
A git reset solved the issue, but I'd rather upgrade and use the new TB features....
Thanks for any insights or thoughts about how to track down the issue.

You are using rails 3.1.3 the new gem works fine for me on rails 3.2.2 so it should be that your jquery-rails gem might not be using the latest jquery. so try upgrading cos the new gem works with the latest version of jquery

Related

Ruby Webdrivers Gem Cannot Reach Site

I am using the webdrivers gem for Ruby (not selenium webdriver) https://rubygems.org/gems/webdrivers/versions/3.2.0
I can get the gem to update chrome fine, it places it in webdrivers new directory and sees the version of the chrome driver. I only used the update and latest methods on Webdrivers::Chromedriver. My issue is when trying to get the Webdrivers::Geckodriver installed (firefox). I get the error message: Cannot reach site. The documentation is a little lacking, does anyone know the proper setup for firefox? or why i get this error?
First, update to the latest version, there are a couple minor bugs that were fixed since your version.
You should only be seeing that error if the gem can't access the github site where mozilla stores its release binaries. So very likely a temporary issue.
If it isn't already working again, set Webdrivers.logger.level = :debug to get more info about what is happening, and we can debug it.

Ruby : What changes needed to make test-unit-1.2.3 working with Ruby-2.4.1

I am new to Ruby Development. Now i am working on ruby test-framework code which was working fine with Ruby-1.8.7
Now i want to upgrade ruby for this framework. I have found that test-unit-1.2.3 is included in Ruby-1.8.7 so i have installed it separately with Ruby-2.4.1.
Currently i am facing method missing issue ["register_autorunner"] with this combination. Because these method have not been used in ruby-1.8.7
Can anyone please tell me other changes needed to make this combination [Ruby-2.4.1 , test-unit-1.2.3] working.
Thanks in advance
You should update to TestUnit 3.x, which will have a higher chance of working with Ruby 2.x. Then you need to figure out the changes between Ruby 1.8.7 and Ruby 2.4.1, and how to fix your existing code, which is most likely broken, even after you have fixed/updated your unit test configuration.
Also, consider a switch to Minitest or Rspec, as they are a lot more popular today, so it will be easier to find examples and supporting tools for them. Minitest is also the default test framework used by Ruby on Rails currently.
References:
https://www.jetbrains.com/research/devecosystem-2017/ruby/
http://guides.rubyonrails.org/v5.1/testing.html

Issues after upgrading Ruby & Rails

I upgraded my Ruby to 2.1.2 & I upgraded Rails to 4.1.2.
I currently have 2 issues that I can't seem to get passed and they may be interconnected.
First, I get this error: Could not find attr_encrypted-1.3.2 in any of the sources when CLEARLY when I run bundle install it says Using attr_encrypted (1.3.2).
Second, before this, I noticed that when I do rails c the version of Ruby is 2.0.0, but ruby --version outputs ruby 2.1.2p95 and rvm lists shows that I am using Ruby 2.1.2. Frustrating, and I think these issues may be interconnected.
bundle install does not fix it. Deleting my Gemfile.lock does not fix it.
Bet its spring again, caching your app.
spring stop
Edit 1
Spring is a rails application preloader. It caches the app, making running rails commands, task, tests etc. faster by saving rails load time. It's default since rails 4.1. Check your bin folder. There will be binstubs within. Open bin/rails and you'll see it loading spring which does the caching magic.
In 99% of the time rails will pick up your code changes. But this won't be the case on changing startup code like gem loading.

Migrating a rails app up to 3.1, having trouble getting sass to behave

I'm migrating a pre-Rails-3.1 app up to 3.1 (actually, someone else did part of the work of attempting to migrate to 3.0; I'd like to go ahead and get it up to 3.1 now).
When I create a new Rails 3.1 app with rails new, the skeleton app seems fine.
When I run rake test or thin start in the migrated app, though, I get:
/Users/dwhsix/.rvm/gems/ruby-1.9.2-p290#zmy/gems/sass-rails-3.1.0.rc.6/lib/sass/rails/template_handlers.rb:32:in `<class:SassTemplate>': undefined method `default_mime_type=' for Sass::Rails::SassTemplate:Class (NoMethodError)
I think I have things configured correctly. Gems are correct, application.rb has:
config.assets.enabled = true
config.generators.stylesheet_engine = :sass
Is there more that is needed somewhere?
Thanks...
May be please try adding one more at application.rb, since rails 3.1 use scss as default.
config.sass.preferred_syntax = :sass
and there is some mime related settings at initializers/mime_types.rb, so you may try to play with that too.
You could also switch to scss if you wanted to, by using the sass-convert command. I originally used sass syntax, but later decided I liked scss better and switched to that.
sass-convert -F sass -T scss mystyle.sass mystyle.scss
Okay, this turned out to be a problem of having too many versions of various gems installed. The real culprit was the wrong version of tilt, which was being brought in by some other gem. Clearing that, and resetting Gemfile.lock, took care of it.
I had the same problem just now. My solution was to update the tilt gem as described in this github issue. Apparently, the default mime type method, is added after tilt 1.3.0.

Rails 2.x launcher script was found instead of Rails 3.x one a lot in RubyMine

keep getting this message in rubyMine
I think the solution here should solve your problem:
Rails 2.x app on RubyMine 3.1
You probably have the rails 2.x gem attached to your RubyMine settings. Go to File > Settings and take a look at Ruby SDK and Gems. Make sure you have rails 3.x selected, and not something else.

Resources