Its all about Ruby On Rails
Tips
Edge Rails: Time#current
Jul 5th
Returns Time.zone.now when config.time_zone is set, otherwise just returns Time.now
Download recursive directories with wget using Username & Password for FTP
Apr 26th
Using ftp to download multiple files using ‘mget’ command is pretty common, however it downloads files from current directory only. But if you need to download recursive directories with all its content then? And specially when you don’t have shell access to the remote machine and you don’t have access to archive the targeted folder?
In such situation you can use ‘wget’ to download all recursive directories by providing your ftp details. For example:
wget -rc --user='ftpusername' --password='ftppassword' ftp://domain.com/directory_path/
uninitialized constant ActionMailer::Quoting::Encoding
Apr 13th
Just a quick note, If you are getting “uninitialized constant ActionMailer::Quoting::Encoding” while using ActionMailer, then make sure that your mailer look like:
class Notifier < ActionMailer::Base
def signup_notification(recipient)
recipients recipient.email_address_with_name
bcc ["bcc@example.com"]
from "system@example.com"
subject "New account information"
body :account => recipient
end
end
Actually, yesterday we were getting “uninitialized constant ActionMailer::Quoting::Encoding” while using ActionMailer in production but it was working fine in all modes(development/production) on localhost. Our mailer was like:
class Notifier < ActionMailer::Base
def signup_notification(recipient)
@recipients = recipient.email_address_with_name
@bcc = ["bcc@example.com"]
@from = "system@example.com"
@subject = "New account information"
@body = :account => recipient
end
end
We could not find the actual issue with this mailer. But the above said error was disappeared when we changed the same mailer as following:
class Notifier < ActionMailer::Base
def signup_notification(recipient)
recipients recipient.email_address_with_name
bcc ["bcc@example.com"]
from "system@example.com"
subject "New account information"
body :account => recipient
end
end
Do you guys have any idea? I would love to listen from you.
Update: No its not solved yet. Still same issue. May be some issue with character encoding with the TMail object.
Update 2: This was the issue http://github.com/hmcgowan/roo/issues#issue/4/comment/106328
Displaying information about your git repository
Nov 12th
Want to see information about your git repository?
Based on a discussion here Duane Johnson wrote a very useful bash script. I am using this script from months and would like to share with you. You can download this script here(git-info.txt (483)).
You can also add an alias like below, so that I can be a accessed by a single command “gitinfo”
alias gitinfo="/home/akhil/git-info.txt"
When you run this script from your working copy it displays:
- Remote URL
- Remote Branches
- Local Branches
- Configuration (.git/config)
- Most Recent Commit
Isn’t it useful, give it a try
Multiple versions of ruby on ubuntu
Jun 23rd
Three-Four days ago I was in a situation where I need to have multiple versions of ruby and rubygems on my ubuntu machine. I was lucky, I found an awesome article http://blog.michaelgreenly.com/2008/08/multiple-versions-of-ruby-on-ubuntu-2.html. This really solved my problem, Many thanks to Michael Greenly.