Caboose Sample rails application

Courtenay : April 2nd, 2007

Update: please see http://sample.caboo.se for the latest news and updates to the sample apps.

I’m sick of creating the same blank-state app over and over so here is a nice blank-state rails app. This is not a generator or something like Hobo, it’s just a zipped up empty app with some code, tests, and plugins.

Did I say tests? I meant specs >:)

From the readme:

Caboose Sample App

This is a sample application containing a bunch of useful plugins and code to help you get started quicker.
It is intended to be an example of “better practices”, but with the intention of ultimately being “best practice” through collaboration and iterative improvement.

The application implements:

  • a user model with a few extra fields (last login, timezones)
  • restful authentication.
  • full timezone support
  • basic views implemented with Yahoo! YUI CSS grids.
  • behavioral testing with rspec, including good example of mocking in controller specs.
  • exception notification

Some of the enhancements to the stock plugins are ripped from my private codebase, as yet unseen by the world :)

TODO:

  • Polymorphic Image model using attachment_fu
  • Sample controllers and models
  • More plugins
  • Good examples of ajax
  • Better list of requirements

Get it here:

Sample app 0.1

As always, hit up the comments with feature requests and bugs.

19 Responses to “Caboose Sample rails application”

  1. Seth Ladd Says:

    Thanks, this is great!

  2. PabloC Says:

    Sounds great! What gems does it require? I’m getting this error when I try to start.

    Booting Mongrel (use ‘script/server webrick’ to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment… Exiting /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method options’ for []:Array (NoMethodError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:ingemoriginalrequire’ from /usr/local/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:33:in require’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in new_constants_in’ from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’ from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 from /usr/local/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’ from script/server:3

  3. Danno Says:

    Y’know, I’m seeing a bunch of people put out these specialized Rails project templates these days.

    Could this sort of thing be packaged as a gem which could then create the base directory given a command?

    I wonder if there are a general set of web applications that people build and whether they could be classified so that a project template would be roughly ideal for a given one.

    Maybe that’s getting too specific?

  4. AaronT Says:

    Nice one…

    Howabout make it available via SVN as well?

  5. Jeff Dean Says:

    I love it! I’ve been going through the same process recently on all of my apps - add YUI file, piston import the same plugins etc…

    This is an actual time saver. Well done.

  6. Paul Barry Says:

    I realize I’m probably asking a stupid question here, but how is this supposed to be used? I just unzipped the file, opened a command prompt in that directory and ran “rake db:migrate”. There’s no database.yml in restfulauthrspec, but even once I create one, if I run “rake db:migrate” I get this:

    c:0:Warning: require_gem is obsolete. Use gem instead. (in C:/ruby/projects/restfulauthrspec) rake aborted! no such file to load – spec/rake/spectask C:/ruby/projects/restfulauthrspec/rakefile:10 (See full trace by running task with –trace)

  7. Danger Says:

    I second the svn request :-)

  8. Dimkin Says:

    @PabloC & Paul Barry You have to: gem install rspec gem install tzinfo

    Worked for me

  9. PabloC Says:

    Thanks Dimkin!

  10. Kyle Maxwell Says:

    Here’s a DSL-based approach to something similar: http://www.kylemaxwell.com/post/566177

    The question, to me is, how does this integrate well with piston/svn/plugin update mechanisms, and, conversely, how does a DSL-based approach deal well with a complex installation process (i.e. adding models, etc).

    Where is the middle ground?

  11. Raymond Says:

    Very nice.

  12. GGGGG Says:

    Thanks! I want subversion too! ;)

  13. GGGGG Says:

    Sessions view points to accountspath, but there’s no accountpath… Do you have any plans to add something like accounts system?

  14. court3nay Says:

    I’ll take patches for an account system

  15. Trek Glowacki Says:

    I had no idea so many other Rails devs liked/used Yahoo Grids. We’ve been using it in projects for a while and it’s really sped up our layout/view development.

    We have a small helper we use that turns a collection into grids nicely that we’d like to share.

    http://wonderfullyflawed.com/goodies/

  16. Trek Glowacki Says:

    apologies for another post: based on feedback, you can just install the yahoo grids helper with script/plugin install http://wonderfullyflawed.com/svn/grids_helper/

  17. Aaron B Says:

    AppFuse for Rails! Nice work.

  18. Mislav Says:

    Neat! Please throw it under SVN control

  19. court3nay Says:

    This article is out of date. Please see the latest here:

    http://blog.caboo.se/pages/sample-rails-application

Sorry, comments are closed for this article.