how to upgrade simple_form gem for bootstrap 3 - ruby-on-rails

I updated my application by moving to bootstrap 3 from version 2 by replacing the css files etc.
I thought I'd upgrade simple_from as well since the old one is probably incompatible with bootstrap 2.
So I ran bundle update simple_form and it upgraded from simple_form (2.0.4) to (2.1.1).
How do I upgrade to the lastest version? and how do I integrate it with bootstrap 3? Do I need to reinstall simple_form using rails generate simple_form:install --bootstrap instead of updating the gem with bundler ? and how come updating the gem didn't update to the latest one?
Thank you for the clarifications on how to migrate simple_form properly.

Bootstrap 3 support for simple_form has not made it into a stable release yet. You can read more here. If you want to install the rc version, which seems to work fine, simply use gem 'simple_form', '~> 3.1.0.rc1' in the Gemfile. (Run bundle install after making the change)
I'm not sure how simple_form generators work, but one way of making sure the configuration is updated is by copying config files from the sample application. The files are config/initializers/simple_form.rb and config/initializers/simple_form_bootstrap.rb.
If there are other simple_form-related files leftover from the previous version, you should probably delete them.

Related

Gem compatibility and Ruby version

How to find out which gems need to be updated in a Rails app if the Ruby version is upgraded?
For example, I would like to know which of my Rails app gems will have to be upgraded if I upgrade my Ruby from 2.1.3 to 2.2.2. The preference would be to keep the changes minimal as to reduce the probability of things breaking.
The important thing would be for this to be a dry-run. So that one can assess the amount of work that an upgrade will require.
I have checked bundle and gem readme's without much luck.
If you update your rails version, it should install or resolve the required dependencies needed to run the new rails version. As far as as the gems you have entered that are NOT dependencys to Rails, you can check gem compatibility on rubygems.org. Just type in the title of your gem in the search bar.

Globalize and Rails 4: Compatibility status

In a my previous question (asked about 2 months ago) I was trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0, without success because the globalize3 ruby-gem compatibility. Today I'm trying again to do the upgrade, without success because the globalize3 ruby-gem compatibility.
I tried all possible solutions that I found on the web (even those that refer to the rails4 branch) but no one works for me: I get error outputs as-like those present in my previous question. However, as you can read here, it seems that someone (lucky, maybe) has solved the compatibility issue. I am not a "lucky" one and, since I aim to use features added by Rails 4 and still use globalize3, I would like to know if there is someone running Rails 4 and the globalize3 with success. If so, what did he / she made to make that?
What is the compatibility status between globalize3 and Rails 4?
Note: I also opened a issue at github.
I'm using it with rails 4 and have no issue.
In my Gemfile:
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
Run bundle update instead of bundle install to resolve all dependencies again. Just lock gems that you don't want updated by indicating a version specifier as explained here http://bundler.io/v1.3/gemfile.html.

Using gems vs copying folders for Bootstrap

I'm working on a Rails App with Bootstrap 3. What is the difference between adding bootstrapp-sass to my Gemfile and simply downloading Bootstrap and copying the css and javascript files into their respective folders of the Rails app?
I'd go with a gem because it simplifies the updating process. No manual copy pasting makes me a happier developer.
Also, bootstrap-sass is a port to SASS from the official Bootstrap, which uses LESS.
With gems you can always have the latest version if you keep your bundle up to date. If you copy the files, you will have to update manually when there are newer versions of the framework.

How to detect the rails version from an installed ruby gem

I want to modify an existing gem to compatible with new rails versions. My requirement is as follows
I have a gem which runs in both rails 2 and 3. But it has some stylesheet copy functions. So as you already know rails 2 has stylesheets in public/stylesheets folder, But in rails3 has assert pipe line.
So what I want to do it, I want to detect the rails version using by my gem installed rails application and according to the version I will handle the file copy.
My question is How an installed ruby gem reads the current rails applications version ?
Or is there any other way to do it ?
thanks
I took a look around in the latest stable source for Rails and found a version.rb file which indicated I could do this:
Rails::VERSION::STRING #=> "3.2.6"
If you look at Rails 2.3, you’ll find that the same thing works there.

How do I use an old version of Rails with Aptana RadRails?

I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible (the site is using some pre 2.0 version, not sure of the exact number offhand).
Is there a way to tell RadRails to get and use a specific version of Rails? Or is there something I can do at the command line to change the installed version of Rails? I'm only vaguely familiar with the "gem" package system, but I'm assuming it would involve that.
Any help would be much appreciated!
Use the Rake task rails:freeze:gems in your rails project and give it the version you want to use. For example:
rake rails:freeze:gems VERSION=2.1.0
That will put the right version of Rails into vendor/rails, which is loaded by default if it exists.
If you don't want to freeze the gem into your project (using rake rails:freeze:gems), you can install the rails gem of the version you want to use:
gem install rails -v 2.0.2
and then specify the rails gem to use in your config/environment.rb:
RAILS_GEM_VERSION = '2.0.2'

Resources