Redbox, or a box overlay on rails no comments
As linked in the last digest, the Craig Ambrose’s Redbox is a Rails plugin inspired by Thickbox. It provides a way to show box overlaying your page.
Example:

script/plugin install http://www.tinboxsoftware.com/plugins/show/redbox/html {
height: 100%;
width: 100%;
}
body {
height: 100%;
width: 100%;
}<%= stylesheet_link_tag 'redbox' %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'redbox' %> display: none;.
<div id="hidden_content_login_admin"
style="display: none;"><%= link_to_remote_redbox <i>'link text'</i>, :url => {:controller => <i>'controllername'</i>, :action => <i>'actionname'</i>} %>That’s all, Redbox afford other ways to call box don’t hesitate to look at the demos.
When you install redbox, it copies css and javascript to the public folder. You can configure the CSS to modify the transparency of the overlay as you wish.
Hope this article would be helpful
All cheats you ever want to have no comments
Find on: http://cheat.errtheblog.com/. All ruby’s cheat sheets you ever want, are centralized on this website and dispatched via wiki pages.
Simple, useful, just do :
# installation
$ sudo gem install cheat
# list of the commands
$ cheat cheat
# all the sheets available
$ cheat sheetsEnjoy!
Weekly Rails digest - March 18, 2007 no comments
Ok, I should have done my home work last week end :). Let’s have a look for what I have found these last few days :
- erubis: it’s a VM for ruby written in ruby. Rails is supported in the latest version. Have also for java-er
- ActiveScaffold: do you know about AjaxScaffold ? ActiveScaffold is the new version (v4) of this plugin. Don’t need to generate controller anymore, every thing is in methods.
- : if you are looking for some nice web2.0 features as the thickbox in your rails application look at this plugin. I will try to do an article soon about its use as it ’s not fully documented
- acts_as_authenticated plugin: great plugin for managing users and authentication. Has many other plugins use it for authorization by example. Excellent documentation on the wiki
- sitemeter: another great plugin, easy to install, let’s you have statistics on your rails application. Have a look.
- globalize: not yet tested, a plugin for i18nalize your application
Rails Ajax rating system (Part 1) 1 comment
Needed for a little project, I found a plugin: “acts_as_rated”.
“Adds rating capabilities to any ActiveRecord object. It has the ability to work with objects that have or don’t special fields to keep a tally of the ratings and number of votes for each object. In addition it will by default use the User model as the rater object and keep the ratings per-user. It can be configured to use another class, or not use a rater at all, just keeping a global rating”
Not yet released as gem please checkout the following trunk : svn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_rated
Installation:
script/plugin install svn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_ratedGenerate the Rating model:
The rater is User (by default) and rated object is Photo
script/generate migration add_ratingclass AddRating < ActiveRecord::Migration
def self.up
ActiveRecord::Base.create_ratings_table
Photo.add_ratings_columns
end
def self.down
# Remove the added columns
Photo.remove_ratings_columns
ActiveRecord::Base.drop_ratings_table
end
endrake db:migrateAdd table ratings and columns rating_count, rating_total, rating_avg to the Photos table.
Usage:
class Photo < ActiveRecord::Base
acts_as_rated :rating_range => 0..5
end
stephane = User.find_by_username("stephane")
picture = Photo.new("beautiful picture")
picture.rate 4, stephanethat’s all for now … (Next: integrate CSS rating interface)




