Testimony: Update


It just occurred to me that I never mentioned how to log in to the testimonial demo application. If you would like to play with the admin interface, such as it is, you will have to login as the user demo using the password demo. Feel free to add, delete, approve, and unapprove testimonials but please leave at least one testimonial approved.

Oh, one last thing… the admin portions are still ugly and in most cases in their default scaffold state but an update is in the works and coming soon.

Thanks!

Testimony Part IV: Catching up….


In this installment, we’re going to catch up on a few changes that have been made since the last post. If you look at the demo site, you’ll see some differences in presentation. I’ve added space for a banner (yes, it’s ugly, but it’s meant as a placeholder) and that the default view is no longer an inline list of Testimonial records as found in the database. We’ll cover that a little later in this post.

First, let’s cover the layout changes. As we all know, when it comes time to render a view, Rails will look for a layout of the same name, unless otherwise directed. The layout that’s being used here is called testimonial.rhtml, lives in the views/layouts folder and looks something like the following:

Read more…

Free Rails book, e Cheat sheet and other news


Sitepoint is giving away the complete
Build Your Own Ruby on Rails Web Applications by Patrick Lenz — the man behind Freshmeat.net — for the next 60 days. You have to give them your email address in order to download it, but they do give you a $10 voucher towards purchase of a dead trees edition of the book.

I’ve posted about e - the text editor before, head on over to ErrTheBlog for a handy cheatsheet. Even better, grab their gem and get access to many cheat sheets right from your commandline. Way cool!

It’s been awhile since the last installment of the testimonial walkthrough but work continues. I hope to have the next one up sometime this week. Stay tuned for further updates….

Testimony Part III: Adding Users and tests


Applications are worthless without users. Really, what’s the point of writing a hot rails-based web app if no one uses it? So what kind of users does Testimony have? If you think about it, you’ll realize that we have two distinct types of users: the site owner (or administrator), and happy customers that leave testimonials. So in reality, we have a couple of different use cases to develop, one for the normal consumer, and one for the administrator.

Just so we have some useful language that we can use to talk about our users, let’s define some roles.

Read more…

Testimony Part II: Model evolution


[This is part II of the Testimony Rails Application Walkthrough ]

Note: The Testimony app is now live. This url will always for the latest installment in this series.

Before we go too much farther, we need to make a couple of adjustments to the default behaviour. The first revolves around time: ActiveRecord stores time in local time by default. In today’s world, applications should be storing time as UTC, especially on a server. To make Rails use UTC, set default_timezone = :utc as shown below.

The second tweak involves sessions. Out of the box, Rails tracks user sessions in the file store (i.e., on disk). I prefer to store mine in the database for ease of use, management, and better performance, and if this app needed to scale I’d want to look at using memcached. Luckily, ActiveRecord knows how to use a table for session data. First, change the session_store to be the database:

config.action_controller.session_store = :active_record_store
config.active_record.default_timezone = :utc

Read more…