Martian eyrie

January 21, 2007

Dynamic Graphics with Rails 1.2

Filed under: RubyOnRails

Dynamic Graphics with Rails 1.2 | Ruby on Rails for Newbies

The upcoming release of Rails 1.2 has some nice features for creating dynamic graphics in your application. Here we have a simple shopping cart icon (purchased and modified from the Iconfactory). I want to show the number of items in the cart. I could manually create a series of graphics with each number, but that seems inelegant. Anytime the icon needed tweaking, I would have to regenerate all the icons.

Rails 1.2 has the ability to send different types of content from the same action. Basically, I just want a graphical representation of the shopping cart. I’ll use the Cart#show action to render a graphic if it is accessed with a “png” extension. Otherwise, it will show the shopping cart items, total price, and checkout button in HTML.

Comments »

The URI to TrackBack this entry is: http://eyrie.blogsome.com/2007/01/21/dynamic-graphics-with-rails-12/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham