Upgrading RailsPlugins.org to Rails 3 - Part 1
2010-05-18 04:34:07 +0000
Note, this post has been recreated now that Rails 3 has been released. Please see: Updating Railsplugins.org to Rails 3
New version available
Please see the above new version, the below is old content and not really usable any more
Old content:
I am going to do a series of blog posts covering the upgrade of RailsPlugins.org to Rails 3. You can follow along as we go and comments or suggestions are welcome!
This upgrade was done using at least Rails 3 beta3. If try it on anything earlier, it will most likely go boom.
Process
Going about upgrading a non trivial site like RailsPlugins.org requires a process to make sure it works:
- Confirm the gems and plugins you are using either work with Rails 3, there are alternatives you can use, or you are interested in helping upgrade them – this is the most important step in terms of scope and time required to get the job done.
- Run all specs and features or tests and make sure they pass – if you don’t have any, then now would be a good time to install Cucumber and write at least features covering all the main user stories of your site.
- Run the rails_upgrade plugin to highlight areas of concern
- Upgrade the application to Rails 3
- Fix all concerns within your application itself, ignoring plugins for now
- Go through each plugin and gem, either installing newer versions that are Rails 3 compatible, or replacing / fixing them
- Run all specs and features and tests and make sure they pass
- Boot up and play around in your development environment
- Deploy on a staging environment to confirm your upgrade
- Deploy live and watch like a hawk.
I am going to document all these steps as part of upgrading the RailsPlugins.org site.
Confirm the gems and plugins you are using
Going through all the plugins and gems we use on the RailsPlugins.org site, showed up that most of them have Rails 3 versions available or listed as “Maybe”. I guess I’ll be helping people get it done! :)
Run all specs and features
I have good coverage on RailsPlugins.org and it is all green… so onward and upwards.
Run the upgrade plugin
The rails_upgrade plugin is hosted on github and up to date with all the latest bells and whistles of Rails 3, so we’ll use that:
$ script/plugin install git://github.com/rails/rails_upgrade.git
And then once installed, we do:
$ rake rails:upgrade:check
Which gives us pages of output, simplified down to:
Deprecated constant(s) Constants like RAILS_ENV, RAILS_ROOT, and RAILS_DEFAULT_LOGGER are now deprecated. More information: http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/ ... Deprecated session secret setting Previously, session secret was set directly on ActionController::Base; it's now config.secret_token. More information: http://weblog.rubyonrails.org/ ... Old session store setting Previously, session store was set directly on ActionController::Base; it's now config.session_store :whatever. More information: http://weblog.rubyonrails.org/ ... Deprecated ActionMailer API You're using the old ActionMailer API to send e-mails in a controller, model, or observer. More information: http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3 ... Old ActionMailer class API You're using the old API in a mailer class. More information: http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3 ... Soon-to-be-deprecated ActiveRecord calls Methods such as find(:all), find(:first), finds with conditions, and the :joins option will soon be deprecated. More information: http://m.onkey.org/2010/1/22/active-record-query-interface ... named_scope is now just scope The named_scope method has been renamed to just scope. More information: http://github.com/rails/rails/commit/d60bb0a9e4be2ac0a9de9a69041a4ddc2e0cc914 ... Old Rails generator API A plugin in the app is using the old generator API (a new one may be available at http://github.com/trydionel/rails3-generators). More information: http://blog.plataformatec.com.br/2010/01/discovering-rails-3-generators/ ... Old router API The router API has totally changed. More information: http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/ ... Deprecated ERb helper calls Block helpers that use concat (e.g., form_for) should use <%= instead of <%. The current form will continue to work for now, but you will get deprecation warnings since this form will go away in the future. More information: http://weblog.rubyonrails.org/ ... New file needed: config/application.rb You need to add a config/application.rb. More information: http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade ...
OK, so this might be too long for a single blog post, let’s take it in sections then.
Deprecated constant(s)
This section produced the following output:
Deprecated constant(s) Constants like RAILS_ENV, RAILS_ROOT, and RAILS_DEFAULT_LOGGER are now deprecated. More information: http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/ The culprits: - /Users/mikel/Code/railsplugins/lib/tasks/environments.rake - /Users/mikel/Code/railsplugins/lib/tasks/cucumber.rake - /Users/mikel/Code/railsplugins/lib/tasks/hoptoad_notifier_tasks.rake - /Users/mikel/Code/railsplugins/lib/tasks/rspec.rake
Which doesn’t seem too bad. I only really have one file in my application that is to blame, environments.rake, the other three are part of plugins that RailsPlugins.org uses, and I trust that the Rails 3 versions of these which we will update to later, should handle themselves.
Opening up environments.rake we see:
# Sets environments as needed for rake tasks
%w[development production staging].each do |env|
desc "Runs the following task in the #{env} environment"
task env do
RAILS_ENV = ENV['RAILS_ENV'] = env
end
end
task :testing do
Rake::Task["test"].invoke
end
task :dev do
Rake::Task["development"].invoke
end
task :prod do
Rake::Task["production"].invoke
end
This is a custom rake file we use to easily set environments for rake tasks. However, setting RAILS_ENV is deprecated in Rails 3. In Rails 3, you can set Rails.env directly with an assignment. So changing this rake task to be Rails 3 compatible would be:
# Sets environments as needed for rake tasks
%w[development production staging].each do |env|
desc "Runs the following task in the #{env} environment"
task env do
Rails.env = env
end
end
task :testing do
Rake::Task["test"].invoke
end
task :dev do
Rake::Task["development"].invoke
end
task :prod do
Rake::Task["production"].invoke
end
OK good. As I mentioned above, we are going to eave the cucumber, rspec and hoptoad files to be updated by their respective gems as we move along.
Deprecated session secret setting
The rails_upgrade plugin has pointed out the following:
Deprecated session secret setting Previously, session secret was set directly on ActionController::Base; it's now config.secret_token. More information: http://weblog.rubyonrails.org/ The culprits: - /Users/mikel/Code/railsplugins/config/initializers/session_store.rb Old session store setting Previously, session store was set directly on ActionController::Base; it's now config.session_store :whatever. More information: http://weblog.rubyonrails.org/ The culprits: - /Users/mikel/Code/railsplugins/config/initializers/session_store.rb
Which looks like this:
config/initializers/session_store.rb
ActionController::Base.session = {
:key => ‘_plugins_session’,
:secret => ‘somereallylongrandomkey’
}
In Rails 3, this process was changed quite significantly, with this commit, the upgrade though is very straight forward. First, you reduce session_store.rb to the following:
Rails.application.config.session_store :cookie_store, :key => "_my_app_name_session"
And then, because we now need somewhere to store the secret, you create a new file called config/initializers/cookie_verification_secret.rb and put inside of it:
Rails.application.config.cookie_secret = 'somereallylongrandomkey'
If instead of using cookies, you were using active record as the store, then you obviously wouldn’t need the cookie_verification_secret.rb file and instead would insert any other config you needed into its own file inside of initializers.
This gives us the added bonus of being able to exclude cookie secrets from source control systems.
In the next instalment, we’ll cover getting the RailsPlugins.org site actually up and running on Rails 3.
blogLater
Mikel




2012-04-30 21:40:43 +0000
The host application provides services which the plug-in can use, including a way for plugins to register themselves with the host application and a protocol for the exchange of data with plug ins. Plug ins depend on the services provided by the host application and do not usually work by themselves. Conversely, the host application operates independently of the plug ins, making it possible for end users to add and update plug ins dynamically without needing to make changes to the host application. Thanks.
Regards,
Cheap custom papers writing service
2012-06-09 03:28:17 +0000
Creating a program to have many new features and facilities is the eagerly awaited by many people that use of the program. This is good news foe many people used it/ moving companies san diego
2010-05-18 20:12:51 +0000
The Drink Rails blog picked this post as one of the top ruby on rails blogs of the day.
2010-10-12 17:17:37 +0000
Mickel,
I’m upgrading my application to rails 3. I did the following:
(1) I converted ActionController::Base.session = { :key => ‘_my_site’ } into Rails.application.config.session_store :cookie_store, :key => “_my_site”, and stored this in file “config/initializers/session_store.rb”.
(2) I converted ActionController::Base.session = { :secret => ‘my_session_secret_key’ } into Rails.application.config.cookie_secret = ‘my_session_secret_key’ and stored this in the file “config/initializers/cookie_verification_secret.rb”
(3) In my existing file “cookie_verification_secret.rb”, there was a ActionController::Base.cookie_verifier_secret = ‘my_verifier_secret’. I tried converting this into (a) Rails.application.config.secret_token = ‘my_verifier_secret’, and (b) MySite::Applicatin.config.secret_token = ‘my_verifier_secret’. In both cases, I kept getting the error “ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)”, when I tried to delete an object (an existing post). I also placed the <%= csrf_meta_tag %> in my layout but it does not help. Do you have any suggestion?
2011-11-08 19:41:52 +0000
I have not upgraded at this point. I am a bit nervous that all will work out well. I will probably do it first on my production machine and then go from there. I would be interested in hearing of others who have made the leap.
2011-07-19 00:31:05 +0000
OK, I have made this upgrade but now I am getting some errors and don’t know what to do :(
2011-08-01 11:37:04 +0000
I have not upgraded at this point. I am a bit nervous that all will work out well. I will probably do it first on my production machine and then go from there. I would be interested in hearing of others who have made the leap.
2011-08-08 02:41:17 +0000 Great to read more articles from your side. No doubt it’s really a great article and I felt really great going through your blog post.
2011-09-24 16:11:40 +0000
I am thinking about using a cloud computing host to host my websites. Will there be any problems with my websites when I migrate them over to the cloud hosting? I don’t want the new Rails plugins to cause any glitches during the migration. Thanks!
2012-05-20 08:15:07 +0000
Excellent post and wonderful blog, I really like this type of interesting articles keep it u. I am really loving the theme/design of your web site.
2012-01-13 06:15:25 +0000
sh
2012-01-15 22:35:53 +0000
The ergonomics of a program: the ease with which a person can use the program for its intended purpose, or in some cases even unanticipated purposes. Such issues can make or break its success even regardless of other issues. Thanks a lot.
Regards,
Winfield Estate
2012-01-31 01:36:05 +0000
The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Thanks.
Regards,
cv help
2012-09-03 04:19:33 +0000
I have not used this app so I will try this application. If indeed these applications can provide a lot of positive things on the blog that I have, I will use the application in the long term.
Tibetan Yoga
2012-09-03 04:17:26 +0000
I have not used this app so I will try this application. If indeed these applications can provide a lot of positive things on the blog that I have, I will use the application in the long term. The Yoga of Discrimination
2012-09-03 04:17:49 +0000
I have not used this app so I will try this application. If indeed these applications can provide a lot of positive things on the blog that I have, I will use the application in the long term. The Yoga of Discrimination
2012-02-19 13:16:54 +0000
Using Smartphone is not easy. The software should be upgraded. Therefore, the performance is good. index futures
2012-02-20 10:42:26 +0000
I think it’s very difficult to create an application using it. The language are also not same as the one in this era.
Fishing Lodges Alaska
2012-02-20 10:43:08 +0000
I think it’s very difficult to create an application using it. The language are also not same as the one in this era.
Fishing Lodges Alaska
2012-02-28 22:26:38 +0000
Improving Smartphone is likely to make these devices have got better performance. The brand new computer software package normally has better level of superior. Next, they’ll acquire brand-completely innovative factor. forex iphone
2012-02-15 03:41:44 +0000
Debugging is a very important task in the software development process, because an incorrect program can have significant consequences for its users. Some languages are more prone to some kinds of faults because their specification does not require compilers to perform as much checking as other languages. Thanks.
Regards,
toronto lofts
2012-03-11 04:37:01 +0000
I had problem with the update and it was so complicated to get back to the last version I got, so this time I won’t be updating it anymore unless if one of my smart friends is here to help.
2012-03-27 08:24:55 +0000
If I unable to listen this rails plugins coding, Then can say it is so effective post.
2012-03-30 21:16:59 +0000
The programmer’s primary computer language is often prefixed to the above titles, and those who work in a web environment often prefix their titles with web. The term programmer can be used to refer to a software developer, software engineer, computer scientist, or software analyst. Thanks.
Regards,
click here
2012-04-19 00:04:04 +0000
I will try to do it like you said. I am sure that I will have excellent results
2012-04-24 20:50:48 +0000
The instructions involved in updating financial records are very different from those required to duplicate conditions on an aircraft for pilots training in a flight simulator. Although simple programs can be written in a few hours, programs that use complex mathematical formulas whose solutions can only be approximated or that draw data from many existing systems may require more than a year of work. Thanks.
2012-03-19 22:11:49 +0000
High level languages are compiled or interpreted into machine language object code. Software may also be written in an assembly language, essentially, a mnemonic representation of a machine language using a natural language alphabet. Assembly language must be assembled into object code via an assembler. Thanks.
Regards,
reversing my fibromyalgia with guaifenesin
2012-03-27 23:54:57 +0000
Entering a program in assembly language is usually more convenient, faster, and less prone to human error than using machine language, but because an assembly language is little more than a different notation for a machine language, any two machines with different instruction sets also have different assembly language. Thanks.
Regards,
rv dealers
2012-04-27 04:10:43 +0000
The simple programs can be written in a few hours, programs that use complex mathematical formulas whose solutions can only be approximated or that draw data from many existing systems may require more than a year of work. Thanks.
Regards,
phlebotomy.net
2012-06-16 02:33:13 +0000
The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Thanks.
Regards,
web design companies
2012-07-10 13:29:54 +0000
I have used rails a little bit, and so far I really like it.
Fort McMurray Real Estate & Homes
2012-07-10 13:31:01 +0000
This is a great, easy to understand tutorial on how to upgrade to the new Rails. Thanks from a newbie.
Edmonton Real Estate & Homes
2012-07-13 18:43:02 +0000
There are several programs that are deliberately divided into sections with a variety of reasons there. This is perfectly normal and very common. shower grates
2012-07-14 15:02:18 +0000
There are many applications or many things that can be divided into several sections for the efficient use of space and time. You do have to use a lot of effective and efficient. 服飾批發
2012-07-23 20:41:19 +0000
Something which is divided into several parts is usually a great thing and will not fit if put together. Therefore, we can indeed use a lot of consideration to this matter. glock magazines
2012-07-27 00:16:24 +0000
There are many people who deliberately share many things in life. One way is to divide a lot of things associated with existing applications and programs.
2012-08-04 05:36:56 +0000
If you want to repair your clarinet by your own then it is possible after some guideline. First of all you should be aware of some important clarinet parts. The screws are some of the most critical clarinet parts.
2012-08-04 05:40:31 +0000
I saw a blog on internet, the title was “DMAA banned Australia”. The title attracted me. When I read the details I came to know that DMAA is being banned in Australia because of supposed health risks.
2012-08-04 05:42:43 +0000
If anyone of you is interested in bulking up without using illegal or dangerous supplements then it’s a better idea to have a hordenine supplement, but before using it you should be aware of hordenine side effects.
2012-08-04 05:43:39 +0000
I recently read an article on pramiracetam. The article was so informative. I came to know that pramiracetam increases the brain ability to synthesize choline. As it is a natural supplement so it an be purchased in bulk.
2012-08-04 05:45:04 +0000
I usually forget phone numbers, when I took my last meal and even names of my grand children. I want to enhance memory by using any effective supplement. My daughter suggested me to use racetams. Let’s see what happen.
2012-09-06 02:52:38 +0000
Nice Article, I feel strongly that love and read more on this topic. it’s very spectaculer.
Mesin Kasir | Komputer Kasir | Jual Barcode | Printer Kasir
Printer Kartu
2012-09-06 02:51:24 +0000
I realy like this article. This is a hash of default values for any email you send, in this case we are setting from the header to a value for all messages in this class, this can be overridden on a per email basis..
Mesin Kasir | Komputer Kasir | Jual Barcode | Printer Kasir
Printer Kartu
2012-09-18 14:11:18 +0000
I have a problem
…
Old session store setting
Previously, session store was set directly on ActionController::Base; it’s now config.session_store :whatever. help with business plan
…
what to do?
2012-09-29 08:55:30 +0000
Only aspire to mention ones content can be as incredible. This clarity with your post is superb and that i may think you’re a guru for this issue. High-quality along with your concur permit me to to seize your current give to keep modified by using approaching blog post. Thanks a lot hundreds of along with you should go on the pleasurable get the job done.
jgef
2012-10-17 09:09:26 +0000
This is a hash of default values for any email you send, in this case we are setting from the header to a value for all messages in this class, this can be overridden on a per email basis..SEO Austin
2012-10-18 05:16:01 +0000
They include applications such as toolbars, download managers and video controllers. Although plugins make your browser more interactive, they can also cause errors and diminish display speed. IE seven makes it easy for you to disable browser plugins or delete plugins you no longer want.
Regards,
reputation management
2012-10-18 05:14:30 +0000
They include applications such as toolbars, download managers and video controllers. Although plugins make your browser more interactive, they can also cause errors and diminish display speed. IE seven makes it easy for you to disable browser plugins or delete plugins you no longer want.
Regards,
reputation management
2012-11-06 05:17:27 +0000
I’ve been searching for some decent stuff on the subject and haven’t had any luck up until this point, You just got a new biggest fan!..
Tips by Bonaca Seattle
2012-11-29 05:57:44 +0000
I would highly recommend reading this book as your starting point for Rails 3 upgrade and with Rails 3 is this website.San Diego Auto injury relief
2013-01-04 09:39:04 +0000
The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.PS3 Emulator
2013-01-19 09:56:29 +0000
Thanks for such a great post and the review, I am totally impressed.Xbox Emulator
2013-04-20 18:41:12 +0000
pfrroyorlzxg
2013-04-20 11:29:10 +0000
esrzsqiifatb
2013-04-13 01:35:19 +0000
auseeempcbzn
2013-04-09 15:30:15 +0000
i like professionals working on this site
2013-04-10 10:40:55 +0000
hjaeirlespyu
2013-04-14 17:25:50 +0000
maagjwuzvodq
2013-04-14 17:26:16 +0000
olonzfzcyrrx
2013-04-14 17:29:06 +0000 this is a fantastic theme hxixthltom click here >:O svqxp, :( xkymktrcdq [url=“http://www.htfjgvvrpmtw.net”]or here[/url] :-/ arpoviyf, :/ gsnrscjrce http://htfjgvvrpmtw.info :-/ arpoviyf, :V wqhnwulahf [url=http://htfjgvvrpmtw.ru]tbzqokpvsb[/url] ;) udqujdhjbrekxyy, :3 skzwmbcixb [link=http://htfjgvvrpmtw.se]wgopiztsxe[/link] :-D udqujdhjbrekxyy, 3:)
2013-04-15 16:48:20 +0000
olloxowckzzg
2013-04-16 08:08:30 +0000
lzqivrhfyebd
2013-04-16 08:09:50 +0000
hwfefberfzqs
2013-05-18 10:26:46 +0000
I was curious if you ever considered changing the page layout of your blog? Its very well written.
אדריכל ומעצב