Posts Tagged: dev

How to win the lottery…

lottery ticket

lottery ticket


… easy, pick the winning numbers!

The trouble is there are 45 million combinations!

So, why not share your numbers with everyone else to ensure we all use different numbers.

If enough people do it, then we’ll ensure someone wins!

Note – this is not a syndicate. The winnings will not be shared. The idea is just to ensure that someone wins!

No details will be recorded – so we can’t hassle the winners.

You either tell us the numbers you’re going to use (anonymously) or we give you numbers that no one else has selected (i.e. like a lucky dip).

Ok, it’s just an idea at the moment… so, who is in?

Rails Engine to produce a photography portfolio/brochureware site.

I was asked to provide a flexible photography portfolio site – brochure type site.

Given Rails was on my “fad” list, I decided to have a go that way.

What I came up with was a ‘generic’ Rails Engine to do the work of pulling the galleries etc together. This was then used inside a specific Rails app which just had the photos/galleries/comments. The aim being that the site owner can arrange things as they want and then do a commit/push to heroku to update their site.

The Engine is open source, available on github here.

Its a bit dated now, using Rails 3.0.9 – although should be easy to update, as its quite simple :) – the Gemfile only has Rails, Capybara and sqlite3 – not sure why the last 2 are there – as no DB is used.

The controllers do the work of responding to various user requests – using the folder/image structure found in the host app to define the site structure.

In the model directory, there are several classes.  photo – is used to wrap each photo image, including a related thumbnail and caption. project – wraps a directory, tracking what images are in it. site_config – this handles parsing the overall site configuration, which is held in a YAML file in the host Rails app.

The lib directory defines the basic engine configuration – how it hooks into the host app.

Under test/dummy there is a minimal rails app using the engine – for testing.  Although I cant see a sample config file – perhaps it relied on the defaults :)

At the time, it seemed a good way to produce the site.  I’ve not had to use it again yet, and that will be the test of how ‘generic’ it is…