Building Rails Apps for Rich Client - Using the bulk_api from Flex.
In this screencast we are going to show how to build a Rails app in a couple of minutes that is optimized for Rich Client. The application is a todo application build in Flex connecting using the bulk_api to the Rails server using my new bulk data source Flex framework.
Enjoy!
Daniel
RailsConf 2011 - Day 1
Tutorial 1 : html5tutorial
I started RailsConf with the "Building Web Apps with HTML5: Beyond the Buzzword" by Mike Subelsky (@subelsky).He prepared twelve html5 exercises that walked the about 250 attendees through various features of html5 over a 2.5 hour session. It's fun to have time to work on these features. The high point was having about 200 computers using Websockets to send data back and forth with his server. He created a small ruby program that used EventMachine::WebSocket and it was holding up quite well all these connections.
You can download his tutorial and all files from https://github.com/subelsky/html5tutorial. Look at the tutorial.html file for instructions.
Here are a few highlights of his talk:
1 - Feature Detection
By using the Modernizr library, we used modernizr-1.7.js, you can detect difference html5 of your browser.For example:
- Modernizr.canvas
- Modernizr.websockets
2 - Basic Canvas Drawing
You can get a 2d context and draw on the canvas via that context. You can use fillRect and other primitives like moveTo and lineTo to draw.
var canvas = document.getElementById("main");
var context = canvas.getContext("2d");
context.fillRect(0,0,20,20);
Here I just created a loop to generate 180 rectangles. Note they are clipped due to the width of the canvas.
3 - Canvas Image Manipulation
var img = new Image();
img.src = "http://www.flickr.com/photos/50183640@N05/5616041841/";
img.onload = function() {
context.drawImage(img,0,110);
};
4 - Basic Animation
In this exercise we first load a new image then trap the keystroke and call the up method. Note we use jquery:
var characters = new Image();
characters.src = "http://onrails.org/files/20110516_characters.gif";
characters.onload = function() {
$(window).keyup(move);
};
In the move the x+y coordinates are updated accordingly and is cleared and redrawn.context.clearRect(0,0,width,height); context.drawImage(characters,33,0,32,32,x,y,32,32);Use the left and right arrow keys
5 - Fun With Forms
In this exercise we look at few attributes of the input tag like the placeholder and autofocus attributes.<input id="username" placeholder="Your name" autofocus> <input id="fn" placeholder="First name">Use the slider below to scale the image:
|
|
We listen to the change event of the size input and call the draw() function. Note the last two of the drawImage below is the new width and height which will give us the scaling effect.
<input id="size" type="range" min="4" max="320" step="8" value="60">
function draw() {
context.clearRect(0,0,width,height);
context.drawImage(characters,33,0,32,32,0,0,sizeAmt,sizeAmt);
}
6 - Local Storage
If you are in Google Chrome press option-command-j to bring up the javascript console. The you can enter key-values pair associated with the page. It's like a client side cookie.
localStorage.setItem('shaz','bot')
localStorage.getItem('shaz')
localStorage.length // return 1
localStorage.clear()
7 - Canvas Cleanup
The canvas itself can be styled like any element. Here we set a black background:
canvas {
background-color: black;
}
input { display: block; }
8 - Web Sockets
That was the fun part of the presentation, mike created the a small ruby application and had over 200 clients connecting to it.Here is an extract of the ruby program:
class TutorialServer def run EventMachine.run do EventMachine::WebSocket.start(:host => @host, :port => @port) do |socket| socket.onmessage do |msg| @logger.info "received: #{msg}" broadcast(msg) end end EventMachine::add_periodic_timer(10) { broadcast(JSON.generate({ :type => "ping" })) } end end def broadcast(msg) @sockets.keys.each { |socket| socket.send(msg) } end end TutorialServer.new('0.0.0.0',8011).run
// create the socket var ws = new WebSocket("ws://exp.subelsky.com:8011"); // sent to position+name to server ws.send(JSON.stringify({ name: name, x: x, y: y, type: "move" }));
And much more..
Mike covered additionally these topics: Embedded Media, Geolocation, Web Workers, Offline AppWell that was a couple of hours well spent! Go check out his material on github.
Tutorial 2 : Building Bulletproof Views
Now I'm at a great presentation from John Athayde & Bruce Williams on how to make elegant html, css and javascript. The slides will be posted online.Here are some of the topics:
- The Art of Template Writing
- Nailing Navigation
- Maintainable Forms
- Don't Fear the Object
- Going Mobile
- packaging Assets
- Questions & Discussion
Enjoy!
Daniel Wanja
Moving (again) http://onrails.org from Heroku to EC2
If you read this then this blog is now running Typo 5.5 on Rails 2.3.9 on EC2.
I really love the ease of deployment to heroku and the fact that they manage the whole stack. However I receive regularly emails from Heroku stating that I get a specific number of “backlog too deep errors” indicating the app is receiving more requests than it is capable of responding to, or in other words that that my blog is outgrowing their developer instance. So I have the option to increment the number of requests my application can handle, which is easy thanks to the the heroku command line: heroku dynos +1 —app onrails. So I can increase the HTTP performance by cranking up the “dynos” to 2 which would be an additional $36 a month. I still think it’s a good deal for a managed environment.
However you also saw on my last blog entry that there are other issues with running Typo on Heroku and therefore I started playing with running Rails on EC2. And I like what I see and now that Amazon has an official and secured Amazon Linux AMI, I’ll be using that. Here are a few notes on how I did set it up.
I started with the new Basic 32-bit Amazon Linux AMI 1.0 (http://aws.amazon.com/amazon-linux-ami/). I take basically only a few clicks to get a server started. You can use the ec2 console (https://console.aws.amazon.com/ec2) to create and connect to the server, however you need to use ec2-user instead of root to connect due to the way the Amazon Linux AMI is setup.
Note Lee is right that if I continue to moving host I should create a Chef recipe for this.
Install dev tools
$ sudo yum install git
$ sudo yum install make gcc-c++ zlib-devel openssl-devel
$ sudo yum install ruby-devel ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
Install MySQL
$ sudo yum install mysql mysql-server
$ sudo /etc/init.d/mysqld restart
$ mysql_secure_installation
$ sudo yum install mysql-libs mysql-devel
Install ruby-mysql
$ sudo gem install mysql —no-ri —no-rdoc
Install rubygems
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.zip
$ tar xzvf rubygems-1.3.7.tgz
$ cd rubygems-1.3.7
$ sudo ruby setup.rb
$ cd ..
Install Rails (note I use 2.3.9 for Typo )
$ sudo gem install rails —no-ri —no-rdoc
$ sudo gem install rails —no-ri —no-rdoc -v=2.3.9
Install Apache (2.2.15)
$ sudo yum install httpd
Install Passenger
$ sudo gem install passenger —no-ri —no-rdoc
$ sudo yum install httpd-devel
$ passenger-install-apache2-module
Configure Passenger
nano /etc/httpd/conf/httpd.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/bin/rubySuppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public
<Directory /somewhere/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>Installing Typo (from source)
see http://wiki.github.com/fdv/typo/install-typo-from-sources
$ wget http://rubyforge.org/frs/download.php/71779/typo-5.5.zip
then unzip, that’s it. That’s your typo instance, now let’s configure it’s database.
Note I moved it to /var/www/typo/
Create config/database.yml i.e.
production
adapter: mysql
host: localhost
username: yourusername
password: secret
database: onrails_prod
Change the Rails version in config/environment.rb, replace 2.3.8 with 2.3.9
RAILS_GEM_VERSION = ‘2.3.8’ unless defined? RAILS_GEM_VERSION
setups gems required for Typo:
$ sudo rake gems:install
Creating/Copying database:
Note I migrated my blog so I need to copy the database to the new server.
$ scp -i .ssh/linux_ami.pem onrails_org.sql ec2-user@ec2-184-73-20-188.compute-1.amazonaws.com:onrails_org.sql
$ mysql -u yourusername -p
create database onrails_prod;
exit
$ mysql -u yourusername -p onrails_prod < onrails_org.sql
As I also update Typo to a new version I had to run a migration:
$ rake db:migrate RAILS_ENV=production
Note if you want a clean install you can just to a rake db:create and rake db:migrate.
Et voila! Well Heroku made it simpler but I always have fun playing with EC2.
Enjoy!
Daniel
Moving onrails.org to Typo 5.4.x, Rails 2.3.8 on Heroku
So why Heroku and why not leave my server on slicehost? I don't have any issue with the slice but I want to upgrade the version of Typo just to stay uptodate and while at it wanted to explore a little. So of course I found an article on Getting Typo 5.4 running on Heroku So I gave it a try. The interesting part is that onrails.org has been around since forever and I also had tomigrate the database. Onrails.org was running on a version of Typo 4. h2. setting the blog up locally First I've downloaded my older typo MySQL database and restored it locally. I've copied Typo from here or you can clone the Typo git repository.
$ git clone http://github.com/fdv/typo.git
I changed the database.yml to point to my database. Did a rake gems:install, followed by a rake d:migrate and had now a local install of my blog. h2. creating a heroku app The goal was to try to deploy the blog to heroku. So here you can create an empty
$ heroku create onrails
git@heroku.com:onrails.git
$ git init
$ git add .
$ git commit -m "Adding onrails.org using typo 5.4.4"
I then followed joels' article to "heroku"fy Typo. So I basically created afew empty folders and replaced FileUtils by FileUtils::NoWrite. Note sure if that last change would cripple Typo but things seems to work fine. Then I created a .gems files that is used by heroku instead of Bundler.
.gems
rails = 2.3.8
htmlentities
json
calendar_date_select
bluecloth ~> 2.0.5
coderay ~> 0.8
mislav-will_paginate ~> 2.3.11 —source gems.github.com
RedCloth ~> 4.2.2
panztel-actionwebservice = 2.3.5
addressable ~> 2.1.0
mini_magick ~> 1.2.5
Finally I deployed the app with an empty database:
$ git remote add heroku git@heroku.com:onrails.git
$ git push heroku master
$ heroku rake db:migrate # with empty db
That's it that gets you an install of Typo on Heroku. Note, keep reading for a few gotcha's I found in regards to Rails 2.3.8. h2. Rails 2.3.8 on heroku At the time of this writing Rails 2.3.8 wasn't the default on Heroku, but fortunaely they support a different stack with Rails 2.3.8. To switch I just had to do the following:
$ heroku stack:migrate bamboo-ree-1.8.7
h2. Migrating the local MySQL database to Heroku's Postgres database. It's a rather straight forward process…just do
$ heroku db:push
This converted the database and replaced the remote database with my local data on Heroku. It converts my MySQL database to a Postgress database without having to speify anything…But there was on gotcha. The Sidebar table id column turned out as "text" instead of an "integer". And this caused some of the admin functionality to fail, i.e. reconfiguring the sidebar. The other tables where converted correctly and I saw that the local Sidebar id column was slightly different than the other id columns. For some reasons the sidebar table id column type was a "signed int' and that translated to a text field when doing the db:push. So I just unchecked the signed flag ad the db:push went smoothly. h2. legacy permalinks Somehow the articles and category links are all prefixed with "/articles" on onrails.org. I don't know if that was due to some default setting in Typo 4 or due to the fact that I started with a way earlier version of Typo. In any case I preferred to use the new links formats that just drops the "/articles", but that would also mean breaking a lot of incoming links. So I just configured Typo to support the legacy permalinks via these addd routes
# Legacy permalink format support map.connect '/articles/:year/:month', :controller => 'articles', :action => 'index', :year => /\d{4}/, :month => /\d{1,2}/ map.connect '/articles/:year/:month/page/:page', :controller => 'articles', :action => 'index', :year => /\d{4}/, :month => /\d{1,2}/ map.connect '/articles/:year', :controller => 'articles', :action => 'index', :year => /\d{4}/ map.connect '/articles/:year/page/:page', :controller => 'articles, :action => 'index', :year => /\d{4}/ # Legacy permalink format support map.resources :categories, :except => [:show, :update, :destroy, :edit], :path_prefix => '/articles' map.resources :categories, :as => 'category', :only => [:show, :edit, :update, :destroy], :path_prefix => '/articles' map.connect '/articles/category/:id/page/:page', :controller => 'categories', :action => 'show' ActionView::TemplateError (undefined method `interpolate_without_deprecated_syntax' for #<i18n::backend::simple:0x2b8d1ef90700>) on line #5 of themes/scribbish/views/articles/_coment.html.erb: </i18n::backend::simple:0x2b8d1ef90700>
environment.rb
class I18n::Backend::Simple
def interpolate(locale, string, values = {})
interpolate_without_deprecated_syntax(locale, string, values)
end
end
h2. custom domain I'm sure there are a few more details I missed and hope my readers will point them out, but let's jump and turn the switch on. So you need to switch on custom domains on heroku as follows:
$heroku addons:add custom_domains
$ heroku domains:add www.onrails.org
Added www.onrails.orgas a custom domain name to onrails.heroku.com
$ heroku domains:add onrails.org
Added onrails.orgas a custom domain name to onrails.heroku.co
Then I went on to pointed my dns to Heroku. The move is complete but the dns change to point to heroku still may take some time. So if you see the Scribbish theme you are still on the old server and if you see the Elegant Grunge theme you are right here on Heroku. Enjoy, Daniel UPDATE 1: the dns updated www.onrails.org and onrails.org at different time. And all the images of the new sites where using urls of the old site and everything looked pristine. No mre…So a hidden issue is that Typo let's you upload files like images which are stored in the resources table and also copied to to the public/files folder. This is a convenient way to serve files and images for your blog entries. Well, that won't work very well while on heroku especially since we really made the file system read only. I need to read more on how to enable page caching on Heroku and see if it is compatible with Typo. If not… I will need to revert back to my previous host. For now I'll jst add the files via git…and that's not a solution.
RailsConf 2010 - Thank You!
Wow, RailsConf is over. It ended nicely with @garyvee giving a powerful and entertaining keynote covering many subjects but mostly his standard spiel on connecting with your customers or audience. I read his book, crush it, a while back and enjoyed it. Note since, I haven’t been the most active on my blog or website…but I’m working on changing this.
Now of course RailsConf was way more that this keynote. I must admit I really enjoyed Baltimore and having the convention center, the hotel and the port at a five minutes walking distance. It’s a great area, I understand that not the whole city is like that, but that doesn’t remove anything from the fact that I really appreciate the place right now.
The best thing at this conference is the energy that transpires and I really feel energized and want to start some new Rails venture. It’s fun to see so many enthusiasts trying to learn, share, and push the community forward.
I must admit I usually enjoy smaller conferences, like the MoutainWest RubyConf or the forthcoming Moutain.rb, better as the tracks are more specialized and geekier. RailsConf tries to have several tracks for everybody but very few are very technical. Maybe the organizers should try to have an advanced track next time. That way the conference would stay appealing for the many people that have been doing Rails/Ruby for years and still be welcoming for beginners.
As usual there are always some talks that just suck. On the tutorial day I attended in the afternoon Rails 3 Deep Dive and it wasn’t about Rails 3 nor a deep dive. Another talk that didn’t turn out the way it should have been was Scaling Rails on AppEngine with JRuby and Duby where the speakers where knowledgeable but where note prepared enough and where counting on the wifi to work…The wifi never works at conference. This said the wifi was usually working pretty well at RailsConf this time.
I don’t wanna focus too much on the talks that didn’t work out as most of the talks where great and also not all my talks in the past always worked out they way they could have ;-)
One of the tutorial I really liked was Acceptance Testing With Cucumber. David Chelimsky rocked and just knows his stuff and Aslak hanged in there pretty well. They had an application prepared with multiple branches that let the audience follow right along. That was great. They didn’t have time to access a few of the advanced Cucumber subjects…next time make that a full day tutorial.
The first talk I attended on tuesday was Building an API with Rails which was a panel discussion with guys from Twitter, 37Signals, Github, the NYT and others. I really enjoyed that there was several distinct views on several aspects like on APIs like versioning, security, performance which relates exactly with some customer work I’m currently doing.
Then I went to the Metrics Magic by Aaron Bedra from Relevance which cover tools like RCov,Flog, Flay, Roodi, Reek and how to integrate them with your continuous integration build. For example why don’t you make your build fail when it reaches a certain threshold of uncovered code (let’s say 20%)…I like that idea. We do generate these stats in our ci builds but don’t fail the builds…yet.
Another great panel on tuesday was The State of Rails e-Commerce. I’m interested in ecommerce since the first of Rails project I worked on end of 2005.
Then I went to see Ilya Grigorik talk on “No callbacks, no threads: async & cooperative web servers with Ruby 1.9”…I just wish all the task where that awesome…Ilya tries to push the current stack of Ruby technologies to the next step to try to get the same benefits than what node.js provides…and he showed us how. Wow.
I’m not gonna list all the talks I attended here, but will provide a few more comments. There where two business oriented talks I enjoyed, the Million Dollar Mongo by Obie Fernandez and Durran Jordan from Hashrocket and the Agile the Pivotal Way talk by Ian MCFarland. Ian’s presented how his teams operates and I now see why Pivotal is on such a growth path. There are many cool aspects they are enforcing, one key I believe is to have really agile team members than can switch in an out of each team while still providing continuity to the customer by having one anchor member. Another essential aspect is the culture and how they propagate it buy doing peer programing to the extreme. Obie’s talk was an interesting retrospective on a very large project (10’0000 hours) they undertook. What surprised me is that he was pretty negative on his client and also went after some members of the Rails community…Well, maybe Hashrocket should stick to smaller projects ;-)
What else was cool? Rich Kilmer gave a nice talk about Authentication in a RESTful World. Again, that’s totally relevant to a customer project of mine. One of the best talks out there was Rocket Fueled Cucumbers by Joseph Wilk, but I saw only the last quarter as I selected another talk that I decided to leave…too late.
Matthew Deiters also gave a presentation I really enjoyed about “Recommendations in Rails”…something I may have to build in one of my apps very soon. I’m less exited about the fact that he recommends a java tool (Neo4j) to manage your graph of relations…but I trust him that it’s the best of the solutions out there for now.
Besides the talks Bluebox threw a party at a local bar, besides the fact that Fernand managed to get us lost on they way and I wasn’t sure we would survive the neighborhood we ended up in…the party was great and we met one of the Bluebox software developers and her mam and had a great time. At least I think so based on the trouble I had to wake up the next day.
I had fun with the keynotes. Derek Sivers gave a talk which I enjoyed even though it was not related to Rails but it was very entertaining. I really liked Yehuda Katz talk and he his certainly the driving factor behind Rails 3 but he gave a lot of credits to specific members of the community which took on many issues that most thought where impossible to address or change and fixed them.
The Ruby Heroe Awards Ceremony is always fun to watch, and Gregg puts lots of effort into making them happen. Next time just let the winners make a thank speech…that would stress them a little.
Overall there wasn’t enough coverage of Rails 3, I guess that’s gonna for next year when everyone migrated all there projects to it.
So reflecting on these 4 past days…it was a great conference. A big thanks to the organizers and all the presenters
Now time to kick off a new Rails 3 project.
Enjoy!
Daniel
Making CRUD less "Cruddy", one step at a time
One of the great “new” features of Rails (as of 2.3) is accepts_nested_attributes_for, allowing you to build cross-model CRUD forms without “cruddying” your controller. There are some great examples out there about how to do this, but I’d like to walk thorough a particular use case — managing the “join” records in a has_many :through relationship.
Consider the following database schema:
class Villain < ActiveRecord::Base
has_many :gifts
has_many :super_powers, :through => :gifts
end
class Gift < ActiveRecord::Base
belongs_to :villain
belongs_to :super_power
validates_uniqueness_of :super_power, :scope => :villain_id
end
class SuperPower < ActiveRecord::Base
has_many :gifts
has_many :villains, :through => :gifts
endIn our dataset, there are a relatively small number of super powers which we wish to present as a list of checkboxes on the villain management form. Checking/unchecking the boxes will manage the gift records for that villain, effectively managing the list of super powers available to the baddy.
To get started, we need to add accepts_nested_attributes_for :gifts to the Villain class — piece of cake. To complete the implementation, we need to change the params hash that our form generates. Let’s review the cases that we need to support and the associated params hash format needed to implement the correct functionality.
The first case is a super power record that is not currently associated with the villain. Here, the UI should display an unchecked checkbox. If we check it and submit the form, a gift record should be created linking the villain with the super power, making this bad guy that much badder. Here is an example of the params hash we should be sending to accomplish this:
{
'villain' => {
'name' => 'Lex Luthor',
...
'gifts_attributes' => {
1 => { 'super_power_id' => 5 },
2 => { 'super_power_id' => 7 },
...
}
}
}The alternate case is a super power this villain already possesses. In this instance, the UI should display a checked checkbox, and if we uncheck it, the existing gift record should be deleted, diminishing the villain’s capacity for evil. And our params hash needs to look like:
{
'villain' => {
'name' => 'Two-Face',
...
'gifts_attributes' => {
1 => { 'id' => 101, '_delete' => true },
...
}
}
}Note that the keys for the gifts_attributes hash are arbitrary; we can use any scheme to generate unique keys for the hash.
So how can we craft a form that sends the params hash that Rails wants to see? Here’s my implementation:
<%- SuperPower.all.each_with_index do |super_power, index| -%>
<label>
<%- if gift = @villain.gifts.find_by_super_power_id(super_power.id) -%>
<%= hidden_field_tag "villain[gifts_attributes][#{ index }][id]", gift.id %>
<%= check_box_tag "villain[gifts_attributes][#{ index }][_delete]", false, true %>
<%= hidden_field_tag "villain[gifts_attributes][#{ index }][_delete]", true %>
<%- else -%>
<%= check_box_tag "villain[gifts_attributes][#{ index }][super_power_id]", super_power.id %>
<%- end -%>
<%= super_power.name %>
</label><br />
<%- end -%>If the gift is detected, the villain has the super power, and we handle our second case from above, using the checkbox / hidden field hack Rails employs in the check_box helper method to make sure a value is sent whether or not the checkbox is checked. The else block handles the other case, setting up our params hash to create the gift if the checkbox is checked.
This works, but we probably don’t want to copy and paste that code everywhere we use this pattern. How can we reuse this in a DRY fashion? Here’s a helper method that encapsulates the logic:
def has_join_relationship(model, join_collection_name, related_item, collection_index, options={})
returning "" do |output|
relationship_name = options[:relationship_name] || related_item.class.table_name.singularize + "_id"
tag_prefix = "#{ model.class.class_name.underscore }[#{ join_collection_name }_attributes][#{ collection_index }]"
if join_item = model.send(join_collection_name).find(:first, :conditions => { relationship_name => related_item.id })
output << hidden_field_tag("#{ tag_prefix }[id]", related_item.id)
output << check_box_tag("#{ tag_prefix }[_delete]", false, true)
output << hidden_field_tag("#{ tag_prefix }[_delete]", true)
else
output << check_box_tag("#{ tag_prefix }[#{ relationship_name }]", related_item.id, false)
end
end
endDrop that in a helper, and then your form code becomes:
<%- SuperPower.all.each_with_index do |super_power, index| -%>
<label>
<%= has_join_relationship(@villain, :gifts, super_power, index) %>
<%= super_power.name %>
</label><br />
<%- end -%>Much nicer … although I’m not sold on the name has_join_relationship. Any suggestions?
Cucumber, meet Routes
I’ve been loving Rails BDD with Cucumber for the past year or so — it helps me focus on the next required step to build a feature in my application, and better focus equals better development velocity. However, one thing I found tedious in starting with Cucumber was defining route matchers in paths.rb.
The stock path_to method is implemented as a case statement, allowing you to add a case for each path you want to recognize. This works, but leaves you feeling a bit un-DRY since you’re basically duplicating information in your routes.rb file.
Here’s a quick hack to paths.rb that lets you leverage your existing routes:
change
else
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
endto
else
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
endIn your Cucumber steps, you can now use any named route that does not require a parameter. For example, users_path would become “the users page”, and new_product_path would become “the new product page”. As you add new resources, at least the index and new options should work out of the box — no further edits to paths.rb required!
UPDATE:
w00t!
This is now baked into cucumber-rails!
MWRC 2010 - Day 1 Live Video
The conference is about to start in 30 minutes, the room starts to buzz. The confreaks guys have their camera and video recording equipment all setup. So you will be able to catch up the conference online soon. Somehow I really like single track conferences and the sessions seem really great and will be fast passed, 30 to 45 minutes. Check out the schedule. So I will sit back and enjoy the show.
Follow it live on Justin TV!!
Watch live video from Mountain West Ruby Conference on Justin.tv
Salt Lake City is definitively a beautiful city, surrounded by it’s mountains…
Rails 3: Rack Middleware
I’m watching the Rails Online Conference, February 2010 Exploring Rails 3 and really like how they setup the rack middleware.
…From the slides.
Rack Middleware
http://github.com/rack/rack/tree/master/lib/rack
Content Modifying
Rack::Chunked Rack::ContentLength Rack::ConditionalGet Rack::ContentType Rack::Deflater Rack::ETag Rack::Head Rack::MethodOverride Rack::Runtime Rack::Sendfile Rack::ShowStatus
Behavioral
Rack::CommonLogger Rack::Lint Rack::Lock Rack::Reloader
Routing
Rack::Cascade Rack::Recursive Rack::Static Rack::URLMap
Rack::Contrib
http://github.com/rack/rack-contrib
Rack::AcceptFormat Rack::Access Rack::Backstage Rack::Callbacks Rack::Config Rack::Cookies Rack::CSSHTTPRequest Rack::Deflect Rack::Evil Rack::HostMeta Rack::JSONP Rack::LighttpdScriptNameFix Rack::Locale Rack::MailExceptions Rack::NestedParams Rack::NotFound Rack::ProcTitle Rack::Profiler Rack::ResponseCache Rack::ResponseHeaders Rack::RelativeRedirect Rack::Signals Rack::SimpleEndpoint Rack::TimeZone
Coderack.org
Check also out http://coderack.org …99 pieces of Rack Middleware
RailsGuide: Rails On Rack
Time.onrails.org is closing!
I just send an email to thousands of users to notify them that time.onrails.org is closing down. I don’t think many of these users are active but just in case I wanted everyone to be able to get their data out of the system if so they wished.
I will turn down the service on March 17th at 9pm.
Now why in the hell would I close this service. In brief I created it for myself on the plane to RubyConf 2005, thought it was cool and opened it to the public in April 2006. I haven’t updated the code much since many years and just don’t have the time to add new features, and trust me Rails code from 2005 looks slightly different than nowadays Rails code.
For posterity here is the “official” announcement blog entry of the creation of the service:
April 13, 2006 – LAUNCH time.onrails.org, time tracking made simple!
And here are few more articles related to time.onrails.org.
Here is part of the email I send to the users:
Time.onrails.org is closing down March 17th 2010 at 9pm Mountain time.
You can export your time entry for each project by clicking on the export buttons at the bottom of each project page or you can export your full account by just login and then go to this url:
http://time.onrails.org/export/xml/user
This will export each of the projects will all sections including the notes.
Please start transitioning to a new service now.
As a replacement service I would suggest harvest (http://www.getharvest.com/) which offers a free plan which allows for 2 projects, 4 clients, unlimited invoicing for 1 user absolutely FREE.
Thank you to all the users over the years I hope you enjoyed this free service. Time.onrails.org enjoyed thousands of users and I received many nice complimenting emails for the service over the years. The main reason that I close this service is that I am starting to use harvestapp for my own time tracking. I wrote time.onrails.org back in 2005 just for fun and thought it could be useful to others. It fulfilled my needs of keeping track of time for the various customer projects I worked on over the last few years.
Since we moved to slicehost it was very stable and I just have good things to say about slicehost, they are just great. Recently one of the slice time.onrails.org was running on had issues and got moved twice over two days. Again slicehost was on top of that situation and I just sat back and they did all the work. But this also reminded me that I cannot just keep the service running without giving it the time and effort it deserves and just now I don’t have that time as I am working on other projects, such as http://appsden.com.
So I went on the search for a replacement service and looked at many out there. And Harvest just added the timestamp feature, which is exactly how I track time, their app is more fleshed out than time.onrails.org, so I decided to move over to use their services.
The great news is while I tweeted about my move to Harvest, Doug, which I knew from his time in Denver mentioned that he now works for Harvest. So he put me in contact with the cofounder and I asked him if they could get some deal for my current users, and they where very responsive and create a special promo code. Thanks for that and I hope you try and enjoy their services. Just for disclaimer I didn’t ask for any monetization or anything for referring you to Harvest, the idea was just to have an alternate offering in case you needed one. But they offered me a free Solo plan, so hey, at least I got that out of this whole ordeal.
Please don’t hesitate to contact me for any question at daniel@onrails.org.
Thank you again for having tried out or being a user of time.onrails.org over all these years.
Kind regards,
Daniel Wanja


