I just ran across this group called “SuperHappyDevHouse“. It is a Bay Area get-together for geeks to collaborate and code all night long. I would prefer a group that meets every night in a coffee shop and code away. I don’t expect everybody to show up every night, but it would be nice to always have someone to code next to.
Entries from December 2006
Controllers and layouts
December 12, 2006 · Leave a Comment
Every controller has its corresponding layout with the same name. To have a consistent look in an application, every controller should use the same layout. To do this, in the controller you can set the layout by using the following line:
layout "<global_layout>"
Categories: rubyonrails
ElementNode.setAttribute(name, value)
December 11, 2006 · Leave a Comment
I have to make an html table sortable by any column. I found the following javascript library that does the trick: “sorttable: make all your tables sortable“
There is one problem: my table has alternating colors for the rows. After the sort, some adjacent rows have the same color.
Solution: After the sort, set the color to alternating colors.
var sortedRows = document.getElementsByTagName(“tr”);
for (var i=0; i<sortedRows.length; i++) {
if (i%2) { sortedRows[i].setAttribute(“bgcolor”, “white”); }
else { sortedRows[i].setAttribute(“bgcolor”, “silver”); }
}
Categories: dom
Cheaper than Netflix
December 8, 2006 · 1 Comment
In between browsing the web, learning ruby and ruby on rails, I need to keep myself entertained. I borrowed a number of items from Alexander’s huge DVD collection. I wrote down the list so that I would not forget: http://www.beenote.com/user/odie/tag/show/101
Categories: personal
Generate a model then a scaffold
December 6, 2006 · Leave a Comment
To start a rails project, I would suggest generating a model, then generating a scaffold.
% ruby script/generate model
– creates a migration file; edit the migration file to create the db table for your model
– % rake migrate
—- to create the db table using the migration file
% ruby script/generate scaffold
– creates the layout and the scaffold stylesheet
Categories: rubyonrails