01:00
<esad>
what's the deal - why is there no "after" filter in sinatra?!
01:01
<esad>
how do I clean activerecord garbage after every request then?
03:18
<syd_>
well, we will put that one in the hall of fame
03:46
<andy_h>
syd_: thanks
04:41
<karmi>
Guys, when do you run Sinatra as Rails metal, how do you handle autoload conflicts, those "Expected /something/lib/page.rb to define Something::Lib::Page (LoadError)" ?
07:45
millionmonkey joined
17:02
irclogger-com joined
17:02
<Lenary>
should i ask for help here or in ruby-lang or somewhere
17:03
<locks>
ask away, someone will redirect you if that's the case :P
17:03
<Lenary>
that is what's currently happeneing
17:03
<Lenary>
it kinda works
17:03
<Lenary>
it looks appaling
17:04
<Lenary>
any ideas how to make it recursive
17:04
<Lenary>
in fact, more to the point
17:04
<Lenary>
can someone walk me through making it recursive
17:04
<Lenary>
i've not ever done recursive programming before
17:09
<locks>
can't see anything to change there :p
17:09
<Lenary>
what if i want more than 3 filetrees deep?
17:09
<cschneid>
Lenary: should it go to infinite depth, or be limited right tere
17:09
<Lenary>
oh, infinite depth
17:10
<Lenary>
it's a git repo browser
17:10
<Lenary>
this is the part that renders the tree
17:10
<Lenary>
in a good old <ul>!
17:11
<Lenary>
i'm thinking that it probably needs to be put into a helper method
17:11
<cschneid>
ok. so you can use partials for that kind of thing: if tree.responds_to?(:trees) partial :tree, :local => tree or something.
17:11
<cschneid>
Lenary: right, the other option is to unroll it into a loop, which is obnoxious, but would avoid the need for partials
17:11
<Lenary>
sinatra does partials?
17:11
<cschneid>
Lenary: not by itself, but it's a trivial helper
17:12
<Lenary>
heh, i knew it would be you that wrote the script that made sure it could
17:12
<cschneid>
nah, I stole it from a guy on the mailing list (the complex one at least)
17:12
<Lenary>
if you see the rest of my app, you'd realise i'm fine w/o partials, just methods that return lots of html
17:13
<* Lenary>
is just about to release this app to the community!
17:13
<cschneid>
Lenary: the logic should basically be: any time I want to render a tree or subtree, call a method that does it.
17:13
<cschneid>
so the top level could be @trees.each {|tree| render_tree(tree) }
17:13
<cschneid>
and render_tree has the same kind of logic for subtrees (calling itself)
17:13
<cschneid>
until it runs into a node w/o any subtrees, and doesn't recurse any further
17:14
<cschneid>
that method can be written like that, or with partials standing in for methods
17:14
<Lenary>
is .try(:symbol) in common ruby?
17:14
<cschneid>
for what
17:14
<cschneid>
see if that method exists?
17:14
<cschneid>
responds_to?(:method) does that
17:15
<Lenary>
nah, to find out if the method exists and then call that method on it
17:15
<cschneid>
ahh, 2 steps in plain ruby
17:15
<Lenary>
i think it's ruby 1.9
17:16
<Lenary>
ok, first off going to try writing a set of methods
17:17
<Lenary>
gonna be much easier with partials
17:18
<Lenary>
do recursive partials work?
17:18
<cschneid>
a partial can call a partial just fine
17:18
<Lenary>
can it call itself?
17:18
<* Lenary>
presumes so
17:18
<cschneid>
so have a tree partial that knows how to render the current level, and calls itself for subtrees
17:18
<Lenary>
any naming convention?
17:18
<Lenary>
like _partial.erb or something?
17:19
<cschneid>
I like the _ at the beginning, like rails
17:19
<Lenary>
but i have to specify that in the partial() call
17:19
<cschneid>
probably, yeah
17:19
<Lenary>
as in i would have to say partial(_tree.erb)
17:20
<cschneid>
remember, you're writing the partial() method (or stealing it), make it behave however you want
17:20
<cschneid>
partial :'_tree'
17:20
<cschneid>
probably
17:20
<Lenary>
erb(:"_#{template}", options) < what i changed!
17:21
<Lenary>
with a to_s call on the template
17:21
<cschneid>
#{} does a .to_s automatically afaik
17:21
<Lenary>
meh, can't be too sure
17:25
<Lenary>
how do i pass local variables to the partial?
17:26
<cschneid>
:local =>
17:26
<cschneid>
and the partial method needs to pass that through
17:26
<Lenary>
yeah, it will
17:29
<Lenary>
how does that look to you guys?
17:30
<cschneid>
<%= partial(partial, :local => {:tree => next_tree}) %>
17:30
<cschneid>
doesn't that need to be in quotes?
17:30
<cschneid>
partial("partial"...)
17:31
<cschneid>
unless there's a local var I'm missing
17:31
<Lenary>
hrm, it was wrong
17:31
<Lenary>
now it's a symbol
17:32
<cschneid>
also, go one more layer down, you're duplicating code that renders the tree in two places
17:32
<cschneid>
recursive.erb can just ignore how to render a tree entirely, and hand off to the partial
17:32
<Lenary>
good point
17:32
<Lenary>
`NoMethodError - undefined method `extract_options!' for '
17:33
<cschneid>
hmm, I vaguely remember that, it tries to call a method in activesupport I think... hmm. Gist the partial code
17:35
<Lenary>
there is the partial code
17:36
<Lenary>
also, just went one recursiveness further down
17:36
<cschneid>
yeah, it comes out of active support
17:36
<Lenary>
hrm, don't want to include all that brute
17:36
<Lenary>
should i just be able to copy the code?
17:36
<cschneid>
yeah, or just change how it works
17:37
<cschneid>
change the method signature to partial(template, args={})
17:37
<cschneid>
and be sure to pass in a hash of options
17:37
<cschneid>
which you're doing with how you're calling it
17:37
<Lenary>
i just lolled when i saw the code for extract options
17:38
<cschneid>
anyway, just do that.
17:38
<* cschneid>
is off to make dinner, good luck
17:39
<Lenary>
i just put it in a class Array in my app file
17:45
<Lenary>
ok, having problems with the partial local variables now
17:47
<Lenary>
it might just be me with a typo
17:54
<drewolson>
hey all, is sinatra 0.9.1.1 is compatible with rack 1.0?
17:55
<Lenary>
don't think so
17:56
<Lenary>
ReinH was doing some compatability stuff the other day
17:56
<qrush>
Are there any decent guides for uploads with sinatra?
17:56
<qrush>
(and testing it)
17:57
<drewolson>
interestingly enough, it seems to rackup just fine if i vendor sinatra
17:57
<Lenary>
edge in github is compatable
17:58
<drewolson>
alright, cool
17:59
<Lenary>
qrush: not seen any, sorry
18:17
<Lenary>
cschneid: when/if you get back, i'd love a little more help. it seems it's still failing
18:23
<Lenary>
cschneid: nvm
18:23
<Lenary>
got it working
18:24
<Lenary>
i added a lot of do |.| ... end unless
18:24
<Lenary>
well, unless breakouts to the end of the each statements
18:25
<Lenary>
and i also went back and added in the first set of non-partialled recursion
18:25
<Lenary>
because it works better that way
18:25
<Lenary>
or at least it works that way
18:26
<Lenary>
here goes some jquery
18:26
<qrush>
ended up not being bad :)
18:26
<Lenary>
qrush: well done
18:32
<* Lenary>
manhugs cschneid
18:32
<Lenary>
works perfectly!
18:42
millionmonkey joined
18:43
<Edgar1>
i have been testing sinatra today, and i like it so much
18:45
<Lenary>
don't we all
18:45
<Edgar1>
i want to learn more of sinatra, i'm reading the sinatra book
18:46
<Edgar1>
it's huge, a lot of content
18:55
<syd_>
the book needs a lot of work though
18:55
<syd_>
readme will always be the best place for current info
18:56
<syd_>
not that (most) of the stuff in the book won't still be relevant
18:58
<Edgar1>
well to me is useful
18:58
<Edgar1>
the README is fine but i like more the book
19:04
<Edgar1>
for load a haml file, do i have to add require 'haml' to the code
19:04
<Edgar1>
or is just install it?
19:04
<cschneid>
Edgar1: no, it does it the first time you use the haml function
19:04
<cschneid>
it needs to be installed of course
19:06
<Lenary>
i'm about half an hour off a 1.0 release of this software
19:06
<Lenary>
but not tonight
19:06
<Lenary>
2am = time for bed
19:07
<Lenary>
night all!
19:32
<shinobi17>
is there a "preferred" ORM to use w/ Sinatra? Is ActiveRecord ok?
19:32
<shinobi17>
or does everyone use DataMapper?
19:40
<syd_>
no preferred
19:40
<syd_>
it's completely orm agnostic
19:42
<locks>
sinatra is classy like that, doesn't pick sides
20:09
papyromancer joined
20:20
jschoolcraft joined
20:50
<jfarmer>
What's the biggest Sinatra app?
20:50
<kristopher>
biggestsinatraapp.com
20:51
<jfarmer>
I built an FB app using Sinatra that has gotten about 2MM visits over the last week and a half.
20:51
<jfarmer>
I wondered how that stacked up.
20:52
<jfarmer>
I know lots of people use it for light-weight API stuff, which is almost always high volume, so probably not that well
20:55
<kristopher>
I think that sinatra becomes a pain when the app have to aggregate a lot of new features, but it's don't have anything to do how it scales and so on.. as you already have know
20:56
<kristopher>
btw, sorry for the joke :)
20:56
<kristopher>
a lot of wine is slowing my mind!
21:49
<logankoester>
where's your app jfarmer ?