We now have Rails 4 support on Codelearn Playground . You can confirm the same by typing rails -v in the Terminal inside your home directory.

Screen shot 2013-08-15 at 11.32.36 PM

What about my old Rails 3 app ?

Dont worry. If you go inside any of your old apps & type rails -v, you would see that the Rails version is the same as defined in your Gemfile, which would be most probably Rails 3.2.13 unless you have fiddled with your Gemfile.

Will ‘rails new’ command create a Rails 4 app now ?

No. That would completely break our tutorial. Our tutorial follows Rails 3 conventions. There are some differences between Rails 3 & 4 conventions. rails new command will still create a Rails 3.2.13 app for you. You can confirm the same by creating a test app, going inside it in Terminal & typing rails -v to view the version.

How do I get a Rails 3 app while ‘rails -v’ in my home directory shows Rails 4 ?

Good question. We have hacked our way through this implementation. But first a small story.

I had earlier tweeted seeking a Rails expert who would be interested to upgrade Codelearn course to Rails 4. Manu S Ajith saw the tweet, quickly forked the public repos for your_site & shared_todo_app, changed the code to be compatible with Rails 4 & sent me his github repo links.

He went ahead to test the app on Codelearn Playground. Now this messed things a bit. We have a system wide Ruby & Gems installation using RVM. For the uninitiated, the Ruby & Gems (including Rails) lie inside /usr/local/rvm & not inside the home directory of a user.

So Manu cloned the github repos in his Codelearn Playground & did a ‘bundle install’. It upgraded the Rails binary to Rails 4.0.0 from Rails 3.2.13 . This happened on August 14. Now the issue was – anybody who created a Rails app ended up creating a Rails 4 app. It means that some of the instructions from the tutorial will not work as expected. I had to uninstall the Rails 4.0.0 version to get back the Rails 3.2.13. I did this within 12 hours of Manu upgrading Rails to version 4.0.0 .

This incident got me thinking. I took this as an opportunity to have Rails 4.0.0 on the system & also made sure not to break the tutorial instructions. How did I do it ? Well, we have a binary /bin/rails-codelearn that is aliased to the rails command for Codelearn users. For rails new, it eventually executes rails _3.2.13_ new which creates a Rails 3 app. Thanks to Manu who pointed this hack to me.

So how do I create a Rails 4 app on Codelearn Playground ?

Simply run

rails _4.0.0_ new your_app_name

to create a Rails 4 app. Once created, other Rails commands like rails generate controller, rails generate model etc would not require you to put _4.0.0_ in it.

I think I mistakingly created Rails 4 app. How do I downgrade ?

I have not done this myself, but I think its best to discard the directory (rm -rf rails_app_directory) & start from scratch. Reason being, Rails 4 has some differences in configuration file as compared to Rails 3. If you are brave & want to figure your way out, follow the instructions below to change the Rails version inside your app.

Open your Gemfile, look for a line for the rails version. It should have ’4.0.0′. Change it to ’3.2.13′, do ‘bundle update’ & you should be good. To cross check, run rails -v inside your app to see the Rails version.

If you created your app on August 14 or 15 on Codelearn, make sure to check your app’s Rails version. You should downgrade it to Rails 3.2.13 in case your are finding difficulties running your app in-spite of following instructions of Codelearn tutorial

Go ahead & create a Rails 4 app. Also, if you are interested to upgrade Rails course at Codelearn to Rails 4, do get in touch with me by either dropping a comment, tweeting to me at @pocha or dropping an email to pocha@codelearn.org .

Learn Android by creating a twitter app. Visit http://www.codelearn.org/android-tutorial/.
  • 1cent-advice

    @pocha good progress. I remember I was an early user of codelearn but stopped using it long time back, I don’t know if you have github integration now, but when I ws a user, I needed to zip my app download it to my pc and then push it to github from my pc. Not a very good user experience. Aalso, i realized I needed a learning environment that also fits in well as an IDE. I gave that feedback and Ashish replied that you people have no plans of being an IDE. As a result of those issues I moved off codelearn.

    Is this now part of your plans to also be an IDE or are you just using nitrous to draw attention.I am not trolling, I just felt then and still feel so now that you people can be a player in both market. the learning and IDE market. After all learning your next focus is on building app, those now become your IDE payng users. That way your learners don’t mature and more to Nitrous or Koder or Cloud9. You can close the loop. That is your learning environment serve as a funnel to the IDE business.

    Just a free feedback even though i have no plans of returning to codelearn as I am a happy user of Nitrous. Again, I am not trolling is the truth. Seriously, Nitrous is awesome. I no longer use my Ububtu local dev environment. I do dev work on Nitrous and can push to heroku as well as deploy to Github.

    • http://www.codelearn.org/ Ashish Sharma

      Hi, good to hear from you. Rails 4 support is part of introducing Rails 4 course on Codelearn. You are right abour your observation. Quite a few people are using Codelearn like Nitrous.

      Cloning & pushing to github works on Codelearn. So heroku should be supported too.

      Having said that our focus is still tutorial creation. The playground is imp but as for now, we are not yet there compared to nitrous.

      Thanks for checking back though :)

  • 1cent-advice

    Sorry, I meant deploy to Heroku and push to github.