Luncherate Us

ActiveRecord with NOT NULL columns

by Mars, at 2007-07-27 22:45, in Ruby

Using ActiveRecord with an unchangeable legacy database schema poses some interesting challenges. Most of the work is a new style (for me) of composing adapters to make non-Rails stuff work within Rails' conventions.

ActiveRecord uses the database's native NULL to indicate an unset attribute [Ruby's nil]. This becomes a problem when the column definition enforces NOT NULL on columns that you may or may not be setting values.

Continued... | 0 comments

TextMate's hidden "Find in Selection"

by Mars, at 2007-07-25 16:51, in meta-talk

[16:30] srogers:
So what's up with TextMate and replace string in selection?
i.e. why is it not there in the find dialog?

Continued... | 0 comments

Using Your Fixture Data in Development

by Steven, at 2007-07-25 01:11, in Ruby

So you've spent hours putting together some sensible data for your tests in a bunch of tediously crafted YAML files, and you're staring at a blank development database. If only there were an easy way to slip that data from the test database back into development . . .

Continued... | 0 comments

Diagrams to Migrations using OmniGraffle

by Steven, at 2007-07-01 00:19, in Ruby

Once you go through the pain of setting up SQL Fairy (CPAN, yikes!), you can be designing your database visually with OmniGraffle in collaboration with other non-Railsy folks, and then generate your Ruby migration and stick it directly into your Rails project.

Continued... | 0 comments

More Irb Tips

by Jim, at 2006-10-20 14:23, in Ruby

I was talking to someone (can't remember who) at Rubyconf and they brought up #local_variable. This method shows you the names of all the local variables in scope.

Funny, I don't remember this function, and if I did know it, I had forgotten about it. So, I fired up irb and type it in to see what I get back:

local_variables   #=> ["_"]
x = 5             #=> 5
local_variables   #=> ["_", "x"]

Hmmm, this is interesting. I know there is a variable in irb that contains the value of the last expression, but it is not easy to remember. But, it looks like _ will do the same thing.

I'm always doing math expressions where I need the value of the previous expression. So now, instead of up-arrow and add to the equation, I can use _.

5/7.0    #=> 0.714285714285714
2*_      #=> 1.42857142857143

Of course, you can you this for any irb expression, and best of all, it is a variable name I can actually remember. :)

0 comments

Quieting irb's Return Value

by Mars, at 2006-10-06 11:38, in Ruby

It's easy to be overwhelmed by irb's automatic printing of return values, especially when dealing with collections of ActiveRecords in Rails' script/console.

Continued... | 3 comments

Autovivification with Hashes

by Jim, at 2006-10-05 10:47, in Ruby

For you Perl folk, you may be familiar with the term autovivification. In essence, that is where an empty data structure gets automatically created if it is referenced, but does not exist.

For example, consider a hash. Let's say we want a two dimensional hash such that we can write:

1
2
    points = Hash.new
    points[1][2] = 5

The problem here is that points[1] must return a hash, and this hash is in turn accessed with the key '2'. It would be the same thing if we wrote:

1
2
3
    points = Hash.new
    tmp = points[1]
    tmp[2] = 5

Continued... | 6 comments

RubyConf 2006

by Jim, at 2006-10-04 10:02, in meetings

Well, RubyConf 2006 is nearly upon us and it looks like the state of Texas is going to be well represented by six Austinites.

Those attending are:

  • Jim F.
  • Hal F.
  • Matt
  • Wayne W.
  • David B.
  • Robert R.

Wayne must have made some kind of deal with a Leprechaun, because he was able to purchase a ticket just this week from zdennis. I bought mine ten minutes before the announcement that registration was open, and consider myself lucky since registration was only open for two hours.

2 comments

Welcome

by Jim, at 2006-10-04 09:42, in meta-talk

Just wanted to welcome everyone to our Ruby website, and give it a little test drive.

Thanks to Mars for putting this together, with some help from Wayne, and thanks to Wayne for providing the hosting.

0 comments

The Workings

by Mars, at 2006-10-01 20:28, in meta-talk

Our server set-up is as follows:

austinruby.com =

apache (port 80) <-> pound (load balancer) <-> mongrels (Rails servers)

We're starting out with three mongrels in the pound. Time will tell if more are required.

The original plan to serve static files from a separate virtual host has been nixed by my impatience.

See: The Workings r2 for updates since this article.

0 comments

activate

by Mars, at 2006-10-01 15:30, in meta-talk

We're finally on-line! I love progress.

Continued... | 3 comments

View archives for July 2007.

Austin.rb