dfitzgibbon's blog
I've made some improvements to the Toffee plugin lately, as well as some user guides for getting started.
Improvements:
Better handling of large record sets. Added toffee_list_helper plugin, so you can have a toffee-generated list anywhere in your application. Added filters, so you can add filters for the list screen very easily. Fieldsets in forms, you can now organise your form into separate fieldsets, simply by having something like...
@toffee_form_fieldsets = [ {:title => "Names", :form_columns => ["first_name","last_name"]}, {:title => "Other Information", :form_columns => ["date_of_birth","place_id"]} ]
...in your model definition.
I've also written some nice user guides:
Ok, so its a very minor update from the last version, Ian gave me a couple of suggestions which have been sorted. I've also made installation a bit easier, here's the steps involved now:
1. script/plugin install http://svn.open.bluefountain.com/toffee
2. Add 'map.from_plugin :toffee' to config/routes.rb before any routes you've defined, as well as the default route.
And thats it, now navigate to admin/<your_model> - and follow the instructions on screen. I've added some tutorial boxes on each screen with guidelines for customising the admin screens. Its quite basic at the moment, but it gets the point across.
dfitzgibbon on February 15, 2007 - 10:30pm. comment?
I have got my plugin working with Rails 1.2, and its now sitting on the open.bluefountain.com repository. Here's a quick guide to install it:
1. Ensure you are using Rails 1.2, otherwise it could go horribly wrong 
2. In the root of your Rails application, type the following command:
script/plugin install http://svn.open.bluefountain.com/toffee
3. Edit app/controllers/application.rb adding so it looks as follows:
class ApplicationController < ActionController::Base
include Toffee
...
end
4. Add the following line to config/routes.rb, before the default route and any other routes you've added:
It seems that now when I use the link_to helper in rails, if it doesn't have a recognized route, it gives a Rails barf, instead of just displaying the link regardless like before. So if I was prototyping a site and adding a load of links to sections that didn't exist yet, ie.
<%= link_to 'section that doesnt exist yet', :controller => "non_existent_controller", :action => "index" %>
It will barf with...
No route matches {:action=>"index", :controller=>"non_existent_controller"}Now this is all well and good if I make a typo, but if I genuinely want to link to something that doesn't exist, for whatever reason, then I think I should be able to do so. They are called helpers after all, not hinderers!
dfitzgibbon on February 9, 2007 - 12:14am. comment?
Just as I was about to release my first Rails Engine, Toffee, into the open source community. I discover that, as of Rails 1.2, engines are no longer considered to be, well, engines. They are now just plugins with bells on. It also doesn't really work anymore so I've got some fixing (botching) to do before I release my Eng.. erm.. plugin. Anyhoo, for anyone interested, Toffee is a plugin that will create controller-less admin screens for models in a rails app, simply by adding a new route directing any URL like 'admin/<model_name>' to an admin screen for that model, allowing listing, sorting, searching, editing and adding records.
dfitzgibbon on February 8, 2007 - 11:42pm. 1 comment
Someone's nicked my graphical date selector tool and made it into a Rails Engine...
dfitzgibbon on January 5, 2007 - 1:39pm. 3 comments
I've had an issue with a project I'm working on, where I am creating a nested hash of records to allow quick lookup by certain fields, the reason for this is as follows. Say for example I have 100,000 despatch lines, and 100,000 self bill lines, and I have a process which will loop through each despatch line, and find the corresponding self bill line. I could easily do this with a simple find:
SelfBillLine.find(:first, :conditions => ["manifest_number = ? and order_number = ? and part_number = ?", despatch.manifest_number, despatch.order_number, despatch.part_number])
But this means running 100,000 SQL queries, and experience tells me this will be sloooowww.
I could also just get a list of all the self bill lines, and then use Ruby's select method to find the one I want, but this will be quite demanding on Ruby. So my solution was as follows, create a nested hash:
I came across a superb testing application called Selenium. You can even use it in the form of a Firefox Add-on. Basically it allows you to record (as you would a macro) functional tests.
For example, you could open the add-on via Tools > Selenium IDE, click record, then navigate to your web application (or anyone elses for that matter), log in, and try submitting a form. Go back to the Selenium IDE, and you will see a list of the commands you just performed, and you can check for certain results. So if you submit a form and don't fill in the required fields, you can check that it returns some text saying "failed". It is capable of much much more, including testing Ajax results etc.
|
Comments