Wednesday, September 29, 2010

Rails find_by_sql returns object ??

you can use this,

ActiveRecord::Base.connection.select_value("sql query")

Tuesday, September 7, 2010

Installing pauldix-feedzirra

Hi when i tried to install pauldix-feedzirra, i got the below error.

sudo gem install pauldix-feedzirra
Building native extensions. This could take a while...
ERROR: Error installing pauldix-feedzirra:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.3.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.3.1/ext/nokogiri/gem_make.out



Then, I installed dependencies,

sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev


Now tried

sudo gem install pauldix-feedzirra

Worked fine!!

Problems in Installing Curb in ubuntu

Just install the below lib files,

sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev

& then,

sudo gem install curb

It works!

-- source - http://axonflux.com/curb-install-problems-on-ubunt

Sending HTML mail in rails

Hi pals,

If all the mails that you send are in HTML format. its simple. Specify this line in environment.rb

ActionMailer::Base.default_content_type = "text/html"


If only one action has to be in HTML mail, specify 'content_type' in that action.

content_type "text/html"

example,

def signup_notification(recipient)
recipients recipient.email_address_with_name
subject "New account information"
from "system@example.com"
content_type "text/html"
end

cheers,
Sri