Skip to content


Subversion checkout URL

You can clone with
Download ZIP


parolkar edited this page · 5 revisions
Clone this wiki locally

Here is an example of how you can make use of the plugin

Whats required?

  1. Your app with models which require profiles to be attached to them
  2. You are OK with installing haml/sass in your app & your app is on rails 2.3+

Here you go!

  • Let me quickly help you in building an app from scratch (if you dont have one yet)

    $ rails your_app $ cd your_app $ git init $ ruby script/generate model User nickname:string password:string $ ruby script/generate model Company shortname:string $ ruby script/generate controller Profile index
  • You need to install compass (for haml/sass) in you app , check the instructions here and then setup the plugin

    $ git submodule add git:// vendor/plugins/has_profile_items $ rake has_profile_items:setup
  • and then just make use of has_profile_items

class User < ActiveRecord::Base
has_profile_items [:first_name]  # Add has_profile_items [:item_type1,:item_type2,…]

class Company < ActiveRecord::Base
has_profile_items [:description]
class ProfileController < ApplicationController
def index
user = User.find_or_create_by_nickname(params[:id]) # for you, this can be ‘current_user’
@profile_items = user.profile_item_list

  • add this is views/profile/index.html.erb
   Welcome to your profile
    <%= render :partial => 'profile_items/profile_item', :collection =>  @profile_items -%>

  • Run script/server & point your browser to http://localhost:3000/profile/index/yournick
Something went wrong with that request. Please try again.