Posts Tagged ‘rails’

Rails 3.0: It’s ready!

Tuesday, August 31st, 2010

“Rails 3.0 has been underway for a good two years, so it’s with immense pleasure that we can declare it’s finally here. We’ve brought the work of more than 1,600 contributors together to make everything better, faster, cleaner, and more beautiful.”

Riding Rails: Rails 3.0: It’s ready!

How to use git plugins in your subversion rails project

Thursday, August 28th, 2008

If you like me still use subversion for your own rails projects but you want to use all the latest and coolest rails plugins that are hosted in a git repository you need to do as follows.

Start with installing git. If you use OS X you can download an installer here.

After you’ve done that use the following line to clone the remote git repository in your local vendor/plugins directory.

git clone --depth 1 git://github.com/fauna/has_many_polymorphs.git vendor/plugins/has_many_polymorphs

Change the address to the git repository and the name of the directory under vendor/plugins to fit your needs. In the above example I got the has_many_polymorphs plugin from github.

The checked out directory can then be added to your subversion repository like all other files. If you later want to update the plugin all you have to do is enter the directory and execute.

git pull

This ‘Using Git like svn:externals’ article helped me figure this out.

How to copy production database data to the development database with Capistrano

Friday, June 27th, 2008

At times it is useful to easily be able to copy the content of the production database to the database running on your local development machine. In my case I use mysql on the production server and sqlite on my MacBook Pro. Unfortunately the use of different database servers makes this task a bit more tricky.

With a bit of googling I found a bit of code here and there which I combined and modified and turned into the following snippet of code to be dropped into your Capistrano deploy.rb file.

desc "Copy production database to development database" task :update_dev_db, :roles => :db do db = YAML::load(ERB.new(IO.read(File.join(File.dirname(FILE), 'database.yml'))).result)['production']

filename = "#{db['database']}_dump.#{Time.now.strftime '%Y%m%dT%:%H%M%S'}.sql" remote_path = "#{current_path}/tmp/#{filename}" local_path = "tmp/#{filename}"

on_rollback { run "rm #{remote_path}" }

run "mysqldump -u #{db['username']} --password=#{db['password']} --skip-opt #{db['database']} --complete-insert=true --skip-quote-names --no-create-info > #{remote_path}" do |ch, stream, data| puts data end

get remote_path, local_path

converted = File.read(local_path).gsub(/\'/, '\'\'') File.open("#{local_path}_converted", 'w') {|f| f.write(converted)}

system "sqlite3 db/dev.db < #{local_path}_converted" system "rm #{local_path}" system "rm #{local_path}_converted" run "rm #{remote_path}" end

There is a small problem with \n (new line) characters that on the production server get evaluated as they should. However, on the development machine after the data has been exported from mysql and imported into the sqlite database the \n characters will show as \n on the screen. But for me this is good enough for now.

Free Rails 2.1 Book

Wednesday, June 11th, 2008
If you’re eager to learn how to use all the new features in Rails 2.1, Carlos Brando just released a free book titled Ruby on Rails 2.1, What’s New?.

Free Rails 2.1 Book

Back to Apache

Wednesday, May 21st, 2008

I’ve used nginx with php through fastcgi for the php sites and with a mongrel cluster for each rails application on this machine for quite some time now and I’ve been happy with that setup.

However, with the number of rails applications increasing, the number of mongrel instances running increases even faster as each application needs between 2 and 5 mongrel instances.

I see Phusion Passenger (a.k.a mod_rails for Apache) as a way to simplify my setup. Passenger is supposed to do the same magic with Apache for rails as mod_php does for php.

The first step towards this dream setup was to change back from nginx to apache2. As I’ve had to have apache running behind ssl for the subversion repository changing back just meant figuring out how to configure apache to proxy for the mongrel clusters but a bit of googling solved that pretty quickly.

So right now this site is yet again powered by Apache but I’m still running mongrels to serve the rails applications. The next step is to move over to passenger, which I hope to do before the weekend.

I’ll let you know how it goes.

Developing Rails Applications on Mac OS X Leopard

Saturday, March 1st, 2008

ADC – Developing Rails Applications on Mac OS X Leopard

Ruby on Rails 1.2.6: Security and Maintenance Release

Monday, November 26th, 2007

The rails core team has released ruby on rails 1.2.6 to address a bug in the fix for session fixation attacks (CVE-2007-5380). The CVE Identifier for this new issue is CVE-2007-6077.

You should upgrade to this new release if you do not take specific session-fixation counter measures in your application. 1.2.6 also fixes some regressions when working with has_many associations on unsaved ActiveRecord objects.

Riding Rails: Ruby on Rails 1.2.6: Security and Maintenance Release

How Oracle Mix was built

Friday, November 23rd, 2007

We started coding about 3.5 to 4 weeks before Open World. At that point, we still didn’t have hardware and there were a ton of unknowns surrounding jRuby running on the Oracle AppServer (and if it did, what performance would be like). We bit the bullet and went for it. Rails was an essential ingredient to this project. I don’t know of other frameworks that would have enabled us to build this particular application so rapidly.

Oracle AppsLab » Mix, jRuby on Rails, Small Teams, Agile, and it’s Effects on the World

Ruby on Rails is the shit! ;) 

Shoulda – Making tests easy on the fingers and eyes

Wednesday, November 14th, 2007

In the comments to the 37signals post about how they test their software I found a link to Shoulda. At first glance it looks amazing. The test are suddenly a piece of art!

I’m definitely going to try this in one of my projects.

How 37signals test their software

Wednesday, November 14th, 2007

David writes about how they at 37signals test their software.