This is all too common of faq in rails help channels and on mailing lists so it mine as well have some examples here too! Stick this in your user.rb model:
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?
This is just one way of doing this and its very simple once you see it:
Create this and use this methed:
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?
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.
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.
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
You may find yourself needing to know certain ruby to ascii character equvalents when you`re building your apps. This simple one liner will list all 256 that you'll most commonly run accross. Just run it on irb.
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 <email@example.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.
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:
This will stay up permanently as a rake tasks reference guide page.
Check this out - These will cascade your js and css - so separate views can have separate js and css files.
Cascading Stylesheets is a plugin that enhances the behaviour of
the built-in stylesheetlinktag macro to support a :defaults parameter.