[ANN] Nitro/Og 0.31.0

George M. wrote:

Let me present another more elegant example of Nitro:

require ‘nitro_and_og’

class Content
attr_accessor :title, :body, String
attr_accessor :hits, Fixnum
[snip]
class Demo
[snip]

Og.start
Nitro.start Demo

That’s a cute example, but it leaves me with one big question:
how the hell does Og know that Content maps to the database and
that Demo does not?

Daniel

Nathaniel B. wrote:

attempt to locate the model in specific directories which are based on the
load path. I am under the impression nothing like this exists in Nitro?

It’s a mixed blessing. If you know that all of your applications are
going to follow a certain file layout then it helps to just have that
handled automagically. But the code to do that is trivial, so rather
than have to accept the layout and code bundling presented by the
framework, you can pick your own. You still get auto-requiring while
not having to adopt a forced layout or wade through a dozen files and
directories you may not have any use for. YAGNI, and so on.

But there are benefits when developers are following the same
conventions. For example, people can reasonably expect that any random
Rails app will have certain files in certain locations. You can use
engines and plugins and helper tools (such as AutoTest, which is quite
slick) written by other people, and they Just Work.


James B.

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

Daniel DeLorme ha scritto:

That’s a cute example, but it leaves me with one big question:
how the hell does Og know that Content maps to the database and
that Demo does not?

because Demo does not use model objects’ methods, such as the enhanced
attr_* or belongs_to.
You have the chance to fine tune this, anyway, in case that Og is not
smart enough to find the classes correctly (it usually works fine,
anyway)

On 30 Jul 2006, at 09:50, gabriele renzi wrote:

that, and after making a change to my source, went directly over
to my browser and hit refresh… And the page changed! How does
that work then?! That’s not normal Ruby behaviour, that’s not.
But I like it a lot :slight_smile:

That’s somthing you can find in facets, the method Kernel#autoreload
http://facets.rubyforge.org/api/core/classes/Kernel.html#M000450

! :slight_smile: That’s very cool. cough I’ve not actually used facets at all.

Okay, I’ve had a look, and it looks very full of interesting stuff.
Is there some kind of map / table of contents for the collection?
Some kind of rough break down in to areas of functionality?

That’s a cute example, but it leaves me with one big question:
how the hell does Og know that Content maps to the database and
that Demo does not?

Og manages classes that define serializable attributes. A serializable
attribute is an attribute with a class annotation. This works great
for 95% of the cases. For the rest, you can use Og features like the
following to customize the behaviour, including:

class XXX
is Unmanageabke
end

or

class XXX
attr_accessor :test, String, :serializable => false
end

etc, etc.

regards,
George.