Mephisto XMLRPC plugin released for Mephisto 0.8 and Mephisto Edge 22

Posted by jeet
on Monday, July 21

So here is Mephisto xmlrpc plugin for Mephisto release 0.8 and for Mephisto Edge.

I  have ported original Mephisto_xmlrpc plugin to work with Mephisto 0.8 and Mephisto edge.

The Original plugin was not compatible with most of the Desktop blogging tool if you use metaweblog api. this plugin working with almost all popular blogging tools like ecto, marsedit, blogtk, gnome-blog etc. , even with google reader.

checkout Mephisto xmlrpc plugin from subversion, this is available two flavors .

for Mephisto release 0.8

script/plugin install http://svn.railshacks.com/projects/mephisto/plugins/mephisto_xmlrpc_0.8

for Mephisto edge

script/plugin install http://svn.railshacks.com/projects/mephisto/plugins/mephisto_xmlrpc_edge

To install Mephisto xmlrpc plugin

follow these steps

1:  edit file app/controllers/application/error.rb
locate these lines 
rescue_from ActiveRecord::RecordNotFound,        :with => :render_admin_not_found
rescue_from ActionController::UnknownController, :with => :render_admin_not_found
rescue_from ActionController::UnknownAction,     :with => :render_admin_not_found
change these lines to
rescue_from ::ActiveRecord::RecordNotFound,        :with => :render_admin_not_found
rescue_from ::ActionController::UnknownController, :with => :render_admin_not_found
rescue_from ::ActionController::UnknownAction,     :with => :render_admin_not_found
save the file .
2:  checkout action web service from svn repo. into vendor/rails folder.     
svn co    http://svn.rubyonrails.org/rails/ousted/actionwebservice/
3.  restart your server 
Now you have working xmlrpc service at your server .
if you face any problem  installing/using this plugin feel free to ask .

mephisto sitemap plugin

Posted by jeet
on Thursday, July 10

Mephisto has always been my favourite rails publishing system , few days back I switched to mephisto edge, later i found most of mephisto plugins are broken on mephisto edge because mephisto edge is using rails engine system ,

So I ported Stephen Caudill's existing mephisto sitemap plugin on mephisto edge and now its available at http://svn.railshacks.com/projects/mephisto/plugins/mephisto_sitemap/

Currently I am looking at other plugins that is not compatible with mephisto edge , As soon as i complete I will make it available for public download

if you face any problem please make a comment here

Ruby on Rails exception notification through mail

Posted by jeet
on Thursday, June 19

So you want to get notified when you get exception on production application environment , lets do in three easy steps

1: create a action mailer model

class Mymailer '
    @subject            = "[Error] exception in #{env['REQUEST_URI']}"
    @sent_on            = time
    @body["exception"]  = exception 
    @body["trace"]      = trace  
    @body["session"]    = session 
    @body["params"]     = params 
    @body["env"]        = env  
    content_type("text/html")  
  end

end

2: define this method in you application.rb file

def log_error(exception)
    super(exception)
    begin
      if ENV['RAILS_ENV'] == 'production'
        Notifier.deliver_error_page(exception,
          clean_backtrace(exception),
          @session.instance_variable_get("@data"),
          @params,
          @request.env)
      end
    rescue => e
      logger.error(e)
    end
  end

3: create a view file  view/mymailer/error_mail.html.erb


now you have access to these files , you can format your mail as you feel like

@body["exception"]  # exception
@body["trace"]      # trace   
@body["session"]    # session
@body["params"]     # params
@body["env"]        # env

now you have working exception handling system

if face any problem make a comment here