Quantcast
Channel: Debug Area » ruby
Browsing latest articles
Browse All 8 View Live

creating a postgresql schema from inside a rails migration

If you ever need to create a schema from inside a migration, write this: def up execute "CREATE SCHEMA some_schema" end   def down execute "DROP SCHEMA some_schema" end Migration code is available for...

View Article



access the database of a heroku application from another heroku application

First thing you have to do is find out the DATABASE_URL of the app you’re interested in. Run: heroku config –app your_app to get it. Then, in the other app, run this: heroku config:add...

View Article

send email with ruby and gmail

Simple integration of gmail’s emailing service using Net::Smtp package. Before using it, just make sure to change the from and to addresses, and insert your gmail authentication data. require...

View Article

Ruby Tip: uninstalling a specific version of a ruby gem

Suppose you want to uninstall a specific version of a gem. Let’s say we want to get rid of rake v10.1.1: gem uninstall rake -v 10.1.1

View Article

Ruby Tip: multiline comments

If you want to comment more than one line of Ruby code, you can place them inside a: =begin   =end block. The thing is, =begin and =end must be at the very beginning of the line.

View Article


An error occurred while installing debugger-linecache (1.1.2), and Bundler...

The following command helped me deal with this error: gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p392 Of course, replace ruby-1.9.3-p392 with your actual...

View Article

rvm tip: running a script with sudo priviledges

Have you ever needed to run a script with root priviledges? Don’t try to do this: sudo ruby some_script.rb As this will not use the same ruby binary as the one in your current environment. Instead, use...

View Article

working with encodings when reading/writing files in ruby

File.open("some_file","r:windows-1250") File.open("some_file","w:windows-1250")

View Article

Browsing latest articles
Browse All 8 View Live




Latest Images