Its all about Ruby On Rails
Posts tagged rails_plugin
Multiple versions of ruby on ubuntu
Jun 23rd
Three-Four days ago I was in a situation where I need to have multiple versions of ruby and rubygems on my ubuntu machine. I was lucky, I found an awesome article http://blog.michaelgreenly.com/2008/08/multiple-versions-of-ruby-on-ubuntu-2.html. This really solved my problem, Many thanks to Michael Greenly.
Taskit: Another task scheduler for rails
May 21st
While searching something I found and interesting plugin ‘Taskit‘, which I want to test for sure in production/staging when ever I get the chance.
Anybody tried it already?
Rails Plugin: role_requirment, Clean role-based security for restful_authentication
Feb 13th
I just found a very useful plugin role_requirement to manage roles in rails app.
RoleRequirement focuses on a simple approach to role-based authentication. RoleRequirement leverages the power of !Ruby to strike a marvelous balance between simplicity and flexibility.
Features:
* A user can have many roles or one role
* Full test helpers to make it easy to test your controllers.
* Squeaky clean implementation – don’t repeat yourself!
* Code generators: spend more time coding and less time wading through installation instructions.
quick_scopes: Rails plugin to automatically add some quick named_scopes to your models
Jan 29th
Today I came across a new plugin named quick_scopes, and thought you guys might be interested to give it a try. Checkout http://github.com/internuity/quick_scopes/tree/master
Edge Rails: Now define your plugin’s routes in plugin’s config/routes.rb
Nov 28th
If you wrote/writing a rails plugin that need to have an entry in rails routing, you need not to ask your plugin users to make that entry in RAILS_ROOT/config/routes.rb manually any more. In the latest version of rails you can add your custum routes in your plugin config/routes.rb file. Rails will automatically load those routes.
Customizing CruiseControl build for RSpec
Aug 30th
Yesterday I posted about CruiseControl for Rails projects. It was working fine with all my rails projects using traditional test cases, But today I faced a problem with a project using RSpec. Actually, By default CruiseControl follows the following step to build:
- rake db:test:purge
- rake db:migrate
- rake test
This default was not working with my last project As I was using RSpec for my project. I found that we can overwrite default way of building by creating a rake task named cruise in our project. Means by building CruiseControl will run your custom rake task only, so you have to take care of all other things i.e. migrate etc.
Hence I created following rake task in RAILS_ROOT/lib/tasks/custom_cc.rake
desc 'Custom curise task for RSpec'
task :cruise do
ENV['RAILS_ENV'] = 'test'
if File.exists?(Dir.pwd + "/config/database.yml")
if Dir[Dir.pwd + "/db/migrate/*.rb"].empty?
raise "No migration scripts found in db/migrate/ but database.yml exists, " +
"CruiseControl won't be able to build the latest test database. Build aborted."
end
# perform standard Rails database cleanup/preparation tasks if they are defined in project
# this is necessary because there is no up-to-date development database on a continuous integration box
if Rake.application.lookup('db:test:purge')
CruiseControl::invoke_rake_task 'db:test:purge'
end
if Rake.application.lookup('db:migrate')
CruiseControl::reconnect
CruiseControl::invoke_rake_task 'db:migrate'
end
end
CruiseControl::invoke_rake_task 'spec:all'
end
and it worked for my rails project using RSpec.
Careful while using Exception Notifier Plugin
Jul 26th
Exception Notifier Plugin can make you crazy as it made me yesterday.
Let me explain, I was using this plugin for one of my project and our server got a DOS attack. We were requested some URLs that doesn’t exists, like http://somedomain.com/game.rar etc… . I had registered my gmail account to get notification mails. And due to this attack I was sent around 7631*61 mails in 10 hrs. This made me crazy, because I was unable to receive any other email as (may be) my queue was busy with receiving notification mails. Then gmail started bouncing back those mails saying “The Gmail user you are trying to contact is receiving mail at a rate that prevents additional messages from being delivered. Please resend your message at a later
time”. And then it became a loop, Gmail-My Server-Gmail.
I found 303552 mails in postfix queue of my server. That were ready to send to gmail. Now my first priority was to clean that postfix queue, so I did it by issuing “sudo postsuper -d ALL”. I hope to receive mails ASAP, It is now more than 48 hrs i received any genuine mail.
So I request you to be careful while using this plugin
Note: Since my gmail account not receiving mails, so please sent it to akhil at vinsol dot com
Plugin: Exception Notifier; Get detail information of exceptions occurred on the live server right on your inbox.
Dec 28th
I don’t know whether you guys are aware of Exception Notifier plugin written by Jamis Buck or not. If you don’t then I would like to share this with you.
- the sender address of the email
- the recipient addresses
- the text used to prefix the subject line
The email includes information about the current request, session, and environment, and also gives a backtrace of the exception.
I am using this plugin and found it very useful, and suggest you to use it.
You can get this plugin from http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/
Plugin: state_select, generate drop down selection box for states
Sep 12th
I have wrote my first plugin(state_select). This plugin allows to create drop down list for states, same as country_select method in rails. I know this is not a big deal…
UPDATE: Curently it can generate state list for India, US, Canada, Australia, Spain and Uganda(default is US).
Usage:
state_select(object, method, country=’US’, options = {}, html_options = {})
Return select and option tags for the given object and method, using state_options_for_select to generate the list of option tags.
state_options_for_select(selected = nil, country = ‘US’)
Returns a string of option tags for states in a country. Supply a state name as selected to have it marked as the selected option tag.
NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
github URL: http://github.com/bansalakhil/stateselect/tree/master
Install plugin by
script/plugin install git://github.com/bansalakhil/stateselect.git
