(415) 704-1817
  • We all know Rails 3.1 is rocking with jQuery, CoffeeScript by default.
  • The rake utility won’t work if you create application with rails 3.1 error would be following type….

rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

Solution
 

Step-1 To declare therubyracer gem in Gemfile of your application which is in application’s  root directory. 

gem ‘therubyracer’

Step-2 Then run bundle install command to install therubyracer gem.

$ bundle install
 

  • Now above error will disapper.

Note:- If you create application with rails 3.1 with protopye javascript then therubyracer gem doesn’t require, but rails 3.1 uses CoffeeScript,  jQuery by default. A JavaScript runtime is needed for Linux Ubuntu. It is not needed for Mac OS X or Windows.

 

  • Installed RVM with multiple Rails version in fresh installation of Ubuntu 10.04
  • This tutorial is for single use only means not root (i.e. root@gloscon-desktop:~# ) 

step-0

Open terminal by pressing Cltr+Altr+T OR

From menu Applications -> Accessories -> Terminal

step-1

$ apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

step-2

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

OR 

$ curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer—version latest

OR

$ bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm)

step-3

$ echo ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function’ >> ~/.bash_profile

step-4

restart terminal 

step-5

$ rvm | head -1

‘rvm is a function’

step-6

// install Ruby 1.9.2

$ rvm install 1.9.2

$ ruby -v

step-7

// set Ruby 1.9.2 as default 

$ rvm  – -default 1.9.2

step-8

$ gem install rails -v 3.0.3  // default rails for Ruby 1.9.2

$ rails -v

step-9

$ rvm install 1.8.7

// install Ruby 1.8.7

$ gem install rails -v 2.3.2    //default rails for Ruby 1.8.7

$ rails -v

For more about RVM with GEMSET

=> Gemset is create separate workspace for different versions of rails will not conflict multiple rails versions and gems

// for gemset options by following command

$ rvm gemset

// following command create two gemset for Ruby 1.9.2 

$ rvm gemset create rails222 rails310

$ rvm gemset use rails222

// following command install rails 2.2.2 in gemset name rails222

$ gem install rails -v 2.2.2

$ rvm gemset use rails310

// following command install rails 3.1.0 in gemset name rails310

$ gem install rails -v 3.1.0

// to display all gemsets as following command with all Ruby versions

$ rvm list gemsets 

// to swap from one gemset to another with following command

//syntax $ rvm gemset use

$ rvm gemset use rails222

// You can create & use gemset by following single commad

$ rvm use 1.9.2@demo  - -create

$ rvm gemset name

// To set gemset as default by following command

rvm use 1.9.2@demo  – -default 

// Same for another Ruby as follow

$ rvm use 1.8.7

// following command create a gemset for Ruby 1.8.7 

$ rvm gemset create rails238

$ rvm gemset use rails238

// Following command install rails 2.3.8 in gemset name rails238

$ gem install rails -v 2.3.8

$ rvm gemset use rails238

// You can create & use gemset by following single commad

$ rvm use 1.8.7@demo  – -create

// To set gemset as default by following command

rvm use 1.8.7demo  – -default 

 

 

 

Baltimore’s Rails community has been eagerly anticipating RailsConf. They’ve organized a few different projects to welcome Rails programmers at beautiful city BALTIMORE.

RailsConf 2011 Features

  • Four entire days dedicated to Ruby on Rails

 

  • A program designed around all levels of expertise from beginner to intermediate to advanced

 

  • The most innovative and successful Rails experts and companies showcased onstage

 

  • A forum for people seeking to collaborate and solve similar problems

 

  • A gathering place for the worldwide Rails community, including an important network of experts, alpha geeks, and innovators

 

  • Hands-on and in-depth guides for learning how to best employ Rails in a variety of situations and tackle common problems

 

  • Ample opportunities for all participants to connect, contribute, and collaborate throughout the event

 

  • The chance to hear the latest updates, get information, and meet some of the the Rails core development team

       > Livestreaming the all of the keynote beginning Tue May 17 

 

Ref. by from

http://en.oreilly.com/rails2011

http://en.oreilly.com/rails2011/public/schedule/stype/keynote

 

 

when you are using Phusion Passenger plugin & make change or add file, etc to live site by SVN or directly on server , you need to follow below steps after "up SVN" or changes on server to reflect changes on live site..
  
step-1 Go to web site’s root directory.
               i.e. root@u15369819:/home/yoursite_name.com#


step-2 type command, ps.
               i.e. root@u15369819:/home/yoursite_name.com#ps

step-3  type command like, touch tmp/restart.txt. 
              i.e. root@u15369819:/home/yoursite_name.com# touch tmp/restart.txt

step-4 type command again, ps. 
             i.e.  root@u15369819:/home/public_html/yoursite_name.com#ps

There are different type of testing like unit testing, integration testing, functional testing etc.. Lets we talk about unit testing by using different testing tools and framework.

In ruby on rails there are two different way for testing.

1. Behaviour Driven Development (BDD)

2. Test Driven Development (TDD)

Behavior Driven Development (BDD):

BDD is about specifying the system behaviour by defining exectable specifications in the form of tests. It forces the developer to understand the behaviour of the method he is about to write. Using different tools, the specs written to test the application can be used as specifications.BDD makes it easier for developers to read and understand the code, becoming an additional form of documentation.

Test Driven Development (TDD):

TDD is about defining test cases before writing any other code. By creating unit tests you specify the minimum acceptable behaviour for the code. In TDD, we are usually writing one test per function, leading to many small tests. TDD written to use a more English like vocabulary for expressing functionality.

Now, We move forward to Behaviour Driven Development. There are many tools avaliable to implement BDD by using RSpec,Cucumber,Shoulda, etc..

How to install RSpec and steps to implement RSpec.

1. using gem
    sudo gem install rspec

  or using plugin
    script/plugin install git://github.com/dchelimsky/rspec.git
    script/plugin install git://github.com/dchelimsky/rspec-rails.git

2. When you are doing testing use test database.

3. Generate spec directory in root of application.
   script/generate rspec

4. After installing gem it’s provides facility to generate models and test them.
   script/generate rspec_scaffold post title:string body:text

5. Run the migration file.
   rake db:migrate RAILS_ENV=test

6. Now, write the test case in spec/models/post_spec.rb

    #include the spec_helper available in spec folder of your rails application.

    require File.expand_path(File.dirname(FILE) + ‘/../spec_helper’)

    describe Post do

      before(:each) do
        @post = Post.new(valid_post_hash)
      end

      it "should be valid" do
        @post.should be_valid
      end

      it "should not be valid without a title" do
        @post.title = ‘’
        @post.should_not be_valid
      end

      it "should not be valid without a body" do
        @post.body = ’’
        @post.should_not be_valid
      end

      def valid_post_hash
        {:title => ‘test post’, :body => ‘description for posted test’} #test data which you want to provide

      end

    end

7. All specs have a behaviour_type which determines what helper methods are available to you as you build your specs. You will change the explicitly one line in post_spec.rb is:

    describe Post, "a important information", :behaviour_type => :model do

8. In post model, we have to define the validation for not null and unique title for post.

    class Post < ActiveRecord::Base
      validates_presence_of :title, :body
      validates_uniqueness_of :title
    end

9. You want to run the test case by giving command
    rake spec
    it run the test case and give the output either fail or pass.

=> Spork is a tool used to preload your environment so you don’t have to load it each time you run your features or specs.

- source: http://fr.ivolo.us/posts/rspec-tutorial-part-2-a-simple-test
 

Ruby on Rails 2.3.4 released, this release fixes bugs and introduces a few minor features. Due to the inclusion of two security fixes, all users of the 2.3 series are recommended to upgrade as soon as possible.

Security Fixes

2.3.4 contains fixes for two security issues which were reported to us. For more details see the security announcements:

Bug Fixes

Thanks to the success of the BugMash we have around 100 bug fixes as part of this release. Of particular note is the fix to reloading problems related to rack middleware and rails metals when running in development mode.

New Features

  • Support for bundling I18n translations in plugins, Rails will now automatically add locale files found in any engine’s locale directory to the I18n.load_path. commit 
  • Added db/seeds.rb as a default file for storing seed data for the database. Can be loaded with rake db:seed commit

 

— source

http://weblog.rubyonrails.org/

1. Introduction

This guide covers how to use the tools that come with BrowserCMS to extend the functionality of your BrowserCMS site. The target audience for this guide is intermediate to advanced Rails developers. You should also read the Building a Site with BrowserCMS guide first as well, so you know how to create pages and put content on pages. This guide will cover:

  • What content blocks and portlets are and how they work

  • How to create custom content blocks

  • How to create custom portlets

  • How to create friendly URLs for pages

2. Content Blocks

Content Blocks are the basic unit used to add content to pages in a BrowserCMS site. There are several pre-built content types that are part of BrowserCMS core. The most commonly used one is the HtmlBlock content type, so we will use that as a starting example.

If you look at the HtmlBlock model in BrowserCMS core, you will see that it is an ActiveRecord model, just like any model you create in a Rails application. It also calls the acts_as_content_block method, which just sets up several Behaviors on the model. One of the key Behaviors to understand is the Rendering behavior. Essentially what this behavior does is to allow a model (by model I mean a subclass of ActiveRecord::Base) to act as a mini-controller. This is the same thing conceptually as Merb Parts or Rails Cells, the only difference is that content blocks are models as well, so they have attributes that are stored in the database like any other model.

In the BrowserCMS implementation, first the render method of the object is called, which is like an action. This is where instance variables are set. In the case of an HtmlBlock, there are no other instance variables to set up, so this step is just skipped. It is similar to a controller action that has no action method, it just goes straight to the view.

The view is the render template, which is inside the cms/html_blocks directory in the view path. If you look in the render template, you will see all it does is print the value of @content_block.content. Content is the name of the property that holds the HTML content.

3. Creating A Custom Content Block

Let’s say that you are using BrowserCMS to build a website that will display a list of products. The first step would be to create a product content block. This will give the users of the CMS a way to create products. To create a product content block, in an existing BrowserCMS project, run the content block generator:

<tt>script/generate content_block product name:string price:integer description:html</tt>

You will notice that several things have been created:

  • A model in app/models/product.rb

  • A migration for the product model

  • A controller for the product in app/controllers/cms/products_controller.rb

  • A form partial in app/views/cms/products/_form.html.erb

  • A render template in app/views/cms/products/render.html.erb

  • A resource route for the controller

If you look at app/models/product.rb, you will see that it is nothing more than:


class Product < ActiveRecord::Base
acts_as_content_block
end

The controller created at app/controllers/cms/products_controller.rb is equally empty:


class Cms::ProductsController < Cms::ContentBlockController
end

This controller is the controller used in the actual CMS interface. If you want to create a controller to use in the front end of your application, create a products controller that is not in the CMS namespace, so as not to conflict the CMS functionality. You will most likely not need to customize the CMS controller at all.

The form partial at app/views/cms/products/_form.html.erb is the form that will be used when creating/editing the product content block in the content library of the CMS. The contents of this file will be:

<tt>&lt;%= f.cms_text_field :name %&gt;<br />&lt;%= f.cms_text_field :price %&gt;<br />&lt;%= f.cms_text_editor :description %&gt;</tt>

The form helper methods that are prefixed with cms_ will wrap that form helper with the CMS styling and extra functionality. The cms_text_editor will show the user a WYSIWYG editor for editing HTML. Additional CMS form builder extensions are covered in the BrowserCMS Designer Guide.

The render template at app/views/cms/products/render.html.erb is the template that will be used to render the HTML when this product is placed directly on a page. It is also what is shown when you view a product within the content library of the CMS.

As you will see in the next section, custom content blocks are often not placed directly on a page, instead the data of a product is displayed through a portlet. For this reason, a more informational display, similar to what is automatically generated by the generator, is what the render template often contains. Depending on what your content block is, you may want to place the content block directly on a page, in which case you would most likely customize the render template.

4. Creating A Custom Portlet

Once you have created the product content block and created a few products in the content library, you need a way to display them on a page. To do that, you will want to create a portlet.

A portlet is used to display dynamic data on a page. A portlet is a content block. A portlet will typically perform some kind of database query in the render method and then render it’s view. One difference between a portlet and typical content block is that each instance of a portlet can have a unique template because that template is stored as data along with the portlet. Let’s generate a portlet to display the most recently created products:

<tt>script/generate portlet recent_products limit:integer</tt>

What you will see created is:

  • A portlet at app/portlets/recent_products_portlet.rb

  • A form partial at app/views/portlets/recent_products/_form.html.erb

  • A render template at app/views/portlets/recent_products/render.html.erb

What you don’t see created is a migration. Portlets use the DynamicAttributes behavior in order to store associated values in the database without having to create custom database tables. What this means is that you can set and then store a value for any attribute for a portlet.

So if you look at the form partial that was generate for this portlet, you will see this:

<tt>&lt;%= f.cms_text_field :name %&gt;<br />&lt;%= f.cms_text_field :limit %&gt;<br />&lt;%= f.cms_text_area :template, :default_value =&gt; @block.class.default_template %&gt;</tt>

Every portlet instance has to have a name and that is stored in the main portlets table, but limit is stored in the portlet_attributes table. You could add anything to this form, such as <%= f.cms_text_field :foobar %>, and whatever the user enters for foobar would get saved with the portlet.

If you look at the code for the portlet, you will see:


class RecentProducts < Portlet

def render
# Your Code Goes Here
end

end

As the comment says, you will want to fill in your application logic here. We’re going to get the most recent products and use the value the user entered for limit when they filled out the form. So edit the code to look like:


class RecentProducts < Portlet

def render
@products = Product.all(:order => "created_at desc", :limit => self.limit)
end

end

self in this case is the portlet instance, which is also available in the instance variable portlet</tt>. We are setting the <tt>products instance variable so that will be available in the view. If you look at the render template, you will see this:

<tt>&lt;%=h @portlet.name %&gt;</tt>

This is simply a place holder, you should override this code with something similar to what you expect the user of your portlet to want to use. In this case, let’s go with:

<tt>&lt;ul&gt;<br />  &lt;% @products.each do |product| %&gt;<br />    &lt;li&gt;&lt;%=h product.name %&gt;&lt;/li&gt;<br />  &lt;% end %&gt;<br />&lt;/ul&gt;</tt>

Notice that in the last paragraph I said "similar to what you expect the user of your portlet to want to use". This value is simply the default starting point for the template of a portlet. The actual value is entered into the form when the user creates an instance of this portlet.

If you look back at the form partial that was generated, you’ll see:

<tt>&lt;%= f.cms_text_area :template, :default_value =&gt; @block.class.default_template %&gt;</tt>

What this does is preload the template with whatever you entered into the render template. The user is free to change it as they see fit and even have different values from one portlet instance to the next.

1. What to Expect

This guide covers how to use BrowserCMS to build and manage websites. After reading it, you should understand how to:

  • Create new pages

  • Organize your site navigation via the sitemap.

  • Place content on pages.

  • Dynamically display content on pages using portlets.

  • Create and assign permissions to users.

This guide is aimed at people who are managing sites using BrowserCMS, as opposed to programmers who want to customize it, or designers who want to create new designs for a site.

1.1. What not to expect

This document assumes that users have a working copy of BrowserCMS to play with, either on their local machine, or on a demo site. We don’t cover how to install CMS here, so see the Getting Started Guide in order to get up and running.

In addition, an installation of BrowserCMS will have several templates already installed. The theme might be the default BrowserCMS theme, or a custom theme designed for a specific client. This document does not cover how to design and create new themes/templates, but focuses on the day to day work that content managers will need to do.

2. Basic Concepts

There are several concepts which underly how BrowserCMS works. To be productive, users of BrowserCMS should ideally understand these ideas:

  • Pages – Visitors experience your site primarily via pages. Pages are really compound documents, consisting of more than one editable area of content. The allows for intricate design, without needing to be edited via single giant HTML area.

  • Content Blocks – Blocks are the most granular bits of content in a system. Pages usually have one or more blocks of content associated with them. Content blocks can be anything from a simple fragment of HTML, to a News Article (which might have multiple data fields like name, body and summary), to portlets, which dynamically display other types of content.

  • Portlets – Sometimes you don’t want to manually place all the content on your site. You want to set up some rules, so that when new content is entered, it appears in multiple places. Portlets are generally how that gets done. Portlets are really just a slightly special version of blocks, which generally query for other blocks, and then format them for display.

  • Sections – Each page lives in a section. Sections the primary way pages are organized. Menus are usually dynamically constructed based off the hierarchy of sections and pages. Sections also handle security, where individual groups are allowed to see pages within a given section. Sections and pages can be reordered by using the Site Map tab.

  • Templates – Each page has a template, which handles governs the styles and layout for that page. A template will determine what areas of the page are editable, how many columns it has and how the navigation will work. A website will usually have multiple templates (i.e. Home Page and Subpage) which provide different layout choices for users when they create new pages.

  • Users and Groups – Security is handled via users and groups. A user might represent a public user, who can access some sections of your website (like a Members only section). Or they might be a CMS user who has the ability to make changes to the content via the CMS editing tools. Each user can be part of multiple groups, which define what they can do, including editing pages, viewing content or publishing new pages.

3. Common Tasks

This section will cover some of the more frequent tasks that site managers will need to undertake in order to manage their website. For the purposes of this section, all examples assume a locally running copy of BrowserCMS, accessed as http://localhost:3000. A site hosted elsewhere might be running at http://yourcms.yourcompany.com.

3.1. Logging into the CMS

To access that administrative portions of a CMS, you have to go to the admin login page. To do this, add /cms to your website’s URL. Working locally, this would be http://localhost:3000. From this page, you can log in with your username and password. For a local site, this will be username = cmsadmin and password = cmsadmin. For a live site, this will have been randomly set during install.

After you log in, you will be sent to the dashboard (/cms/dashboard). The details of this page will be covered later, but the dashboard serves a summary of content in various workflow stages. From here, you can jump to other sections of CMS.

3.2. Editing the home page

To understand how editing pages in the CMS works, let’s jump over to the homepage. The quickest way to do that is to click on the BrowserCMS logo in the top left. This will always take you to the home page for your site. When you visit a page in BrowserCMS, and are logged in as editor, you will see the page exactly as a visiter would, with the addition of a toolbar at the top of the page. This toolbar gives you the tools/buttons necessary to make changes to pages, or jump to other CMS admin tabs.

3.2.1. In Context Editing

One of the key concepts to make page editing easier in BrowserCMS is called In Context Editing. It allows you to browse the site as a visitor would, and then edit content directly on the page. By default, you can’t see the editable areas of a page (called Containers), because the Visual Editor is turned off. To show the containers, click the Turn On button on the right side of the toolbar, which turns on the visual editor. You should now see the containers highlighted on the page. The templates for each page determine what areas of the page are editable. Clicking the Turn Off button will hide the containers again, giving you a more accurate view of what the finished page will look like.

3.2.2. Containers

A container is marked by a box with a grey header, with several buttons on it. Each container has two controls, one to Add new content to that container (The + icon) and another to place existing content into the container. It also has a status indicator which shows if any content blocks in that container are in draft mode. Each container can hold zero or more content blocks.

3.2.3. Blocks

Each block within a container is marked with a grey border, and several buttons. Blocks can be edited, reordered using the up or down arrows, or removed from the page (which does not delete it).

3.2.4. Making changes

To edit some existing content, pick the block you want to edit, and click the wrench icon. This will take you to the edit screen for that block. Most content blocks placed on pages are usually Text blocks, which are just pure html content, with a name for organization purposes. On the Edit Text page, you can change the name, or use the WYSIWYG editor to make changes to the content. If you want to edit the source html directly, you can change your editor preference with the toggle to the top right of the editor.

Once your edits are complete, you can save your changes using the Save button at the bottom of the page. This will return you to the page, where you can see how your changes look in context to the rest of your page. Your changes won’t be visible on the public site yet, so you can choose to make more changes. See the next section on how to publish changes.

3.3. Publishing pages

The basic rule of publishing is that all changes need to be published before they go live. This allows editors to always see how their page is going to look, before they decide to commit their changes. Any time you alter how a page looks, the CMS stores a new version of that page and all its content. This happens when you add a new block to a page, make an edit or remove a block from that page. Each time a change is made to content on a page, that page will go into Draft status. As an editor, you will see the latest version of that page, but the public will continue to see the last published version of that page.

Each page has a status of either Published or Draft. When you like how your changes look, and want to publish the page, push the Publish button in the upper left hand corner of a page. This will makes your changes live and visible to the world. When a page is published, each block on that page will also be published.

3.4. Adding a new page

To add new pages to a site, click on the Site Map tab from any where within the CMS admin. The Site Map page shows a tree with all the sections and pages in your site. From here, you can add new pages or sections, choose a page to edit, or reorganize the site using drag and drop to move sections around.

To add a new page, click on the My Site section at the top of the site map. Then click the Add Page button in the toolbar. This will add a new page to the root of the site. There are several fields to fill out the important ones are the name and templates. When you name a page, the CMS will generate a default relative URL (a path) for it. You can also choose a template via a drop down, which will show all available templates for the current site.

After filling out those two fields, you can click save to create the new page. After saving, you will be taken to that page, which will be blank, not having content blocks selected for it.

3.5. Adding new text content to a page

When viewing a page, you can add new content to it. First, make sure the Visual Editor is turned on, so you can see the containers. Find the Add Content icon (+) on the container you want to add the new content to. You will then be able to choose what kind of content you want to create. Text is the most frequently used content type, and is essentially just HTML, including the ability to create links and include images.

Choosing Text will take you to the Add New Text screen. The first field will prompt you for a name. This name is used to help identify your content later, when you are looking for it in the Content Library. Naming Text blocks after the page they are going on is a common choice. The second field is content, which allows you to enter formatted text using a rich text (or WYSIWYG) editor. The editor has buttons for common formating options, like making text bold, copy/pasting of text (including from Microsoft Word) and creating links to other pages.

If you like, you can also change your text editor choice from ‘Rich Text’ to ‘Simple Text’, which will allow you to edit the source HTML directly. This choice is saved as user preference, so next time you edit content, you will use the same editor you picked.

3.6. Adding images and files to pages

When creating content for pages, its a common task to add images or link to files (like PDFs) in the body of the text. There are two steps to adding an image or file to a page. First you need to upload the image/file to the content library. The second is to link to or place the image within a Text block. It is possible to directly place an image or file block into a container (via the Add New Content option we talked about earlier) but this gives you less control over formating and placement.

3.6.1. Uploading files

To add an image or file to the content library, click the Content Library tab, and then click the Image or File menu items on the left hand side. (These content types are under the Core module, so you may need to click Core to show all the content types) Next click Add New Content on the main menu. From here, you can fill in all the details on your image/file, including the file on your local hard drive that you want to upload. One of the choices about creating Image and Files is which section they should be stored in. It’s a good idea to create one or more image/file galleries to keep your files organized.

After the file is uploaded, you can then place it on a page using a Text block.

3.6.2. Placing an image

To place an image, first find the text block that you want to edit (or add). Using the Rich Text editor, click the Insert/Edit Image button. Next click Browse Server, which will allow you to browse through all the images in your content library. This will popup a window which gives you a sitemap view of your site. You can drill down through the sections, finding which the one where you placed your image. Once you locate the image, click the image name to select it. This will add the path to the image to the Image Properties, and allow you to preview the image alongside the text. You can alter the image attributes (size and alignment) or just click Ok to place the image.

At this point, the Rich Text editor should display the image embedded in the text. You can then save the Text block, and see how it looks on your page.

Placing a file is very similar to placing an image. Select the Text block to edit, and click the Insert Link button. On the Link popup window, click the Browse Server button. Using the Site Map browser, choose the file you want to link to, and then select it. This will paste the path to the file into the Link window. Click Ok to add the link to the Text block.

3.7. Finding a page to edit

BrowserCMS features two ways to locate pages to make changes to. The first one is just browsing around the site, using the same navigation that your site users would. The second is the by using the Sitemap.

3.7.1. Navigating to find pages

When an editor is logged in, they can browse around the site using the same menus and links that a guest would. Each page will appear with a toolbar, which only editors see, which allows you to make changes to pages and their properties.

3.7.2. Using the Sitemap to find pages

The Site Map allows editors to see a more conventional file and folder metaphor to browse through the structure of the site. Clicking the Sitemap tab will take editors to this view. Once on the sitemap, editors can expand/collapse sections by clicking on the +/- buttons. They can drill down into each section, to locate the page they want to make changes to. Once the page is located, either select the page and click Edit Page on the toolbar, or just double click the page name. Both take users to the Edit Page view, which allows them to modify the page content.

3.8. Reverting a page

Mistakes happen. Sometimes you make a change to a page, and you don’t like how it looks, or you just want to go back to last week’s version. To roll back a page to an earlier version, you must first edit that page (either by navigating to or by the sitemap). Select the List Versions button from the toolbar. This will show the complete history of the page, along with who made changes, when the change occured, and note about what change happened in that version.

To see what an older version looked like, select a version, and click View on the toolbar. (Recommended Tip: Open the version in a new tab in your browser, by Ctrl-Click on PC, or Command-Clicking on Mac. This will let you compare several versions side by side.) If you like that version, you can revert to it in two ways.

From the List Versions page, you can revert by selecting the version, then clicking Revert. If you are viewing an older version, you can revert by clicking the Revert to This Version. In both cases, it will restore the page to what it looked like in that version, and will mark the page as Draft. Once the editor has reviewed the changes, they can publish it.

3.8.1. Reverting Gotchas

Reverting can be a bit tricky to understand. The basic challenge comes from the fact that both pages and block have their own versions, and blocks can be shared across pages. Consider the example of two pages, Page A and Page B, which both share a Text Block C. Every change to C will also create a new version of A and B. Reverting page A will also likely revert page B. Since reverting a page puts it into Draft, you now have two pages in draft mode. You need to publish both of them to make their changes live. This might be manageable for two pages, but imagine you had a Text called footer which was shared across 20 pages.

See ‘Bulk Publishing’ below for details on how to publish multiple pages at once.

3.9. Reorganize a site’s navigation

There are two ways that BrowserCMS supports navigation. The first is that navigation is manually added as HTML to templates. This is suitable for Fixed Space navigation, which might need to be exactly 400 pixels wide and contain exactly 4 menu items, potentially using images for buttons. The second is using dynamic navigation, which can easily grow as the site architecture does. This is more suitable for sub-sections of the site. BrowserCMS allows editors to dynamically render menus based off pages in the sitemap.

3.9.1. Understanding how dynamic navigation works

When developers create templates, they can set up menus so that they dynamically link to pages in the sitemap. Menus will show both pages and sections, and can show go one or more levels deep, which reflects how users are drilling down into the site architecture. By default, when an editor adds a page or section to the sitemap, under a specific section, a link to that page will automatically be added to the dynamic navigation. For both pages and sections, you can have the option to Hide from menus, which you can do by editing the properties of either pages or sections. Hiding a page from a menu means its still accessible to the public (if the user knows the URL), but just doesn’t appear in the menus.

3.9.2. Moving pages/sections in the sitemap

When pages and sections are created, they are added last in their parent section. They can be reordered though from the Sitemap, by dragging and dropping. To move a page or section, click-hold and drag the page/section where you want it to be. This allows editors to both reorder pages within a specific menu, or move it to another area of the site entirely.

Dropping an item onto a page will place it after that page. Dropping an item onto a section will put it in that section, as the last item. Be aware that moving pages will immediately make changes in how the dynamic site menus appear (there is no publish step needed).

3.10. Setting up restricted sections

It’s a common task to want to restrict specific users from being able to see certain pages. This might include creating a members section, where only registered and approved users can see the content. BrowserCMS allows editors/admins to restrict user access based on sections. Individual pages get their security from their immediate parent. For example, if there is a section called Member Only, which a Guest cannot see, all pages in that section will be block, and guests (unregistered users) that try to access those URLs will be sent to the Access Denied page.

3.10.1. Creating the groups

The first step to secure a section is to set up the groups who are allowed to see it. An administrator can create a new group by clicking the Administration tab, then selecting the Groups item from the left menu. Click the Add Group button, give the group a name (Members), and choose Registered Public User as the group type. By default, this group will able to view all sections within the site. After saving the group, you can alter which sections a user can see, by clicking the name of the group. In this case, the new Member group’s permissions are fine.

3.10.2. Adding users

The next step is to create a user in the Member group. On the Administration tab, click the Users menu item on the left menu, and click Add User on the toolbar. Fill in the basic user information (name, username, email and password) and check the newly added Members group (but no others)

3.10.3. Restricting the sections

The next step is to add the new section, which will be restricted so that only users who are in the Member group can see them. Go to the sitemap, select the My Site (which is the root of the site) and click Add Section. Name the section Members Only, and then uncheck all public permissions except for Member. Next add a page to this section and publish it.

Now, when users who aren’t logged in (Guests) try to visit any pages in the Members Only section, they will be redirected to the Accessed Denied page.

3.11. Setting up Workflow

When the number of contributors to a website grows, it may be necessary to restrict who has rights to publish content. This would allow for multiple editors to contribute and edit content, but content would be passed to one or more ‘publishers’ in order to commit the changes publicly. Workflow in BrowserCMS has several concepts which make it work:

  • Rights – Who can edit and who can publish?

  • Tasking – Who the work is assigned to?

  • Notification – How do people know they have new content to look at.

This section covers how to create a simple workflow, that covers two kinds of groups of people.

  • Contributors: These people should be able to edit pages and content, but should not be able to publish them.

  • Publishers: These people should be able to edit pages/content, and can publish them.

3.11.1. Basic Contributor and Editor workflow

The first step is to create two new groups, both of which should be of type ‘CMS User’. One should be called Contributor, and should only have the ‘Edit Content’ permission. The second group should be called ‘Publisher’, and should have ‘Edit Content’ and ‘Publish Content’ permissions. Next create two users, and assign one of them to each group.

The user in the Contributor group, will be able to make changes to pages and blocks, but will not be able to publish it themselves. When they are done with a page, on the Edit Page view, they can use the Assign button to pass the page to somebody who has publishing rights. Assigning a page provides a drop down with all users who have Edit Content permissions. The contributor can choose the assign to the Publisher, give it a due date and a comment, and then assign the page. This will notify the Publisher via email they have a new task assigned to them, along with the URL to the page.

The Publisher can then log in, find the page they want to review, make sure the changes are acceptable, then publish the page. Once they are down with their task, they can click the Complete Task button to close the task out. In addition, editors and publishers can always find what open tasks they have by going to the My Dashboard.

3.12. Using My Dashboard

The dashboard is the landing page for editors when they log in. It has two main areas, one shows all pages currently in draft. The other shows open tasks assigned to the current users.

3.12.1. Bulk publishing

Some operations in the CMS can put multiple pages into Draft mode as a side effect. This includes making an edit to a block which is shared across multiple pages, as well as reverting a page with shared blocks on it. The Page Drafts panel shows all pages in the CMS which are currently in draft mode. An editor can choose to review each page to make sure it looks right, by clicking on the name of the page. Or they can just select all pages they want to publish via the checkbox, and then click ‘Publish Selected’.

3.12.2. Tasks

All of the open tasks that are assigned to a user will appear on that user’s dashboard, in the Tasks panel. Users can click on the name of the page to review it, and either complete the task, or assign it someone else.

3.13. Adding dynamic content via portlets

For most sites, the majority of the content will be placed directly on pages using Text blocks. Another alternative is to use portlets, which can dynamically select and render content. Portlets are usually part of individual modules, and are used to find and display content from that module. For example, the News module comes with several portlets, designed to find News Articles by specific criteria. One portlet may display a single Article (using an id parameter in the URL), while another may show the headlines to all Articles, chronologically ordered.

Portlets are one of the primary extension points of BrowserCMS, which allows programmers to create new dynamic behavior and allow it to be placed on pages alongside static content. Each portlet will have several attributes which allow users to configure the portlet. These attributes might include a name, max # of results to display, and a template to allow users to change how the portlet displays. This section assumes the News Module has been installed, and walks through the placing and configuring of a portlet.

3.13.1. Placing and configuring portlet on a page

Start by creating a new page. Select the Add New Content icon in the container you would like to add the portlet to. On the Select Content Screen, choose the Portlet type. Then choose which type of portlet you would like to add (Choose the News Archive portlet). Give the portlet a name, leave the categories empty and use the default template.

The News Archive portlet is designed to show a list of New Article blocks. So by default, there probably aren’t any News Articles in the database, so the Archive won’t be displaying anything. Let’s add some News, so we can see how it looks.

3.13.2. Adding content via the Content Library

Choose the content library tab, and open the News module, by clicking the News link on the left. The News Article content type should be selected. Click the Add New Content to create a News Article. On the form, fill in a suitable name, summary, set the release date to today and body, and then click save.

Now return to the recently added portlet. You can do this by opening the Core module, selecting portlets and browsing/searching for the portlet you created. This will allow you do see the portlet in isolation from the page. Alternatively, you can return to the page you were on, to see the portlet where it is placed. The portlet should now be displaying a summarized version of the News Article you just created. You can control how the portlet displays the list by editing the template, which requires an understanding of Ruby/ERB and Html.

A denial of service (DoS) vulnerability was found on the BigDecimal standard library of Ruby. Conversion from BigDecimal objects into Float numbers had a problem which enables attackers to effectively cause segmentation faults.

ActiveRecord relies on this method, so most Rails applications are affected by this. Though this is not a Rails-specific issue.

Impact

An attacker can cause a denial of service by causing BigDecimal to parse an insanely large number, such as:

BigDecimal(&quot;9E69999999&quot;).to_s(&quot;F&quot;)

Vulnerable versions

1.8 series

  • 1.8.6-p368 and all prior versions
  • 1.8.7-p160 and all prior versions

1.9 series

  • All 1.9.1 versions are not affected by this issue

Solution

1.8 series

Please upgrade to 1.8.6-p369 or ruby-1.8.7-p173.

RAILSCONF 2009

Every year Rails developers all over the world eagerly look forward to the most awaited mega event Rails Conference. This year RailsConf 2009, the annual event for the Ruby on Rails community was held May 4-7 in Las Vegas, and was a huge success. It gave new and experienced Rails users practical tools for staying agile and maintaining a competitive edge in an industry that is being transformed by rapid innovation. For four intense days, developers engaged directly with over 100 expert speakers, learning how to exploit the popular framework’s newest features to solve problems and build businesses.

RailsConf 2009 in Las Vegas

The RailsConf, co-presented by Ruby Central, Inc. and O’Reilly Media, Inc., is the largest official conference dedicated to everything Rails. This time around more than 1,300 web developers, IT managers, web-based business entrepreneurs, and others gathered to learn the basics, catch up on the latest developments, and sharpen their expertise, through a variety of presentations and events arranged by Program Chair Chad Fowler and Associate Chairs David Black and Rich Kilmer. Additionally there was a free parallel unconference called CabooseConf where skilled Rails coders from all over the world met in one room to work on their Rails projects.

David Heinemeier Hansson, creator of Rails, on stage at RailsConf 2009 in Las Vegas

David Heinemeier Hansson, Creator of Rails, on stage at RailsConf 2009in Los Vegas.

RailsConf is a unique opportunity for people who use Rails to meet some of the core development team, discuss real-world issues with them, and get their take on the future. This time the conference was set at an important crossroads in Rails development, with an upgrade and multiple enhancements just being completed and an imminent merger with Merb. Rails creator David Heinemeier Hansson of 37signals, filled conference-goers in on plans for the upcoming Rails 3 version, and in a keynote address he discussed "Rails 3 and the Real Secret to High Productivity."

In other keynotes, Hansson conducted an on-stage interview with Timothy Ferriss of The 4-hour Workweek, and Chris Wanstrath of GitHub discussed the importance of sharing code, contributing to open source projects, and focusing on community in a talk he titled "How To Become a Famous Ruby Rockstar or Rails Ninja." Jon Crosby of Engine Yard talked about "Agility in Deployment – Rails in the Cloud," and Robert Martin of Object Mentor discussed "What Killed Smalltalk Could Kill Ruby, Too." A Rails Core Panel gave conference-goers a chance for a Q&A with key Rails developers, including Hansson, Yehuda Katz with Engine Yard, Jeremy Kemper with 37signals, Michael Koziarski of Koziarski Software Limited, and Rick Olson with ENTP.

Chad Fowler, conference chair, on stage at RailsConf 2009 in Las Vegas.

Chad Fowler, Conference Chair, on the stage at Railsconf 2009 in Las Vegas.

Every year they announce winners of the Ruby Hero Words which are given to the unsung heroes of the Ruby/Rails world who teach, create and contribute without recognition or payment. This year’s winners of the coveted Ruby Hero Awards were John Nunemaker, Pat Allan, Aman Gupta, Luis Lavena, Dan Kubb, and Bryan Helmkamp.

Engine Yard chose RailsConf 2009 as the occasion to preview its new Flex service that gives developers new ways to access the benefits of Rails when developing for the cloud. Flex will be available on Amazon EC2 in June. Also at the conference, Blue Box Group and Gear6 announced a partnership to develop and deliver a Memcached-as-a-Service solution to all Blue Box Group customers.

rails-core-team

The Rails core team – Joshua Peek (Consultant),Yehuda Katz (Engine Yard Inc.),Rick Olson (ENTP),Michael Koziarski (Koziarski Software Limited),Jeremy Kemper (37signals), David Heinemeier Hansson (37signals) on stage at RailsConf 2009 in Las Vegas.

Sponsors for RailsConf 2009 were Engine Yard, Heroku, Sun Microsystems, Blue Box Group, and New Relic.

You may like to visit http://www.railsconf.com for complete information on RailsConf2009, as well as watch keynote videos, speaker presentation files, and photos.

 

Plaxo (Address Book Access Widget or contact importer) is an online address book and social networking service.The Plaxo is a simple-to-implement code of JavaScript which you can easily embed on your web page. plaxo official site is <a href="http://plaxo.com" target="blank"> plaxo.com </a>



The Widget provides facility to import contacts from multiple address books like Gmail, Yahoo, American Online, Outlook Express , Plaxo , etc…



Here i provides step which you will follow and get appropiate result



1. Create a page on your site with the following HTML code and save page (like plaxo
contacer.html).

 

    <html>

    <head>

       <script type="text/javascript" src="https://www.plaxo.com/ab_chooser/abc_comm.jsdyn"></script>       

    </head>

    <body>     </body>

    </html>



2. The page in which you  want address book(list of contact) widget than you just add following HTML code inside the HEAD tag

 

     <script type="text/javascript" src="http://www.plaxo.com/css/m/js/util.js"></script>

     <script type="text/javascript" src="http://www.plaxo.com/css/m/js/basic.js"></script>

     <script type="text/javascript" src="http://www.plaxo.com/css/m/js/abc_launcher.js"></script>

     <script type="text/javascript">

         <!—

           function onABCommComplete() {

               // OPTIONAL: do something here after the new data has been populated in your text area

          }

     //—></script>



3. You must give the id of textarea in which you want to place names and e-mail addresses

 

e.g. <textarea id="recipient_list" name="recipients"> </textarea>.



4. Add a button to your page to launch the address book access widget



    – It will place your chosen contact to textarea which has id as recipient_list.



    – Once you have filled in the details, add the resulting code to your page to create the button that will launch the widget. You can place your own button image and onclick you call function as showPlaxoABChooser().



    <a href="javascript:;" onclick="showPlaxoABChooser(‘FILL_ME_IN’, ‘FILL_ME_IN’); return false">



        <img src="http://www.plaxo.com/images/abc/buttons/add_button.gif" alt="Add from my address book" /> 

    </a>



- Now you see the result which you expect. I think this may help you to integrate address book successfully. If you have any query or suggesstion than post here as comment.

After configuring mephisto blogging application by following steps from previous post of Priyanka (Integrate Mephisto with Rails), you will notice that text formating options available with mephisto are not so user friendly and you will have tough time while formatting text, including inline images in your blogs. And you will require a wysiwyg editor for formatting text of your blogs with images and well formated texts which is not available by default in mephisto.

Now in order to integrate fckeditor with your mephisto installation you need to follow certain steps which are mentioned below :

*steps are for rails version 2.2.2 or higher

1.) Install and Configure mephisto (Follow steps from Integrate Mephisto with Rails)

 

2.) Install fckeditor plugin

* ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor

* rake fckeditor:install

 

3.) If you are using rails version 2.2.2 or higher then

* in the file vendor/plugins/fckeditor/app/controllers/fckeditor_controller.rb look for

uploaded = request.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"

replace it with this

uploaded = ActionController::Base.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"

similarly in the file vendor/plugins/fckeditor/lib/fckeditor.rb replace

js_path = "#{request.relative_url_root}/javascripts"

with

js_path = "#{ActionController::Base.relative_url_root}/javascripts"

* patch from http://github.com/salicio/fckeditor/commit/fcf8fbee8cfad3a3df0df50172e448727909ccb9

 

4.) Edit app/views/layouts/application.htm.erb file

* Put this line in the file

<%= javascript_include_tag 'fckeditor/fckeditor' %>

 

5.) Edit your app/views/admin/articles/_form.html.erb for articles

* Search for <%= form.text_area :body, :class => 'fat', :rows => 25 %> near line no 11

replace it with this 

<%= fckeditor_textarea( 'article', 'body',:toolbarSet => 'Simple', :width => '100%', :height => '200px') %>

other usage details are available in README file of fckeditor plugin (vendor/plugins/fckeditor)

or can be found on http://blog.caronsoftware.com/2006/08/07/fckeditor-plugin-for-rails

 

6.) There is a another small glitch, due to the interaction with safe_erb.

in the file vendor/plugins/fckeditor/lib/fckeditor.rb at line no 15 replace
value = value.nil? ? "" : value

with

value = value.nil? ? "" : value.untaint()

After carefully following above steps you will be able to use fckeditor in your mephisto application and will be able to insert inline images and rich text to your blogs.

Happy blogging.....!!!!!!

 

Gujarat Cricket is the first initiative in the field of cricket by RailsHouse which is a part of GLOSCON. It's a web-property, provides platform to those who wants to play cricket for their interest.

Cricket is One of the most popular sports in india. Its a platform where one can join the club and play cricket professionally. Cricket which was played in streets..such way goes Global. It is initially at the state level for GUJARAT .

To be apart of gujarat cricket first you have to join the club as Player, Coach or umpire by placing request to that club. Club have facility to manages their members. Club selects the players and form a team for match. Club participates in tournament to play match. Tournaments organize based on age group like man , woman and children . Tournament can have different types of match like One day , 20-20, Test match etc..

Gujarat Cricket shows the available grounds, dates, statistics of all the matches and statistics of individual players. The summary of particular match can be seen in scorecard once the match finishes. One can find the detailed scores and stats of the whole match here. Viewer can view Clubs and players related videos, pictures on gujarat cricket.

The striking feature of gujarat cricket is "Trade A Player" . If any club wants to have any player of another club than club trade the other club's player by dealing with it. Sponsors can sponsor any player, tournament or club.

Gujarat Cricket have facility to display top listed and most popular players and club. It also provides club headlines. Once tournament is completed experts are provides their views on it and other can make comment on views.

Gujarat cricket required deep software engineering and analysis for that we prefer open source technology such as Ruby on Rails . Gujarat Cricket have many interactive web 2.0 features like poll, ratings, comments and many more.

RoR_icon.jpg“Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language. It is intended to be used with an Agile development methodology which is used by web developers for rapid development…” Wikipedia (http://en.wikipedia.org/wiki/Ruby_on_Rails)

Ruby on Rails has already created a buzz in the web development and challenged the capability of Giant Players like Microsoft's Asp.NET and Java.

Ruby On Rails also powering some of the best open source web applications. This application can be proven as best learning practices for newbie’s bottom up learners in rails development and time savers for seasoned rails developers. By looking into this applications newbie’s can easily know about best practices in rails, standard plugins/gems used in rails project to accomplish tasks and learn best practices of rails. This application can be proven as time savers for rails developers as by customizing or extending them can meet project requirements. So every rails developer should always keep eyes on such rails projects to learn rails best practices.

Below is the list and descriptions of the top most open source projects build using rails. Beside these projects there are lots of other open source rails projects are going on.

Spree (e-commerce solution)

Picture_1.png

The goal of the project is to build a complete open source e-commerce solution for Ruby on Rails. The Rails commerce space is immature and is lacking serious solutions for developers looking for answers to their complex business needs. Rails is especially problematic because it is a relatively new technology and suffers from “small project mentality. Most open source projects in Rails are maintained by a single individual and tend to be limited in scope. Spree seeks to create a large and healthy open source community of the type that developers of other languages are used to participating in.

License: New BSD License Author: Sean Schofield
Home Page:
http://spreehq.org Source Code: http://github.com/schof/spree

Tracks (A GTD style task list)

tracks_home.png

Tracks is a web-based application to help you implement David Allens Getting Things Done methodology. It was built using Ruby on Rails, and comes with a built-in webserver (WEBrick), so that you can run it on your own computer if you like. It can be run on any platform on which Ruby can be installed, including Mac OS X, Windows XP and Linux. Tracks is Open Source, free and licensed under the GNU GPL.

License: GPL Author: BSAG, Luke Melia, Reinier Balt & contributors
Home Page:
http://www.getontracks.org Source Code: http://github.com/bsag/tracks

 

OpenMind (customer feedback community)

shot1.jpg

OpenMind enables you to build an online community with your customers and partners, allowing you to, find out what features and improvements your customers as a whole would value most ,engage in an online discussion with your users to gain deeper insights into their needs, communicate upcoming releases, closing the loop on customer feedback your customers can see exactly which suggestions became committed features of a future release based upon community feedback ,Gain deeper insights into specific targeted topic areas through user surveys, Allow customers to engage in online discussion with each other and with you via online forums.


License: GNU GPL Author:
Robert & Richard Sturim
Home Page:
http://openmind.sourceforge.net Source Code: http://github.com/spob/openmind

 

Insoshi (Social networking platform)

insoshi.png

A social networking platform, funded by Paul Graham's Y Combinator investment firm, that aims to be the "MySQL of social networking platforms: free for hackers, with a commercial product for businesses." The project lead is Michael Hartl, author of the book, "RailsSpace."

 

License: GNU GPL Author: Michael Hartl
Home Page:
http://insoshi.com/ Source Code: http://github.com/insoshi/insoshi

 

Webistrano (Web-UI for managing Capistrano deployments )

websitrano.png

Webistrano is a Web UI for managing Capistrano deployments. It lets you manage projects and their stages like test, production, and staging with different settings. Those stages can then be deployed with Capistrano through Webistrano. Webistrano's purpose is to make the deployment of multi-stage and multi-environment scenarios easy. Further it allows you to track who deployed what, when to which servers and be alerted by email on each deployment.

License: BSD Author: Jonathan Weiss
Home Page:
http://labs.peritor.com/webistrano Source Code:http://labs.peritor.com/svn/webistrano/trunk

 

Hobo Central (web application builder )

Hobo - the web application builder for Rails_1238678525310.png

Hobo is a collection of open-source plugins for Ruby on Rails that help you build anything from throwaway prototypes and internal utilities to meticulously crafted full-blown web apps. The goal: write less code. So much less in fact that it starts to feel like you're not implementing your app at all, you’re just declaring what you want.

 

License: MIT Author: Tom Locke
Home Page:
http://hobocentral.net/ Source Code: http://hobocentral.net/blog/getting-started/

 

Savage Beast 2.0 (forum plugin)

Based on the very popular Rails message forum, Beast, this is a Rails forum that implements multiple topics, posts, moderators, RSS feeds, localization, and most all the niceties you've gotten to know on the Beast forums (beast.caboo.se). The goal of the Savage Beast plugin is to get the featureful forums of Beast, without the hassle of maintaining separate Mongrels, subdomains, and User sharing that make Beast tricky to setup.

License: MIT License Authors:   william.harding

Home Page: http://code.google.com/p/savage-beast-2/

Source Code: http://code.google.com/p/savage-beast-2/downloads/list

 

Community Engine (social network plugin)

social-network-plugin.gif

Community Engine is a free, open-source social network plugin for Ruby on Rails applications. Drop it into your new or existing application, and you’ll instantly have all the features of a basic community site.

Features of this social network plugin:

  • Authentication (sign up, log in)
  • User profiles
  • User search
  • Blogs with tagging, categories and rich text editing
  • Photo uploading and tagging
  • “Clippings” - visual bookmarks
  • Commenting and comment notification by e-mail (Blogs, profiles, photos, and clippings can be commented)
  • Forums
  • Friendships and activity feeds
  • Favoriting of clippings and blog posts

License: MIT Author: Bruno Bornsztein
Home Page: http://www.communityengine.org Source Code:
https://github.com/bborn/communityengine/tree/master

 

OneBody (community focused social network)

profile.png

OneBody is web-based software that connects community members, especially churches, on the web.

License: GPL Author: Tim Morgan
Home Page:
http://beonebody.com Source Code: http://github.com/seven1m/onebody

 

Mailr (web mail application)

webmail.preview.png

Mailr is an open source webmail application that can be used with any IMAP server. E-mails can be created both in HTML & plain text. E-mail addresses in the contact list are Ajax-auto-completed just like Gmail & more.

Features

  • Uses IMAP protocol
  • Caches IMAP server connections
  • HTML and plaintext message composition
  • Addressbook (contacts) with possible import from CSV file
  • Ajax based autocomplete of email addresses
  • Mail filters based on Maildrop
  • i18n support

 

Home Page: http://mailr.org/ Source Code : http://mailr.org/latest-code

 

Mephisto (blogging system)

mephisto-overview.gif

Mephisto is a free Ruby-based weblog-engine which combines the quality, functionality and user-friendliness of other systems in a simple, elegant and powerful user interface.

Mephisto offers a classic equipment which bloggers would probably expect form a professional weblog-engine. Posts can be stored and presented in different sections and on different pages. You can set the time and date you’d like Mephisto to publish a given article automatically. The system doesn’t provide a WYSIWIG-editor, however it supports Textile, Markdown and Markdown with Smartypant. You can use the embedded preview function to make sure your article looks just the way you’d like it to be presented. The number of posts shown on one page can be defined for every single section.

The main advantage of Mephisto lies in the simplicity and user-friendliness of collaborative publishing. Not only multiple authors can use the engine, they can also edit the same document at the same time

License: MIT Author: Rick Olson and Justin Palmer
Home Page:
http://mephistoblog.com/ Source Code: http://github.com/technoweenie/mephisto

 

Substruct (Shopping cart / e-commerce application)

substruct-order-list-small.png

* The first and most robust Ruby on Rails open source e-commerce project. A replacement for old, brittle and crusty shopping cart packages

* Cleanly designed, easy to extend and maintain
o Implemented as a Rails Engine.
o Adheres (where possible) to XHTML / CSS standards
o Persona and scenario driven UI design

* Extracted from ''real world'' code

License: GPL v2 Author: Subimage LLC
Home Page:
http://substruct.subimage.com/ Source Code: http://code.google.com/p/substruct/

 

Radiant (content management system)

screenshot.jpg

Features:

  • An elegant user interface
  • Flexible templating with layouts, snippets, page parts, and a custom tagging language
  • A first-class extension/plugin system
  • Simple user management and permissions

License: MIT Author: John W. Long
Home Page:
http://radiantcms.org/ Source Code: http://radiantcms.org/download/

 

Active Record associations can be used to describe one-to-one, one-to-many and many-to-many relationships between models. Each model uses an association to describe its role in the relation. The belongs_to association is always used in the model that has the foreign key.

(1) One-to-one

Use has_one in the base and belongs_to in the associated model.

models/employee.rb
has_one :address

models/address.rb
belongs_to :employee #foreign key – employee_id
end

(2) One-to-many

Use has_many in the base, and belongs_to in the associated model.

models/user.rb
has_many :events

models/event.rb
belongs_to :user #foreign key – user_id

(3) Many-to-Many

There are two different ways to set up a many-to-many association in Rails.

1. has_and_belongs_to_many (often reffered to as habtm)

In migration
def self.up

create_table ‘categories_products’, :id => false do |t| t.column :category_id, :integer t.column :product_id, :integer end end

models/product.rb
has_and_belongs_to_many :categories

models/category.rb
has_and_belongs_to_many :products

Here join table ‘categories_products’ contains primary keys of both the tables. The table name follows alphabetical order of each table, separated by an underscore.

2. has_many :through

models/categorization.rb
belongs_to :product
belongs_to :category

models/product.rb
has_many :categorizations
has_many :categories, :through => :categorizations

models/category.rb
has_many :categorizations
has_many :products, :through => :categorizations

This technique is used when you want to put some additional fields in median table. Here categorization is a full model that represent the join table.

So, with these tips you can choose the right one for your project.