Mephisto XMLRPC plugin released for Mephisto 0.8 and Mephisto Edge 4

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

top 5 Ruby on Rails CMS

Posted by jeet
on Tuesday, June 10
  1. Mephisto
  2. Typo
  3. Rubricks
  4. Radiant
  5. Railfrog

top 5 Ruby on Rails CMS

Posted by jeet
on Tuesday, June 10

Rails: Cross Database development

Posted by jeet
on Sunday, June 01

Its a piece of cake developing applications that run on multitude of Database management solutions. All you need to keep Database schema scripts handy. Here is how you do it using rails scripts:

ruby script\generate migration Contact

This will create an empty file in db/migrate folder for contact table. You need to fill it now with the fields you want for eg:

class Contact < ActiveRecord::Migration def self.up create_table :contacts do |table| table.column :first_name, :string table.column :last_name, :string table.column :email, :string table.column :phone, :string table.column :address, :string end end def self.down end end

ruby script\generate scaffold Contact

Ok.. just found what I was looking for. Pretty detailed document for this: http://rubyonrails.org/api/classes/ActiveRecord/Migration.html

Now, apply the migration

rake migrate

Now, generate model and controller for Contact

ruby script\generate scaffold Contact

fastcgi lighttpd rubyonrails Error: getcwd no such file or directory

Posted by jeet
on Tuesday, May 06

I got this error today while deploying rails application on running lighttpd server. Errno::ENOENT (No such file or directory – getcwd) I replaced application directory without stopping lighty and got error while trying accessing app via browser. I went off by merely restarting lighthttpd :)

Seems like server creates/uses some file “within” rails app folder which got erased while replacing the folder.

Rails RJS redirect 0

Posted by jeet
on Sunday, May 04

page.redirectto :action => ‘thanks’, :p1 => @gresp.params[”code”], :p2 => @rid

Rails RJS redirect 0

Posted by jeet
on Sunday, May 04

page.redirect_to :action => ‘thanks’, :p1 => @g_resp.params[”_code”], :p2 => @r_id

ERROR: While executing gem … (Gem::GemNotFoundException)

Posted by jeet
on Saturday, May 03

You might be feeling annoyed with this problem. (I do) Problem could be:

your local source cache Example: /usr/lib/ruby/gems/1.8/source_cache

; try removing this file (Your path might be different than above given; check your path first using #gem env) If this does not solves your problem

check your env var REMOTE SOURCES (#gem env)

If it is not gems.rubyforge.org then use following command to install:

gem install -r gem_name –source http://gems.rubyforge.org

If this does not solves your problem(is your internet down?)

Borrow gem files from your friend and install them without -r option.

gem install /path_to/gemname.gem