<     May 2009     >
Su Mo Tu We Th Fr Sa
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
00:02 xymbol joined
00:15 aorist joined
00:45 bct left
00:50 dqminh joined
01:00 esad joined
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?
01:02 xymbol_ joined
01:04 <esad> help!
01:32 vjr` joined
01:38 aorist joined
01:38 postmodern joined
01:49 hexreel_ joined
02:05 xymbol joined
02:17 mitkok joined
02:21 iv_s_ joined
02:59 nakajima joined
03:11 kotrin joined
03:11 benlovell joined
03:18 <syd_> well, we will put that one in the hall of fame
03:27 karmi joined
03:46 <andy_h> syd_: thanks
03:52 Jinzhu joined
03:58 hexreel joined
04:18 benlovell joined
04:28 nakajima joined
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)" ?
05:09 nakajima joined
05:13 mitkok joined
05:57 ekidd joined
06:07 nakajima joined
06:09 michas joined
06:13 mitkok joined
07:14 rubydiamond joined
07:42 sporkmonger joined
07:45 millionmonkey joined
07:53 Lenary joined
17:02 irclogger-com joined
17:02 Topic for
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> http://gist.github.com/109433
17:03 <Lenary> that is what's currently happeneing
17:03 <Lenary> it kinda works
17:03 <Lenary> BUT
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:08 <Lenary> anyone?
17:09 <locks> can't see anything to change there :p
17:09 <Lenary> lol
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 <cschneid> there
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 <Lenary> ok
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 <Lenary> yeah
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 dkubb joined
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:15 <Lenary> meh
17:16 <Lenary> ok, first off going to try writing a set of methods
17:16 <locks> http://ozmm.org/posts/try.html :P
17:17 <Lenary> gonna be much easier with partials
17:18 <Lenary> do recursive partials work?
17:18 <cschneid> sure
17:18 <Lenary> :D
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 <cschneid> yes
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> http://gist.github.com/109433
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 <Lenary> hrm
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> http://gist.github.com/109439
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> right
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:37 <Lenary> http://github.com/rails/rails/blob/aa4af60aad5772458e8ba3bd08505781aeeb53a2/activesupport/lib/active_support/core_ext/array/extract_options.rb#L14
17:38 <cschneid> wtf
17:38 <cschneid> anyway, just do that.
17:38 <cschneid> :)
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:46 <Lenary> erm
17:47 <Lenary> it might just be me with a typo
17:47 <Lenary> yeah
17:54 drewolson joined
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 qrush joined
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> gotcha. i'm seeing the following error message: http://pastie.org/473365
17:57 <drewolson> interestingly enough, it seems to rackup just fine if i vendor sinatra
17:57 <Lenary> yeah
17:57 <Lenary> edge in github is compatable
17:58 <drewolson> alright, cool
17:58 <drewolson> thanks
17:59 <Lenary> qrush: not seen any, sorry
18:04 michas joined
18:13 Viper7 joined
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:23 <cschneid> get it?
18:24 <Lenary> yeah
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> i got it
18:26 <qrush> ended up not being bad :)
18:26 <Lenary> qrush: well done
18:26 <Lenary> :D
18:27 bct left
18:32 <* Lenary> manhugs cschneid
18:32 <Lenary> works perfectly!
18:33 ekidd joined
18:36 jcrosby joined
18:40 edgar joined
18:41 Edgar1 joined
18:41 <Edgar1> hello
18:42 millionmonkey joined
18:42 <Lenary> hi
18:43 <Edgar1> i have been testing sinatra today, and i like it so much
18:44 <syd_> :>
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:48 Booster joined
18:51 locks joined
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> ok
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:04 <Edgar1> yeah sure
19:06 <Lenary> wooo
19:06 <Lenary> i'm about half an hour off a 1.0 release of this software
19:06 <Lenary> i hope
19:06 <Lenary> but not tonight
19:06 <Lenary> 2am = time for bed
19:07 <Lenary> night all!
19:08 Edgar1 left
19:24 bct joined
19:26 eretzloff joined
19:31 shinobi17 joined
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
19:59 benschwarz joined
20:05 kristopher joined
20:07 bct left
20:09 cloudhea joined
20:09 papyromancer joined
20:14 benschwarz left
20:19 kematzy joined
20:20 jschoolcraft joined
20:48 jfarmer joined
20:50 <jfarmer> What's the biggest Sinatra app?
20:50 <kristopher> biggestsinatraapp.com
20:51 <jfarmer> Hah.
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:53 bct joined
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!
20:58 jeremyevans joined
20:59 jeremyevans joined
21:04 jeremyevans joined
21:06 aorist joined
21:10 eretzloff joined
21:30 bct left
21:49 <logankoester> where's your app jfarmer ?
22:05 quirkey joined
22:24 maddox__ joined
22:40 maddox_ joined
23:12 rubydiamond joined
23:34 aorist joined