over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
The footer on this site will always be at the bottom of the browser window, unless the content is longer than the window height. In which case it will just...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
Routes.rb is a really powerful and one the most impressive features of the Rails framework once you work out how to use it.
Flat pages
Rather than using...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
To format dates in Ruby you can use the strftime directive that makes up part of the Ruby base library.
For example I used...
to output March 2006...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
To assign a css class or id to a link_to method you do the following:
&lt;%= link_to "Link name", { :controller =&gt; 'controller_name', :action =&gt;...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
Creating an RSS feed for your website in Ruby on Rails is very simple.
To set it up on this site I added the following lines to my articles controllerdef...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
To paginate the results of a query you need to use conditions. Which can easily be combined into the default pagination built into Rails.
So you can do...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
Bluehost provide a cron job set up interface in the control panel that makes it easy to set up cron jobs. The command I use is:
mysqldump -u DBUSERNAME...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
I got the error wrong argument type String (expected Module) because I was trying to create a select drop down for a field called 'Type'. However, 'Type...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
Using the built in TextHelper cycle method makes alternate row classes so easy in Ruby on Rails.
If your table rows are being ouput via a loop then you...

over 12 years ago
by Paul Sturgess
on
paulsturgess.co.uk articles.
Not a reserved word or magic fieldname this time. But apparantly "response" is something special in Rails, "request" is too. So when I attempted to use...