Thursday, April 29, 2010

Four Seasons of Code

It started after a discussion with Sankarshan, Rahul and Kushal. We needed a system (a web application) to manage student projects. Google Summer of Code was using this framework called Melange. So I was thinking in the lines of developing a similar application using Ruby on Rails, which could be used by Fedora Summer Coding program or similar programs like the DGPLUG Summer Training.

I thought it up as in idea for this year's Fedora Summer Coding. But then I thought maybe I could start up on the project and develop some existing funtionality, so that the student coding on it would have an idea of what's in the books and get something to start on. Maybe add some new features or something.

I have been developing it for the past three weeks. I have some code which I have hosted on GitHub.

Here us a list of the features the web application currently has:

User Management:

* Authentication of three different types of users:

0. Guest user (unauthenticated user)

1. Admin

2. Mentors

3. Students

* Project listing and About page available to unauthenticated user.

* User listing.

* User profile with information about project activities.

Projects Ideas

* Mentors and Students able to add project ideas.

* Mentors can volunteer to mentor a project of their choice.

* Project proposers and mentors can edit project ideas.

* Project proposers can delete project ideas without any mentor.

* Admin can add/edit/delete all projects.

Proposals from students

* Students able to submit proposals for all projects.

* Students able to edit proposals.


* A user dashboard having current logged-in users project activities.

A lot more work needs to be done. I will soon create a task list for Fedora Summer Coding.

If you are a students who wants to work on FSoC as a part of Fedora Summer Coding follow guidelines mentioned in the wiki.

FSoC is liscenced under GNU AFFERO GENERAL PUBLIC LICENSE version 3.

Posted from GScribble.

Tuesday, April 20, 2010

Defining various roles via ActiveRecord Associations using Ruby on Rails

I have a User model. and I have a Project model.

Now a User could be associated with a Project in three ways,
* It could propose as project
* It could mentor a project
* It could be a student working on a project

I had added three foreign keys in my Project model,

t.integer "proposer_id"
t.integer "mentor_id"
t.integer "student_id"

Now how do I associate the three foreign keys with the User object?


Add the following associations to your Project model:

belongs_to :proposer, :class_name => "User", :foreign_key => "proposer_id"
belongs_to :mentor, :class_name => "User", :foreign_key => "mentor_id"
belongs_to :student, :class_name => "User", :foreign_key => "student_id"

Now you can access your user from the Project instance like this:

@proposer = project.proposer
@mentor = project.mentor
@student = project.student

where project is an instance of Project model and proposer, mentor, student would be instances of the User model.

Foreign keys changed to match Rails conventions as proposed by Shakthi Kannan


To access the assiciations from the User model, use the following associations:

has_many :project_proposals, :class_name => "Project", :foreign_key => 'proposer_id'
has_many :project_mentorships, :class_name => "Project", :foreign_key => 'mentor_id'
has_many :project_internships, :class_name => "Project", :foreign_key => 'student_id'

From your user model you can access the associations from your User instance like this:

@project_proposals = user.project_proposals
@project_mentorships = user.project_mentorships
@project_internships = user.project_internships

Posted from GScribble.

Monday, April 19, 2010

gscribble + blogger


Its been long I had been expecting Blogger support for Roshan Singh's gscribble.

This weekend Roshan sent me an RPM, and told me to test it. So that is what I am doing right now.

It fetches all my recent posts, and gives me an option to edit it. Although I do not get to see pictures in the 'Visual' mode.

Also it would have been great if I was able to write/edit my posts directly from the 'Visual' tab.

I see the gscribble logo I had made for Roshan on the notification area. Clicking it hides the gscribble window. Clicking it again, revives the window, but the tab switches to 'Visual' and the 'Categories' pane has to be resized again.

Now I'm going to publish this blog, but I see two buttons below: 'Post' and 'Publish'. Which one to click?

Posted from GScribble.