Pages

How to set up ( Fedora php ruby on rails )

Sunday, June 12, 2011

Cpanel gems installation errors

You need ssh access to server to perform all these tasks


Did you get an errors like this when installing gems on cpanel



Missing these required gems:
will_paginate

You're running:
ruby 1.8.7.173 at /usr/bin/ruby
rubygems 1.3.5 at /home/bronze/ruby/gems, /usr/lib/ruby/gems/1.8/

Run `rake gems:install` to install the missing gems.


You need to add path in your .bashrc file



if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export PATH=$PATH:$HOME/ruby/gems/bin
export GEM_PATH=$HOME/ruby/gems:/usr/lib/ruby/gems/1.8/
export GEM_HOME=$HOME/ruby/gems

And this to your config/environment.rb file



ENV['GEM_PATH'] = '/home/username/ruby/gems:/usr/lib/ruby/gems/1.8/'

Note:

Must replace username with your server username

What next


Source your .bashrc file or create new ssh session by logging out and logging in back


In most cases you won't have your .bashrc and .bash_profile file and you need this to make it work


Code for .bash_profile



if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

Wednesday, June 8, 2011

Encoding::UndefinedConversionError Ruby/Rails

Problem is you opening a binary file and writing it somewhere on other file using ruby/rails


Solution


open file as binary and write it back



File.open(target_file, 'w+b', 0644) do |file|
file.write(destination_file.data)
end