Internet Asshattery
Leonard Lin: Internet Asshattery, Armchair Scaling Experts Edition
Rails Scaffold, ActiveRecord, and table names 4
Looks like the Rails scaffolding doesn’t like it when your model uses a different table name from the default mapping it expects(like when accessing a legacy database model).
So if you have a model like so:
class Thing < ActiveRecord::Base
set_table_name "some_thing"
end
Then ActiveRecord will be expecting a table called “some_thing”, however the scaffolding generator is expecting the default, which is going to be “things”(or something like that since I can’t be bothered actually generating a model called Thing).
When running your generator you’re going to end up with an error like:
error Before updating scaffolding from new DB schema, try creating a table for your model (Thing)
Annoying as this is, you can work around it by temporarily creating the table required by the generator. Then go ahead and drop it after the generator works.
create table things ();
I’m not sure what longer term effects this causes, and if there is a better way then let me know.
Scaling Twitter
Blaine Buxton’s slides on scaling twitter.
Seaside and Rails
James Shell: Seaside, Rails, Helpers…
It’s not XML, YAML, An Array or list. It doesn’t get translated into any structure like that.
A Rails Debugger
Gyre: simple, fast, cross-platform, web-centric, open source, and written in Ruby.
Good idea, hope it works out.
Smalltalk failed because of Smalltalk?
Obie Fernandez blogs about the “What makes Ruby roll” session at JAOO.
One of the questions the panel was asked was “How can Ruby avoid the same fate as Smalltalk?”. My favourite answer has to be from Kevin Henney(I’m assuming the quote is accurate):
Someone will have rewritten it by then. Yes, will succeed where Smalltalk failed because it’s not bound up in the smalltalk environment (you can open up Ruby files in Notepad). Also, do not underestimate how important a ‘normal’ if statement is. The biggest problem with Smalltalk is Smalltalkers.
If I can paraphrase: “The problem with smalltalk is smalltalk and the people who use it”.
Makes me laugh, probably becuase it’s true, but you get arrogant people in all communities, Ruby will probably end up with a few since it’s so popular currently.
Blain Buxton follows up saying: “An image-less Smalltalk would have a nicer entry point…”.
I think this is very true. I seem to remember something called Smallscript that didn’t require an Image, and I’m sure there must be a few more kicking about.
In the end I guess it matters what the Ruby community wants to achieve. Ruby and RoR certainly has a massive mindshare at the moment but who really knows where it’s going to go. Is the goal to become some kind of enterprisey language that corporates feel comfortable deploying? And if so how would the Ruby community even make that happen, I don’t think any amount of endless evangilism about how good Ruby is will do any good, IMO it’s going to take some serious backing by a large technology company before it can start to make those inroads into the Enterprise world. And if it does, then it needs to play nice with Java, C#, and whatever else is being used , it can’t be an island.
If you keep reading Obie’s post there are a couple funny posts which are worth reading for the hell of it.
Ruby IDE
Looks like Tim Bray has wrapped up the Ruby Ape Diaries. In that latest post he points out a few things Ruby needs, one of which is an IDE.
I’m using the RDT eclipse plugin. It is pretty good, as good as I’ve found anyway. It does have syntax highlighting, content assist, an outline for Class navigation, and a Unit Test launcher which uses the same unit test runner as the JDT(java development tools). As far as I know it doesn’t have any refactoring support.
And, IIRC, it’s built on JRuby.
There is an introductory article to the tool at IBM developer works.
There is also a Rails plugin, Rad Rails, which I know absolutely nothing about.
Active Record Rules
Here is how much code it takes to get ActiveRecord working.
require 'active_record/base'
ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:host => "blah",
:username => "blah",
:password => "blah",
:database => "database"
)
class User < ActiveRecord::Base
end
puts User.find(:first).id
It’s very cool. I’m sure there’s probably plenty of stuff Hibernate can do that ActiveRecord cannot, but you can’t beat it for just getting stuff done, without arsing about with config files.
What's new in Rails 1.1
Scott Raymond lays it all out…
