Employees HABTM projects, projects HABTM employees

The Problem

I am doing a permissions page for a project where I know that I can get all of the employees in the system (@employee.find(:all)) or get all the employees for the selected project.

How can I get a list of all the employees in the system and have a check box that states if they are associated with the current project or not?

A solution

This is just one way of doing this and its very simple once you see it:

Create this and use this methed:

EngineYard - Clustered Ruby on Rails

A hosting company to keep an eye out for and one who will be part of our review is the new on the scene clustered apphost. I'm very excited to review their services and seeing what this innovative setup is capable of.

Here is the brief history of engine yard by written by Tom one of ther core developers:

It’s been 14 months since I took Rails seriously, and perhaps 18-20 months since I first heard about it. Where did the time go?

Setting the Relative Url Path in Ruby on Rails

The Problem

You're using apache with fastcgi and you can access the "you're running rails" page at the but can't get to any of my controllers at , getting 500 errors instead.

 

The Solution

In environment.rb set the following at the bottom:

 

ActionController::AbstractRequest.relativeurlroot = '/myrailsapp'

If that fails, I recommend trying it with mongrel webserver which has been known to fix whis problem for many.

Defining a Unique Field Using Migrations

I've seen this come up quite a few times so it warrants a permanent reference here:

How its done

In your migraton put:

add_index :permissions_roles, [:permission_id, :role_id], 'unique'

If you're using it as a key make it an index as well

add_index :permissions_roles, [:permission_id, :role_id], 'unique', :index => true

ActionMailer Examples: Responses, Welcome Greetings, Sendmail, Templating and Performance

Using Rails ActionMailer The Right Way

By providing the full name in the @from field, you avoid having emails say they were sent from congratulations:

def new_registration(user)
@subject = ‘Welcome!’
@recipients = user.email
@from = ‘Ruby on Rails Blog <congratutions@domain.com>’
@body[”user”] = user
end

Now the email will show that it’s from Ruby an Rails Blog. This passed some simple tests with yahoo and gmail with no messages being sent to the spam folder. Everything comes through perfectly.

Rob Levin of Freenode has passed away

Many of you who use the freenode network may have met the man, alias lilo in the #ruby-lang channel where he frequently hung out and conversed. I had the fortunate chance to speak with him on a few occasions in April of 2006.

Rob Levin, founder of the Peer-Directed Projects Center and Freenode IRC network, passed away from injuries sustained in a bike crash on September 12th.

Levin’s death was announced as a “Global Message” on the Freenode IRC network:

Cascading Javascripts and Stylesheets in Rails Apps

Check this out - These will cascade your js and css - so separate views can have separate js and css files.

Cascading Javascripts is a plugin that enhances the behaviour of the built-in javascriptincludetag macro.

Cascading Stylesheets is a plugin that enhances the behaviour of

the built-in stylesheetlinktag macro to support a :defaults parameter.

More an Cascading Javascripts

If :defaults is passed as a parameter, the javascriptincludetag macro will load the following javascript files (if present) in order: