Archive for August, 2009

git: send changed files to github

Posted in Uncategorized on August 20th, 2009 by paul – Be the first to comment

git push origin will send any files one has commited locally to the mast server (eg github).
That is a simplistic explanation however.
git status is handy as it will give you an idea of the, umm, status of the files you are working with…

using custom routes to pass parameters to a method

Posted in rails on August 3rd, 2009 by paul – Comments Off

In an application I am working on I needed to pass the ID of an object to the new action of a controller. This ID was the id of an object the new object would be linked to.

Now creating the link as /controller/object_id called the show method (as this is a standard restful route). What I wanted to do was do something like /controller/new/object_id , but that isn’t a valid route.

What I had to do was create a custom route to make this work.

So in my routes.rb file I added a line like this:

map.new_object '/controller/new/:object_id', :controller => 'controller', :action => 'new'

now in my new action I can access the passed in id as params[:object_id]