problem using capistrano on deployment server after server ip address change

Problem
After changing the IP address of your staging server the cap deploy does not work any more and gives you the following error:

** [192.168.0.50 :: err] Host key verification failed.
** [192.168.0.50 :: err] fatal: The remote end hung up unexpectedly

Solution
You would need to login to your staging server (as your deployment user) and do an initial checkout for one time for the ssh keys to work.
So you could do something like the following:

$ ssh user_name@staging_server
$sh -c 'git clone -q git_user@192.168.0.50:repo_name /some/tmp/dir/temp_repo_name

Make sure that you reply ‘y’ to the question about the authenticity of the host as in:
The authenticity of host '192.168.0.50 (192.168.0.50)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xxb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.50' (RSA) to the list of known hosts.

Next delete the newly created git project from your tmp directory, and then you should be able to use cap deploy as normal again from your development pc

You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.

Problem
You would like to use Carrierwave for file uploads, but you get the following error if you are trying to use factories for running your cucumber scripts:

You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.

That happens if you try to assign inside your factory template, to your file field the path like f.file “path_to_file”

Solution

You would need to slightly modify your factory template to use the file path as follows:

f.file File.open(File.join(Rails.root,"path_to_file"))

Arduino Uno – Mandriva 64

Problem
You would like to use the Arduino Uno board with Mandriva but you are running into errors and problems installing it.

Solution
Download the latest code from the arduino website and extract the file somewhere.

Add your username to the dialout and uucp groups so you don’t get permissions errors.

install the avr-gcc package:
$ sudo urpmi avr-gcc

if everything works as it should then you should be able to select the port from the arduino IDE (Tools -> Serial Port -> /dev/ttyACM0)

You should then be able to communicate with the Arduino board by using one of the examples (ie Examples/Basic/Blink)

ImageMagick, RMagick, Debian installation

Problem
You want to use the rmagick gem in your ruby on rails project, but you need to install the imagemagick first.

Solution
If Imagemagick is not already installed, use the following to install it:
$ sudo apt-get install imagemagick$ sudo apt get install libmagick-dev libmagickwand-dev

You should then be able to install and use the rmagick gem

ImageMagick, RMagick, Mandriva 64 installation

Problem
You want to use the rmagick gem in your ruby on rails project, but you need to install the imagemagick first.

Solution
If Imagemagick is not already installed, use the following to install it:
$ sudo urpmi imagemagick$ sudo urpmi lib64magick-devel

You should then be able to install and use the rmagick gem

.gitignore seems that is not working

Problem
Your .gitignore file seems that is not working. You have added files there like db/schema.rb, but it keeps tracking the changes to it.

Solution
The cause is that the file was added to git version control before it was added in the .gitignore file. To remove the file from git tracking but without removing it from the filesystem use the following:
$ git rm --cached filename_not_to_be_tracked

Using factory_girl Factory in test console

Problem
You would like to test your factory_girl factories in the rails test console, but you get an error when you try to use an existing factory.

Solution

  1. Start your console in the test evnivornment:
    rails c test
  2. require your factories.rb file in the console:
    require 'absolute_path/to/your/factories.rb'
  3. you should be able to use your factory now :
    t=Factory.create(:existing_factory_name)

mysql2 gem error with bundle install in Rails 3.0.x

Problem
When you try to create a new Rails 3.0.x application, and try to use the ‘mysql2’ gem in your Gemfile without specifying a version you get the following warnings:

WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x

Solution
Specify the latest version of mysql2 that is compatible with the Rails 3.0.x versions as in:

gem 'mysql2', "~> 0.2.7"

no such file to load — readline (LoadError) in Rails 3.0.7 – Mandriva 2011 64

Problem

When you try to run the console rails c in a new Rails 3.0.7 application, in Mandriva 2011 64bit, and when you use rvm, you get the following error:

no such file to load -- readline (LoadError)

Solution

Similar to an earlier post here, the solution is as follows with the new requirements described

It’s quite like likely that the readline libraries are missing from your installation. To find out which ones go to the directory that the error is indicating (ie):

cd ~/.rvm/src/ruby-1.9..2-head

and then to the following:

cd ext/readline

then run the following:

ruby extconf.rb

If you get something like:
checking for readline/readline.h... no
checking for editline/readline.h... no

then you are probably missing the neccessary header files for readline.
so install them in your system (ie in Mandriva):

sudo urpmi lib64readline-dev,

When the package is installed successfully run the following again:

ruby extconf.rb
make
sudo make install

You should now be able to go back to your project and run rails c with no errors.