Skip to content

Category Archives: Ruby

OpenSolaris: Problem Installing eventmachine gem

set this var before gem install command [code]export CXX=g++[/code]

  • Share/Bookmark

Setup:: Rubyworks & rMagick

I tried this before mod_rails launched. Pushing my command log for reference. This setup uses rubyworks, details can be found here http://studios.thoughtworks.com/rubyworks I tried this on a redhat machine. The setup seems to be working perfectly fine. clear 2 ruby 3 yum install ruby 4 wget http://rubyworks.rubyforge.org/RubyWorks.i386.repo 5 sudo cp RubyWorks.i386.repo /etc/yum.repos.d/ 6 uname -A [...]

  • Share/Bookmark

/bin/rm: Argument list too long tmp/sessions/ruby_sess.*

Well this happens when there are too many files to process: Best way in this case is to do batch processing: Sample command: find . -name ‘ruby_sess.*’ -print0 | xargs -0 rm

  • Share/Bookmark

RAILS_ROOT

RAILS_ROOT gives you relative path within the applications it works fine as far as you need the path within rails application. How about getting absolute path to rails folder? I found one way, and thats from the ENV hash. You can use ENV['PWD'] to find absolute path to the rails folder. Any other ways ?? [...]

  • Share/Bookmark

Ruby: Can’t modify frozen string

Workaround: _use_me = frozen_string.dup

  • Share/Bookmark

Rails RJS redirect

page.redirect_to :action => ‘thanks’, :p1 => @g_resp.params["_code"], :p2 => @r_id

  • Share/Bookmark

textbox image alignment problem

Problem: [code] text_field(:member, :dob,:size=>"20", :maxlength => "50",:tabindex=>"22") img_tag [/code] Fix: [code] text_field(:member, :dob,:size=>"20", :maxlength => "50",:tabindex=>"22") img_tag {:style="position:absolute"} [/code]

  • Share/Bookmark

fastcgi lighttpd rubyonrails Error: getcwd no such file or directory

I got this error today while deploying rails application on running lighttpd server. Errno::ENOENT (No such file or directory – getcwd) I replaced application directory without stopping lighty and got error while trying accessing app via browser. I went off by merely restarting lighthttpd Seems like server creates/uses some file “within” rails app folder which [...]

  • Share/Bookmark

Ruby HEREDOC Syntax

[code lang="html"] html =

  • Share/Bookmark

Rails: Cross Database development

Its a piece of cake developing applications that run on multitude of Database management solutions. All you need to keep Database schema scripts handy. Here is how you do it using rails scripts: [code lang="php"] > ruby script\generate migration Contact [/code] This will create an empty file in db/migrate folder for contact table. You need [...]

  • Share/Bookmark