ActionCable without upgrading to Rails 5 beta - ruby-on-rails

I currently have a Rails app running on 4.2.5, and I want to use ActionCable without having to upgrade the whole thing to the Rails 5.0.0.beta3 version and risk breaking all of the other gems.
Following guides I've seen on the internet, I've tried
gem 'actioncable', github: 'rails/actioncable'
which doesn't work because the ActionCable repo has been merged into the Rails repo. I even tried
gem 'actioncable', github: 'rails/rails'
but this doesn't seem to work of the re-numbering of the versions that happened when ActionCable merged into Rails. (The only version below 5.0.0.beta* is the 0.0.0, which seems to be an empty gem.)
I also tried setting the source to rubygems.org in hopes of finding an older pre-merged version, but was unsuccessful.
What can I do to integrate ActionCable into my 4.2.5 project without upgrading to Rails 5?
Conversely, when could we anticipate the first stable release of Rails 5? :)

You can have both GemSets, so you can use rails 4 and rails 5 whenever you want.
First, update the ruby gem manager by $ gem update --system, install Nokogiri if you haven't $ gem install nokogiri.
Now lets set your rails 4 GemSet (you might have to update ruby, it will tell you if you need to)
$ rvm use ruby-2.3.0#rails4.2 --create
$ gem install rails --version=4.2.5
$ rails -v
your rails version should be 4.2.5 at this point.
Now lets set your rails 5 GemSet
$ rvm use ruby-2.3.0#rails5.0 --create
$ gem install rails --pre
$ rails -v
your rails version should be 5 beta3 at this point.
We are done, now you only need to change between GemSets, depending on your needs, by doing this.
for rails 4 use = $ rvm use ruby-2.3.0#rails4.2
for rails 5 use = $ rvm use ruby-2.3.0#rails5.0
Now, you can use and experiment rails 5 without risking your rails 4 gems and stuff.
You can do exactly the same for other Rails versions if you want.

I have same issue,But i solved.just check this
Just try your rails console
check your rails version rails -v
may be rails (4.2.7.1)
Then you need to check gem list, i mean gem list -l
Now you can see your all gem with versions.
Then you need to instsll gem install rails -v 5.0.0beta2
once installed rails check gem list, gem list -l
Then you can see rails (5.0.0.rc2, 5.0.0.beta2, 4.2.7.1)
You successfully installed rails 5.0.0
Then you do bundle update
Update all gem and supporting rails 5.0.0,this is work for me just try this.

Related

rails -v keeps saying Rails 3.2.13 after installing 4.2.2

What gives?
I typed this in gem install rails -v 4.2.2
After that, I tried rails -v, and it keeps coming out Rails 3.2.13
Why is this?
My ruby version after ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
You can manage gems with bundler (http://bundler.io/)
Put this on your Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem install bundler
and then
bundle install
bundle exec rails -v
If you still working without bundler, you can make
gem list
look at your rails version and then uninstall older versions
gem uninstall rails --version 3.2.13
and then
rails -v
I've encountered this before. And this is what I did.
Change version of rails
Just change the versions.
If you have multiple versions of Rails installed, you'll get conflicting information like this.
If you need to run a command with a specific version of Rails, you can specify the version as part of the command, eg.
rails _4.2.2_ -v
That will tell you you are using Rails 4.2.
Once you've created a new app by doing something like rails _4.2.2_ new app_name, then the Gemfile for that app will specify Rails 4.2.2 and you can drop the special prefix.

How to downgrade my rails version?

I am using rails version 4.2.0. How can I downgrade to version 3.2.19?
I tried the following:
I opened command prompt.
I typed gem uninstall rails
Some options came for rails version then I selected my current version and pressed entered.
Then typed gem install rails -v 3.2.19 for installing this version.
I went to my Site directory and typed rails new blog
When I opened the Gemfile of blog application I found again Rails version 4.2.0 is present there.
Do:
gem uninstall rails
gem uninstall railties
Followed by:
gem install rails -v 3.2.19
To check a rails version, directly do:
rails -v
Another workaround:
add following to your Gemfile:
gem 'rails', '3.2.19'
and then run:
bundle install
Or you dont have to downgrade. You can always create a new rails app with a specific version(if that version is already installed)
rails _3.2.19_ new myApp
That is not good approach to uninstall a global version of Rails. So just create a Rails app:
rails new app
then change Rails version in its Gemfile, and issue bundle install:
cd app
sed "s/'rails', '~> 4.2.0'/'rails', '~> 3.2.19'/" -i Gemfile
bundle install
Then, I believe, you should change all the dependent packages to older versions.

Uninstalling rails from command line

I am trying to uninstall rails from my computer.Whenever I run the command gem uninstall rails ,it gives me the following error
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check gem list -d rails
Does this cover your question?
Uninstall Rails completely
It is possible that you have multiple versions of Rails installed in your system. Thus, that command might have failed by not deciding which Rails version you intended to remove.
Check your Rails versions by running gem list -d rails or gem list | grep rails and note the versions (Example, I have 3.2.8, 3.2.5, 4.0.0).
To uninstall any version use:
gem uninstall rails -v 3.2.8

downgrading rails 4 to 3.2

I have the Rails 4.0.0.beta1 installed but I need downgrade to Rails 3.2.13.
I've used gem install rails 3.2 but Rails continues as 4.0.0.beta1.
I searched existing doubts and try to follow the answers however none worked for me.
Think this is a simple doubt and I need to solve.
This answer my question: How to set default rails version for a project?
You have the same problem as listed here.
Here is what worked for me, and should also for you. It's a more general solution that works regardless of your specific version of the Rails beta. Please note that in order to shift back to 3.2.13 (or whatever version you'd like to go back to), you must remove Railties as well as Rails.
Just do:
gem uninstall rails
Then, select the version of Rails 4 you have and delete it.
Then, do:
gem uninstall railties
And do the same thing.
When I uninstalled the Rails 4 version of railties, it told me that dependencies for a couple gems (coffee-rails and sass-rails) wouldn't be met. So I just did the same thing with both of them as I did above, and deleted their Rails 4 versions as well (for example, for sass-rails, I had a version installed called sass-rails-4.0.0.rc1).
And done! The terminal should list 3.2.13 as your current Rails version.
Unless you're using bundle exec, Rubygems will always use the latest installed version of a gem. You need to uninstall the version you don't want.
gem uninstall rails --version 4.0.0.beta1
The answers to gem uninstall rails --version xxx should remove the rails gem just fine.
However, in the event you want or need to have multiple versions of rails available simultaneously, you can use bundler to load the correct versions of gems (as intended).
$ bundle exec rails in the project directory that lists the version of rails in the Gemfile should let you load the required gems without conflict.
Additionally, rvm and its gemset feature could also let you accomplish the same goal without needing to wrap everything with a bundle exec
Rails will use the version specified in Gemfile:
gem "rails", "4.0.0.beta1"
Replace it with the version you'd like to use instead:
gem "rails", "~> 3.2.0"
Of course, you will also need to change your code and config to use the old Rails API.
I had the same problem with Rails 4.0.0 final version. To check what is currently installed you can run the following:
>pik gem list
Then I checked the rails versions. It showed rails 3.2.14 (what I wanted) with railties 4.0.0, 4.0.0.rc2 and 3.2.14.
I then ran
>gem uninstall railties
and uninstalled all other versions except 3.2.14 and now it works well. The problem was that when Rails 3.2 installation is called, the latest (or all) versions of railties is installed.
If you have other versions of rails other tan the one you want, you can removed them with
>gem uninstall rails
and remove the versions of rails you do not want to have.
Try the following in your console. It will update or install rails to the specified version.
gem update rails 3.2.13

downgrade to rails 2.3 from 3.1.1[how to]

I need to install redmine1.4 for that need to have my rails version2.3, but I have rails3 .
How can I downgrade my rails version -> Rails 2.3.14. Thanks
I not sure I get the question. From what I understand you want to install Redmine which requires rails 2.3.x but you have rails 3 gem installed. I'm not familar with redmine but I think it should use bundler and simple bundle install should do the trick.
If not, the simplest solution would be to uninstall rails 3 gem and install rails 2.3.x gem. For that you need to:
$ gem uninstall rails
$ gem install rails --version "2.3.14"
However this may broke your other apps which use rails 3.x ver. Thus I recommend using one of following tools for managing ruby versions and use feature called gemsets:
RVM
rbenv

Resources