Rails 3 STI
I was doing an ETL for a client, and I get into the issue of defining a way in the DB to define “tasks”, the main issue here is that many tasks have similar fields, so its useless to get them on different tables, a good friend told me about Single Table Inheritance , it was very useful and proved to work.
I decide to do an example of this, in Rails3 for sharing, the idea is basic, you have different tasks, right now it only have a mysql task, and a ftp task, in a very simple scaffolded app.
The interesting things get in the model, and the controller, you can see how the STI magic happens, I leave a lot of comments and links on the code, to better understand this.
I will update it to get more useful information on the github example, you can download it from here:
https://github.com/warstories/TheTasker
.
02.18.10Flex: Dynamic Background Image on Canvas (redraw version)
Today I tried to load an image form an url and apply it to a background, well appears like setStyle don’t have the ability to load an image from URL.
So I had to look another alternative, I load the image using an Loader, but I couldn’t found a way to apply it to the background style, I did a workaround, I draw it on the graphics object, I guess it is helpful because the image is titled, but I will try more options I didn’t quite like 100% this solution.
IMPORTANT : dont’ forget the security restrictions of doing this, remember that flash can’t load images from another domain, and www.zerokernel.com is different to zerokenel.com, see Adobe for more information ( Player 9 restrictions from Adobe – PDF )
Anyway, here is the demo:
http://zerokernel.com/demos/flex/backgroundChanger/
And the code:
http://zerokernel.com/demos/flex/backgroundChanger/BackgroundChanger.zip
| Posted in RoR, development | No Comments »