Ruby on Rails

Nested controllers with Goldberg (UPDATE: fixed in v0.2.1)

Tags: 

The Rails plugin Goldberg is really quite good for kick-starting a site with its permissions system and basic CMS. There is one small bug in it though, it doesn't like adding nested controllers in the admin console. There is, however, a simple work-around: simply go to e.g.:

That will load up the New Controller page which lets you type in a controller name and set the default permissions for it, so all you have to do is type in the name of your new controller, e.g. admin/news, and it'll work just fine from there!

UPDATE: FYI this has been fixed in the latest v0.2.1.

Improve Redmine's client management options

Tags: 

Out of the box Redmine doesn't look like it has a lot of options for managing clients, but you'd be wrong - with a little customizing you can at least fake it. There are two parts to this - set up a new user group and add some custom fields for users.

The first step is to create a new user group called Client:

  • Log into the Administration -> Roles & Permissions page and click on New Role
  • Set the name to "Client" and give them the follow permissions: Issues - add, add a note, change status, new file, new relation; News - add a comment; Documents - add, new file; Files - add. (adjust as you see fit)
  • Save what you've set and assign a user the Client role for a project.
  • Next time you view that project's Overview page it'll list them on the Members block as a Client

Simple but useful.

The second step is to round off the user information options by adding some custom fields.

  • Go to the Administration -> Custom Fields page and click on Users link.
  • Click on New Custom Field, set the name to "Company", leave the format as "text", set the min length to 0, the max length to e.g. 30, leave the regular expression field blank, leave the required option unchecked, and click Save.
  • Repeat for any other fields you want, e.g. Work Phone, Cell Phone, Work Address, etc.

Now any time you add a user you can give them the above information.

Putting these two together, now when you go to the Project Overview page you can see who the client is and by clicking on their name see their contact information.

N00b FAQ: belongs_to is singular

Tags: 

A little tidbit I forgot along the way - in Rails the belongs_to (1-to-many association directive at the 1 side) directive needs you to assign it a singular symbol and not a multiple, e.g.:
[source:ruby]class Product belongs_to :category
end[/source]

Tip: Moving RedMine to another server, don't forget the files

Tags: 

This past week I moved an install of RedMine from one server to another, or rather I just moved the database over and checked out the SVN code again. After getting it going correctly I promptly forgot about the fact it was at a new location and just worked away on my assigned tasks. Well, as it turns out I'd completely forgotten about the uploaded files, which now wouldn't download anymore. The problem was that I forgot to verify where the attached files were stored, and it turned out to be in "files" directory, so now I have to manually copy those few files over and all will be well.

Tip: Rails on OSX, Apache 1.3

Tags: 

Here's a little tip for running Rails apps on OSX's default install of Apache 1.3: make sure the dispatch.cgi file has the correct shebang line, i.e.:

#!/usr/local/bin/ruby

In the app I was trying to run it was set to a different path so wouldn't work - lots of hair-pulling later and I got it working.

Pages

Subscribe to Ruby on Rails