Latest Event Updates

Moped::Errors::ConnectionFailure: Could not connect to a primary node for replica set <Moped::Cluster nodes=[]>

Posted on

 

  1. brew unlink mongodb
  2. brew install mongodb
  3. ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents (To have launchd start mongodb at login)
  4. launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist (Then to load mongodb now)

You are ready to go …now :)

Setting up Mongo for rails 3.2.X, Ruby 1.9.3

Posted on

  1. Install MongoDB with Package Management.

    brew install mongodb
  2. rails new app_name –skip-active-record
  3. Simply add Mongoid to your Gemfile.     gem “mongoid”, “~> 3.0.0″        
  4. rails g mongoid:config

Patch – URI not able to parse the url properly

Posted on Updated on

module URI
def self.parse(uri)

uri = URI.encode(uri)

scheme, userinfo, host, port,
registry, path, opaque, query, fragment = self.split(uri)

if scheme && @@schemes.include?(scheme.upcase)
@@schemes[scheme.upcase].new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment)
else
Generic.new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment)
end
end
end

Patch to the TMail core classes in order to avoid errors in messages with bad encoding definition

Posted on Updated on

module TMail
class Unquoter
class << self
def convert_to(text, to, from)
return text unless to && from
from.gsub!(‘ISO88′,’ISO-88′) #we found some strange cases in which the encoding was lacking the dash
from.gsub!(‘ks_c_5601-1987′,’euc-kr’) # ks_c_5601-1987 and euc-kr are different encodings and the second one is the referred one for e-mails #http://lists.kde.org/?l=kde-i18n-doc&m=100396886120761&w=2
text ? Iconv.conv(“#{to}//IGNORE//TRANSLIT”, from, text) : ” #the encoding is done with ignore and translit to fix as much errors as possible
rescue Iconv::IllegalSequence, Errno::EINVAL
# the ‘from’ parameter specifies a charset other than what the text
# actually is…not much we can do in this case but just return the
# unconverted text
#
# Ditto if either parameter represents an unknown charset (i.e X-UNKNOWN),
# and if the //IGNORE didn’t work fine
text
end
end
end
end

Exception notification solution for rails 2.3

Posted on Updated on

ERROR : `const_missing': uninitialized constant ApplicationController::ExceptionNotification (NameError)

Installing “exception_notification” for Rails 2.3

script/plugin install git://github.com/rails/exception_notification.git -r 2-3-stable

ERROR: `gem_original_require': no such file to load — action_dispatch (MissingSourceFile)

Change

ExceptionNotifier.exception_recipients = %w(your@emailaddress.com)

with

ExceptionNotification::Notifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)

in environment.rb

Ajaxified Pagination with ‘will paginate’ plugin

Posted on

We need to override the “page_link_or_span”. Just add the following method  to

vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb

def page_link_or_span(page, span_class, text = nil)
text ||= page.to_s
classnames = Array[*span_class]
if page and page != current_page
if @options[:update]
@template.link_to_remote text, :update => @options[:update], :url =>url_for(page)
else
@template.link_to_remote text, :url =>url_for(page)
#@template.link_to text, url_for(page), :rel => rel_value(page), :class => classnames[1]
end
else
@template.content_tag :span, text, :class => classnames.join(‘ ‘)
end
end

View

<%= will_paginate @messages,:params=>{:controller=>’messages’,:action=>’show_folder’,:id => @msg_folder.id},:container => false %>