Thursday, January 20, 2011

Ruby On Rails Active Record data format type :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean.

The types supported by Active Record are  
:primary_key,
:string,  
:text,  
:integer,  
:float,  
:decimal,  
:datetime,  
:timestamp,
:time,  
:date,  
:binary,  
:boolean

jz another helpful reference for a newbie like me ~.~

Tuesday, January 18, 2011

Installing Papperclip + Rmagick2 + ImageMagick ruby 1.9.2 & Ruby on Rails @ ubuntu.

I've already tried to implement this plugin last month or more, but it was a failure because i did not RTFM. I just get it to work few minutes ago & manage to wrote this down so that i'll not forget.

The key feature of successfully install those plugin, gem & image processor is as below :
1. Delegate libraries
  • FreeType, Version 2.0 or above, to annotate with TrueType and Postscript Type 1 fonts.
  • libjpeg to read and write JPEG v1 format images.
  • The PNG library, to read and write PNG format images.
  • libwmf 0.2.5 or later, to read and write Windows Meta File (WMF) format images.
  • Ghostscript version 8.10, to read and write the PDF and PS document formats.

2. Decide the version of ImageMagick, Rmagick for your Ruby Version.
RMagick Version Feature Table
Feature RMagick 1 RMagick 2
Works with Ruby < 1.8.5* Yes No
Works with ImageMagick 6.0.0-6.2.9 Yes No
Works with GraphicsMagick Yes No
Fully supported Yes Yes
Works with ImageMagick 6.3.5 and later Yes Yes
Available as a Windows RubyGem? No Yes
Gets new features No Yes
Works with Ruby 1.9 No Yes
Supports new ImageMagick features No Yes
* This is de facto that i did not concern during my previous installation which screws me.

3. Library dependencies for ImageMagick
just use the synaptic package manager to install ImageMagick and its dependent libraries. This is really time saving. I just use it and it's work!
* Note : I already do a tarball installation before i tried the synaptic package manager. After download & untar the ImageMagick, I configure it with this option below and make, then make install.
./configure --disable-static --with-modules --without-perl \
     --without-magick-plus-plus --with-quantum-depth=8
I don't know whether this configure do effect my ImageMagick synaptic package manager installation.

4. Install the Rmagick
gem install rmagick
this will automatically install me rmagick (2.13.1). The latest version.

5. Test Rmagick at ruby console
I use
rails c
to enter my ruby console. Enter commands below inside your ruby console. 
require 'RMagick'
Magick::Image.new(110, 30){self.background_color = 'white'}.write('/tmp/test.jpg')
Then check your image at /tmp/test.jpg

6. Install Papperclip
rails plugin install git://github.com/thoughtbot/paperclip.git
I'm not going to tell more about papperclip. Please read the ASCIIcasts

Yeay you are now capable of defeating facebook. haha

edited from the original source : http://rmagick.rubyforge.org/install-linux.html
Please add a comment if i am wrong in any part & we may share all here.

thx in advance
Ya'kob Ubaidullah