<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Rails Hacks - Home</title>
  <id>tag:www.railshacks.com,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.railshacks.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.railshacks.com/" rel="alternate" type="text/html"/>
  <updated>2008-07-21T14:44:43Z</updated>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-07-21:16</id>
    <published>2008-07-21T14:44:43Z</published>
    <updated>2008-07-21T14:44:43Z</updated>
    <category term="My Projects "/>
    <category term="Plugins"/>
    <category term="Ruby"/>
    <link href="http://www.railshacks.com/2008/7/21/mephisto-xmlrpc-plugin-released-for-mephisto-0-8-and-mephisto-edge" rel="alternate" type="text/html"/>
    <title>Mephisto XMLRPC plugin released  for Mephisto 0.8 and Mephisto Edge</title>
<content type="html">
            &lt;p&gt;So here is Mephisto xmlrpc plugin for Mephisto release 0.8 and for Mephisto Edge.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;I  have ported original Mephisto_xmlrpc plugin to work with Mephisto 0.8 and Mephisto edge.&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;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.&lt;/p&gt;


	&lt;p&gt;checkout Mephisto xmlrpc plugin from subversion, this is available two flavors .&lt;/p&gt;


	&lt;p&gt;for Mephisto release 0.8&lt;/p&gt;


	&lt;p&gt;script/plugin  install  http://svn.railshacks.com/projects/mephisto/plugins/mephisto_xmlrpc_0.8&lt;/p&gt;


	&lt;p&gt;for  Mephisto edge&lt;/p&gt;


	&lt;p&gt;script/plugin install   http://svn.railshacks.com/projects/mephisto/plugins/mephisto_xmlrpc_edge&lt;/p&gt;


	&lt;p&gt;To install  Mephisto xmlrpc plugin&lt;/p&gt;


	&lt;p&gt;follow these steps &lt;/p&gt;
	&lt;pre&gt;&lt;code&gt;1:  edit file app/controllers/application/error.rb&lt;/code&gt;&lt;/pre&gt;
	&lt;pre&gt;&lt;code&gt;locate these lines &lt;/code&gt;&lt;/pre&gt;
	&lt;pre&gt;&lt;code&gt;rescue_from ActiveRecord::RecordNotFound,        :with =&amp;amp;gt; :render_admin_not_found
rescue_from ActionController::UnknownController, :with =&amp;amp;gt; :render_admin_not_found
rescue_from ActionController::UnknownAction,     :with =&amp;amp;gt; :render_admin_not_found&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;change these lines to&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;rescue_from ::ActiveRecord::RecordNotFound,        :with =&amp;amp;gt; :render_admin_not_found
rescue_from ::ActionController::UnknownController, :with =&amp;amp;gt; :render_admin_not_found
rescue_from ::ActionController::UnknownAction,     :with =&amp;amp;gt; :render_admin_not_found&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;save the file .&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;2:  checkout action web service from svn repo. into vendor/rails folder.     &lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;svn co    http://svn.rubyonrails.org/rails/ousted/actionwebservice/&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;3.  restart your server &lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;Now you have working xmlrpc service at your server .&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;if you face any problem  installing/using this plugin feel free to ask .&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-07-10:12</id>
    <published>2008-07-10T15:05:00Z</published>
    <updated>2008-07-10T15:41:06Z</updated>
    <category term="My Projects "/>
    <category term="Plugins"/>
    <category term="Ruby"/>
    <link href="http://www.railshacks.com/2008/7/10/mephisto-sitemap-plugin" rel="alternate" type="text/html"/>
    <title>mephisto sitemap plugin</title>
<content type="html">
            &lt;p&gt;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 ,&lt;/p&gt;

&lt;p&gt;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/&lt;/p&gt;

&lt;p&gt;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&lt;/p&gt;

&lt;p&gt;if you face any problem please make a comment here &lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-06-19:13</id>
    <published>2008-06-19T01:53:11Z</published>
    <updated>2008-07-19T06:45:04Z</updated>
    <category term="Ruby"/>
    <category term="easy"/>
    <category term="hacks"/>
    <link href="http://www.railshacks.com/2008/6/19/ruby-on-rails-exception-notification-thrugh-mail" rel="alternate" type="text/html"/>
    <title>Ruby on Rails exception notification through mail</title>
<content type="html">
            &lt;p&gt;So you want to get notified when you get exception on production application environment ,
lets do in three easy steps &lt;/p&gt;

&lt;p&gt;1: create a  action  mailer model&lt;/p&gt;

&lt;pre&gt;class Mymailer '
    @subject            = &quot;[Error] exception in #{env['REQUEST_URI']}&quot;
    @sent_on            = time
    @body[&quot;exception&quot;]  = exception 
    @body[&quot;trace&quot;]      = trace  
    @body[&quot;session&quot;]    = session 
    @body[&quot;params&quot;]     = params 
    @body[&quot;env&quot;]        = env  
    content_type(&quot;text/html&quot;)  
  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(&quot;@data&quot;),
          @params,
          @request.env)
      end
    rescue =&amp;gt; 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[&quot;exception&quot;]  # exception
@body[&quot;trace&quot;]      # trace   
@body[&quot;session&quot;]    # session
@body[&quot;params&quot;]     # params
@body[&quot;env&quot;]        # env

now you have working exception handling system

if face any problem make a comment here
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-06-10:6</id>
    <published>2008-06-10T17:24:00Z</published>
    <updated>2008-06-10T17:36:08Z</updated>
    <category term="cms"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.railshacks.com/2008/6/10/top-5-ruby-on-rails-cms" rel="alternate" type="text/html"/>
    <title>top 5 Ruby on Rails CMS</title>
<content type="html">
            &lt;ol&gt;
       &lt;li&gt; &lt;a href=&quot;http://www.mephistoblog.com&quot;&gt; Mephisto &lt;/a&gt; &lt;/li&gt;
       &lt;li&gt; &lt;a href=&quot;http://www.typosphere.com&quot;&gt; Typo &lt;/a&gt; &lt;/li&gt;
        &lt;li&gt; &lt;a href=&quot;http://www.rubricks.com&quot;&gt; Rubricks &lt;/a&gt; &lt;/li&gt;
      &lt;li&gt; &lt;a href=&quot;http://www.mephistoblog.com&quot;&gt; Radiant &lt;/a&gt; &lt;/li&gt;
       &lt;li&gt; &lt;a href=&quot;http://www.railfrog.com&quot;&gt; Railfrog &lt;/a&gt; &lt;/li&gt;
&lt;ol&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-06-10:7</id>
    <published>2008-06-10T17:24:00Z</published>
    <updated>2008-06-10T17:28:44Z</updated>
    <category term="cms"/>
    <category term="on"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.railshacks.com/2008/6/10/top-5-ruby-on-rails-cms-2" rel="alternate" type="text/html"/>
    <title>top 5 Ruby on Rails CMS</title>
  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-06-01:4</id>
    <published>2008-06-01T03:10:00Z</published>
    <updated>2008-06-01T03:12:18Z</updated>
    <category term="ActiveRecord"/>
    <link href="http://www.railshacks.com/2008/6/1/rails-cross-database-development" rel="alternate" type="text/html"/>
    <title>Rails: Cross Database development</title>
<content type="html">
            &lt;p&gt;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:&lt;/p&gt;


&lt;blockquote&gt;
	&lt;p&gt;ruby script\generate migration Contact&lt;/p&gt;

&lt;/blockquote&gt;




	&lt;p&gt;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:&lt;/p&gt;


	&lt;p&gt;class Contact &amp;lt; 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&lt;/p&gt;


&lt;blockquote&gt;
	&lt;p&gt;ruby script\generate scaffold Contact&lt;/p&gt;

&lt;/blockquote&gt;




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


	&lt;p&gt;Now, apply the migration&lt;/p&gt;


&lt;blockquote&gt;
	&lt;p&gt;rake migrate&lt;/p&gt;

&lt;/blockquote&gt;




	&lt;p&gt;Now, generate model and controller for Contact&lt;/p&gt;


&lt;blockquote&gt;
	&lt;p&gt;ruby script\generate scaffold Contact&lt;/p&gt;

&lt;/blockquote&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-05-06:5</id>
    <published>2008-05-06T03:14:00Z</published>
    <updated>2008-06-01T03:16:45Z</updated>
    <link href="http://www.railshacks.com/2008/5/6/fastcgi-lighttpd-rubyonrails-error-getcwd-no-such-file-or-directory" rel="alternate" type="text/html"/>
    <title>fastcgi lighttpd rubyonrails Error: getcwd no such file or directory</title>
<content type="html">
            &lt;p&gt;I got this error today while deploying rails application on running lighttpd server.
Errno::ENOENT (No such file or directory &#8211; getcwd)
I replaced application directory without stopping lighty and got error while trying accessing app via browser.
I went off by merely restarting lighthttpd :)&lt;/p&gt;


	&lt;p&gt;Seems like server creates/uses some file “within” rails app folder which got erased while replacing the folder.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-05-04:2</id>
    <published>2008-05-04T16:45:00Z</published>
    <updated>2008-05-31T16:45:36Z</updated>
    <link href="http://www.railshacks.com/2008/5/4/rails-rjs-redirect" rel="alternate" type="text/html"/>
    <title>Rails RJS redirect</title>
<content type="html">
            &lt;p&gt;page.redirect&lt;em&gt;to :action =&gt; ‘thanks’, :p1 =&gt; @g&lt;/em&gt;resp.params[”&lt;em&gt;code”], :p2 =&gt; @r&lt;/em&gt;id &lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-05-04:3</id>
    <published>2008-05-04T16:45:00Z</published>
    <updated>2008-05-31T16:46:22Z</updated>
    <category term="Ajax on Rails"/>
    <link href="http://www.railshacks.com/2008/5/4/rails-rjs-redirect-2" rel="alternate" type="text/html"/>
    <title>Rails RJS redirect</title>
<content type="html">
            &lt;p&gt;page.redirect_to :action =&amp;gt; ‘thanks’, :p1 =&amp;gt; @g_resp.params[”_code”], :p2 =&amp;gt; @r_id&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.railshacks.com/">
    <author>
      <name>jeet</name>
    </author>
    <id>tag:www.railshacks.com,2008-05-03:1</id>
    <published>2008-05-03T16:34:00Z</published>
    <updated>2008-05-31T16:43:48Z</updated>
    <category term="Gems"/>
    <category term="error"/>
    <category term="gem"/>
    <link href="http://www.railshacks.com/2008/5/3/error-while-executing-gem-gem-gemnotfoundexception" rel="alternate" type="text/html"/>
    <title>ERROR: While executing gem &#8230; (Gem::GemNotFoundException)</title>
<content type="html">
            &lt;p&gt;You might be feeling annoyed with this problem. (I do)
Problem could be:&lt;/p&gt;

&lt;p&gt;your local source cache
Example:   /usr/lib/ruby/gems/1.8/source_cache&lt;/p&gt;

&lt;p&gt;; 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&lt;/p&gt;

&lt;p&gt;check your env var REMOTE SOURCES (#gem env)&lt;/p&gt;

&lt;p&gt;If it is not gems.rubyforge.org then use following command to install:&lt;/p&gt;

&lt;h1&gt;gem install -r gem_name  –source http://gems.rubyforge.org&lt;/h1&gt;

&lt;p&gt;If this does not solves your problem(is your internet down?)&lt;/p&gt;

&lt;p&gt;Borrow gem files from your friend and install them without -r option.&lt;/p&gt;

&lt;h1&gt;gem install /path_to/gemname.gem&lt;/h1&gt;
          </content>  </entry>
</feed>
