How to access email address book in your web application

Posted in Rails, Ruby, Ruby on Rails, ror on March 26th, 2009 by admin – 6 Comments

MySpace, Twitter allows you to import address book from all the providers. With the help of that functionality user can invite their friends to join their network easily. (there is no need to type each and every email address manually).
In One of my web application I have to implement the same functionality that give users access to their up-to-date address book from my website.

I found three options for the same functionality.

1. Plaxo
Its is a third party integration. It is free and easy to implement. The Address Book Access Widget is a simple-to-implement snippet of JavaScript that you can embed on any web page. The Widget allows visitors to a particular site to (1) seamlessly import contacts from multiple address books, (2) select entries, and (3) enter selected data into web page forms.

2. Octazen’s Contacts Importer (Address Book Grabber)
They also have a ruby version and that will cost you around $300
Visit the following url to order that package http://www.octazen.com/store.php

3. Contacts a ruby gem or plugin
It will allow you to grab contact list from Hotmail, Gmail, Plaxo and Yahoo.

How to get?

How to use?

How to generate rails application with specific rails version

Posted in Ruby on Rails, ror on March 18th, 2009 by satish – Be the first to comment

If you

Liquid Basics

Posted in Rails, Ruby, Ruby on Rails, liquid, ror on March 3rd, 2009 by admin – 1 Comment

Liquid is a template engine extracted from the e-commerce system Shopify. Now t is a stand alone ruby library. Liquid can be used either in a Ruby application or in a Ruby On Rails application

Why Should We Use liquid ?

  1. Allow users to edit the appearance of your application.
  2. Easy and secure.
  3. Render templates directly from the database.
  4. Style HTML as well as emails.
  5. Extending Liquid is very easy
  6. Simple markups.
  7. If you like Smarty-style template engines

How to get it?

Liquid can be installed either as liquid gem or plugin.

Plugin can be installed simply with by script/install:

RubyGems

Liquid Basics
Liquid have two type of markups

  • Output markup (which may resolve to text)

             {{ matched pairs of curly brackets (ie, braces) }}
example

  • Tag markup (which cannot resolve to text and are used for logic)

             {% matched pairs of curly brackets and percent signs %}
example

Rounded Corners Using Pure CSS Without Images And Javascript

Posted in css on January 1st, 2009 by admin – 2 Comments

The above code will generate the following ouput

Example One

Rounded Corners Without Any Css and Javascript

Dynamic Scope Methods in Edge Rails

Posted in Rails, Ruby on Rails, ror on December 30th, 2008 by admin – 3 Comments

We perform simple queries using dynamic finder and for commonly used query logic we use named scope.

but we cant chain query conditions when using these dynamic finders.

With the addition of dynamic scopes, we can now have a way to both quickly specify query logic and chain further conditions.


We can now use class methods like scoped_by_user_name(user_name) and scoped_by_user_name_and_password(user_name, password) that will use the scoped method with attributes you supply.

Merb gets merged into Rails 3

Posted in Rails, Ruby on Rails on December 28th, 2008 by admin – Be the first to comment

Ruby on Rails and Merb team decided to

First Ruby Fun Day : A Ruby And Ruby On Rails Event In India

Posted in Rails, Ruby, Ruby on Rails, ror on November 19th, 2008 by admin – Be the first to comment

Geekeerie organising a full day ruby and ruby on rails event scheduled on 22, Nov 2008 at Impetus Technologies, D-40, Sector 59,NOIDA,UP,India Noida, India.

And not just that, RubyFunDay comes with free goooodies like lunch and Ruby p T-Shirt.

So as you have signed up already for the event, please provide us your T-Shirt size here http://spreadsheets.google.com/viewform?key=p2AxAft0ZpLVXLO-mLbpPFw

For event details and participation confirmation: visit http://rubyonrails.in/events/3

How to load selective fixtures to db in rails

Posted in Rails, Ruby on Rails, fixture, ror on August 30th, 2007 by admin – 5 Comments

Al of you know how to load fixture to db

rake db:fixtures:load 

To load a subset of your fixtures to your projects db

rake db:fixtures:load FIXTURES=users,stores

Star rating in ruby on rails

Posted in Rails, Ruby on Rails, ajax, css, rating, ror on August 24th, 2007 by admin – 6 Comments

Recently I needed to implement star rating system for one of my project I am working on.

If you are not familiar with a star rating system, its simply a method of voting using (usually) 5 stars in a row, which will change colour as you hover over them indicating the level at which to rate something. You may think a simple rollover would accomplish this but difficulty arises because as you rollover each star it should stay highlighted while you light up the next one and so on until the end of the row of stars.

If this doesnt make much sense to you then take a look at what we are going to achieve in this article. (I will leave the server-side coding to someone more knowledgeable and we will just concentrate on the visual aspects of making this effect happen. )

As you can see from the demo the stars stay hovered as you rollover each one. However, as mentioned earlier, the complicated part is that as each star is hovered it should stay alight while the next one is hovered so that if you start at the left side then 1,2,3,4 and 5 stars will be alight as you traverse the row. Usually a rollover will only be active on the anchor that the pointer is currently over making previous anchors lose their focus and thus their hover effect disappear.

 

Install the acts_as_rateable plugin.

Run the following from the root of your Rails app to install the plugin.


or
http://rubyforge.org/projects/rateableplugin/

Create the table(migration) to store rating into database

Model

models rateable

I was trying to add a rating system for the model Picture. Yours can obviously be whatever you like but from here on out Ill be using Picture. So add acts_as_rateable to your model.

Controller to handle the rating

Views

Create the partial /views/rating/_rating.rhtml

A little RJS

Create the file /views/rating/rate.rjs

This will replace the star ratings with the partial we created previously in order to reflect any rating changes made by the submission.

Render the partial in one of your views.

This needs @picture(or whatver youre going to be using) in order to function.

Remember to add the css and image

Image for your CSS

star_rating.gif


 

How to Paginate With Ajax

Posted in Rails, Ruby on Rails, ajax, paginate, ror on August 1st, 2007 by admin – 1 Comment

Pagination is a very common task in web application development. But sometimes we need to paginate something with ajax request. The interest to use Ajax for this is to provide a dynamic interface which doesn’t need to reload the entire page when next results(page) displayed. Ajax is really nicely integrated with Rails, and using it is very easier with this great framework. To work with ajax requests your browser must be enabled to handled java script requests. I knew two methods for that problem.

First Method

Your Controller code

Layout

View

Second Method

Put this code in a helper somewhere

and use following code for creating links
View