WebOnRails

Its all about Ruby On Rails

Follow me on TwitterRSS Feeds

  • Home
  • About
  • Contact

Edge Rails: Time#current

Jul 5th

Posted by Akhil Bansal in ROR

2 comments

Returns Time.zone.now when config.time_zone is set, otherwise just returns Time.now

edge rails, Rails, ROR, Rubyonrails, Tips

Edge Rails: Array#random_element

May 24th

Posted by Akhil Bansal in ROR

1 comment

Array#rand is deprecated in favor of Array#random_element and will be removed in Rails 3.

As per the comment added to the commit:
Array#rand is deprecated because it masks Kernel#rand within the Array class itself, which may be used by a 3rd party library extending Array in turn. See https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4555

Array, edge rails, Rails, ROR, Rubyonrails, Tips

Edge Rails Updates

May 14th

Posted by Akhil Bansal in ROR

7 comments

New edge rails deprecations:

Time#last_year is deprecated in favor of Time#prev_year
Time#last_month is deprecated in favor of Time#prev_month

Date#last_year is deprecated in favor of Date#prev_year
Date#last_month is deprecated in favor of Date#prev_month

New methods/aliases:

Date#sunday: Returns a new Date representing the end of this week
Time#sunday: Returns a new Time representing the end of this week
rename_index: Rename database index
Ex: rename_index :people, ‘index_people_on_last_name’, ‘index_users_on_last_name’

Feel free to add more as comments..

edge rails, Rails, ROR, Rubyonrails

Download recursive directories with wget using Username & Password for FTP

Apr 26th

Posted by Akhil Bansal in FTP

1 comment

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/
FTP, server, Tips, tricks

uninitialized constant ActionMailer::Quoting::Encoding

Apr 13th

Posted by Akhil Bansal in ActionMailer

1 comment

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

ActionMailer, Error, Exception, Rails, ROR, ruby, Rubyonrails, Tips
12345»1020...Last »
    • Recent comments
    • Popular posts
    • Archives
    • Tags
    apache attachment_fu bash capistrano deploy edge rails Error event Exception Exception Handelling full text search funday gems git hosting image installation instance leopard mod_rewrite Notification pound Rails rails_plugin redirect rewrite ROR ruby ruby event rubygems Rubyonrails SCP script SEO server sftp STI terminate Tips transfer Trick tricks ubuntu Ultrasphinx wordpress
    • July 2010 (1)
    • May 2010 (2)
    • April 2010 (2)
    • March 2010 (1)
    • November 2009 (2)
    • July 2009 (1)
    • June 2009 (1)
    • May 2009 (1)
    • March 2009 (1)
    • February 2009 (6)
    • January 2009 (3)
    • December 2008 (6)
    • November 2008 (7)
    • October 2008 (3)
    • August 2008 (5)
    • July 2008 (1)
    • April 2008 (2)
    • February 2008 (1)
    • January 2008 (3)
    • December 2007 (1)
    • November 2007 (2)
    • October 2007 (1)
    • September 2007 (3)
    • August 2007 (2)
    • July 2007 (3)
    • June 2007 (1)
    • May 2007 (2)
    • April 2007 (3)
    • March 2007 (1)
    • February 2007 (4)
    • January 2007 (2)
    • December 2006 (6)
    • November 2006 (7)
    • October 2006 (4)
    • September 2006 (4)
    • August 2006 (4)
    • July 2006 (5)
    • June 2006 (9)
    • Plugin: state_select, generate drop down selection box for states (41)
    • Acts_as_solr: Starting solr server on windows (25)
    • My new HP Pavillion DV2117 Notebook (16)
    • Accessing session data using session_id (11)
    • Bash script for creating new rails project and initial SVN import (with ignoring/removing log/other files) (10)
    • Careful while using Exception Notifier Plugin (10)
    • apache proxy balancer + mongrel clusters and deploying application with capistrano (9)
    • Ruby Script for SVN commit notification with log message, list of updated files and readable colored SVN Diff (9)
    • Change timezone of ubuntu machine from command line (9)
    • Migration: Adding/Removing columns are now much easier (8)
    • Shawn: The original link does not work, but I found it in the following location:...
    • kevin: you'll want to make sure the lang attribute is sanitized as well, obviously
    • kevin: you shouldn't use spelling.rb, as it will open your site to hacking (very easily). make a tempfile...
    • Prashant: Thanku sir
    • lantjie: hey, it help me thanks
    • Tweets that mention Edge Rails: Time#current | WebOnRails -- Topsy.com: [...] This post was mentioned on Twitter by Akhil Bansal, Rails Bot. Rails Bot said: Edge Rails:...
    • taelor: protip: If your website deals heavily with different Time Zones, you need to use...
    • Louboutin shoes: I am the first time on this site and am really enthusiastic about and so many good articles. I...
  • My latest tweets

    Loading tweets...
    Follow me on Twitter!
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top