04:43
<davesag>
noob ruby question here. why doesn't require '../../models/user' work?
04:44
<davesag>
where is the project root folder? an environment variable?
04:46
<davesag>
hmm. require 'models/user'
04:46
<davesag>
just worked
05:06
<jorrizza>
khaase: thanks, but the problem I'm having isn't in the browser. The stuff eventually ending up there is UTF-8. It's UTF-8 regex in DataMapper validations that breaks on ASCII values.
05:38
<khaase>
also, I think they don't follow RFCs correctly
05:59
<jorrizza>
khaase: wow, that's fast. I'll test the patch as soon as possible.
06:00
<khaase>
jorrizza: good, looking forward for feedback.
06:00
<khaase>
jorrizza: also, was working on it any way, as I'm currently prepping the 1.1 release.
06:02
<mr-rock>
khaase: Hey! Have you removed the Tilt bundled code from the Sinatra code?
06:02
<khaase>
mr-rock: not yet
06:03
<khaase>
mr-rock: still waiting for a tilt release
06:03
<khaase>
mr-rock: also, I don't have a commit bit (yet?)
06:04
<khaase>
still waiting for feedback from sr and blake, too
06:05
<mr-rock>
khaase: Ok, no problem.
06:06
<mr-rock>
khaase: Listen, if you require any extra help on something, just let me know ok?
06:06
<khaase>
mr-rock: you don't happen to speak japanese?
06:06
<mr-rock>
khaase: I speak very little Japanese, sorry.
06:07
<mr-rock>
khaase: I speak Spanish, French, some Dutch, some Italian and some Portuguese :P
06:08
<khaase>
mr-rock: cool. another remain issue is running rake test on 1.9.2. it segfaults.
06:08
<khaase>
I pseudo-fixed it in my branch.
06:08
<khaase>
probably some ruby issue, again
06:09
<mr-rock>
khaase: I'll take a look tonight if that is ok with you...?
06:10
<khaase>
mr-rock: no problem. also, I think a release can be done anyways, but there is a slight chance that this could also happen in a real app. although that has not been reported so far.
06:10
<mr-rock>
khaase: Is the issue reported on Github?
06:10
<khaase>
mr-rock: I'm just a bit clueless about that issue. hunting it downs is probably rather painful.
06:11
<mr-rock>
khaase: two heads usually thinks better than one (if none of them are wasted!) :P
06:13
<harryv>
it should probably be reported to the main ruby issue tracker.
06:14
<khaase>
but nailing it down to some smaller portion of ruby code would probably help getting it fixed.
06:14
<khaase>
also, remember when some 1.8.7 patchlevel was segfaulting on 0.9?
06:14
<mr-rock>
khaase: Fair enough. I'll see what can I do about it, man.
06:15
<khaase>
no one really cared from the ruby core folks and it had to be fixed in sinatra.
06:15
<mr-rock>
khaase: No problema.
06:16
<khaase>
also, tracking down segfaults is rather heisenbug-ish, imo. at least whenever I do it they tend to move around on investigation.
06:17
<harryv>
this one does as well.
06:17
<foca>
they run away from you in fear, that's why
06:17
<* foca>
goes back to lurking
06:21
<mr-rock>
khaase, Those freaking' rascals :P
06:23
<sr>
khaase, did you ever get push access?
06:24
<khaase>
sr: not yet, ryan proposed it and said he'd talk to blake, but no feedback from him so far
06:26
<sr>
ok, emailed him again, blake probably forgot
06:26
<sr>
thanks a bunch for all the work btw
06:29
<sr>
so his Rake::TestTask causing the issue? i am getting segfault under 1.9.2 on another project as well
06:30
<harryv>
nah, `testrb test/**/*_test.rb` segfaults as well
06:34
<khaase>
if you avoid settings_test.rb it doesn't
06:35
<harryv>
that's what he was refering to, I think.
06:35
<khaase>
oh, didn't read the messages above
06:35
<foca>
all these makes me want to use sinatra more, I've been bitching about rails far too much lately, I need to bitch about different things not working :P
06:35
<mr-rock>
Probably the problem is Rake on 1.9.2
06:36
<khaase>
mr-rock: it is not
06:36
<khaase>
you can reproduce this with testrb (as harryv said)
06:37
<foca>
why the ENV["NO_TEST_FIX"] ?
06:37
<sr>
foca, agreed. i keep bitching about sinatra's exception handling crazyness. i guess i should use rails more
06:37
<khaase>
foca: so you can reproduce the issue
06:37
<khaase>
NO_TEST_FIX=1 rake test
06:37
<mr-rock>
I will check that out later, in any case.
06:41
<sr>
khaase, nice job making people think we're fast :P
06:43
<mr-rock>
Agreed. :P
06:44
<sr>
khaase, do we really need the default_encoding stuff btw?
06:45
<sr>
that is, could we let that out of sinatra and let people handle it at another level?
06:45
<foca>
rescue StandardError
06:45
<foca>
[500, 'sorry, error']
06:45
<foca>
that example from the readme is broken, right?
06:45
<foca>
or does ruby now support rescue in blocks without begin and I missed the ann?
06:46
<khaase>
foca: oh, might be. I was relying on define_method.
06:46
<sr>
we obviously need unit tests for the readme examples.
06:47
<khaase>
sr: I'm not sure. The problem is that params from the outside are Encoding::ASCII_8BIT and that cannot be combined with a UTF8 string.
06:48
<khaase>
foca: yeah, that's wrong, sorry, will fix that
06:48
<foca>
no problem, just wondering, I haven't been following 1.9.2 too closely :)
06:50
<khaase>
also, wrapping the example in a begin end makes it ugly :(
06:56
<khaase>
sr: there is an outstanding patch for rack fixing this, btw.
06:56
<khaase>
sr: the params issue that is
06:56
<khaase>
but it's not even clear whether it will be merged.
06:58
<khaase>
Rails does the same thing (hardwired to UTF-8), but I did want the ability to set another encoding.
06:59
<khaase>
not sure if it's the best solution, though (both approach and api)
06:59
<skanev>
hi all. is there a way I can run sinatra within a small ruby daemon?
07:00
<skanev>
I want to control the daemon over HTTP and would like to have the HTTP interface to be coded in sinatra
07:00
<skanev>
but I'm unsure how to spring up a sinatra app listening a port from within it
07:01
<khaase>
skanev: Sinatra::Application.run! :port => 12345
07:02
<sr>
khaase, got a link to that rack patch?
07:04
<skanev>
khaase: so, does it make sense to run that in a separate thread?
07:04
<khaase>
sr: it really depends what server you are using. maybe you even want to fork into a child process.
07:05
<khaase>
s/sr/skanev
07:05
<skanev>
I just have a small daemon written in ruby, and I want to query it over HTTP. I'm not running a server yet and for all I care, it can be a WEBrick
07:06
<skanev>
I would like to be in the same process and just ask my threads stuff
07:06
<khaase>
I never tried running it any rack handler (server) in a thread, only separate processes or thin with eventmachine and no extra thread.
07:07
<khaase>
but could work. you just have to watch for concurrency issues such as race conditions.
07:08
<skanev>
hm, I tried doing run! in a seperate thread, but then when I try to kill the process, it just stops sinatra
07:08
<skanev>
but alright, thanks, I'll check out what #run! does and see if I get an idea
07:14
<khaase>
skanev: that's because sinatra sets up a trap
07:16
<erderd>
good afternoon
07:18
slackstation joined
07:19
<skanev>
yeah, saw that
07:20
<skanev>
khaase: any ideas how I should have my daemon killed at the same time?
07:21
<skanev>
just have another trap, that kills it?
07:22
<skanev>
foca: hm, thank, I'll check that out
08:06
<erderd>
hello, how can you define a helper class (not method) for sinatra? thank you
08:07
<namelessjon>
erderd: What do you mean by helper class?
08:08
<khaase>
erderd: define a module, not a class
08:08
<erderd>
a class which contains the logic in one unit. i would like to create instances of it. also, the class needs to access env, session methods of sinatra.
08:08
<khaase>
erderd: so it only lives for the duration of one request?
08:08
<erderd>
can i later create instances of the defined module? can i have instance fields, methods of it? what if i need multiple instances of the contained logic?
08:09
<namelessjon>
erderd: Write a class, pass the session into the constructor?
08:09
<erderd>
no, it sould live from the start of the server until the termination
08:09
<khaase>
erderd: like namelessjon said, maybe pass env or sinatra instance instead
08:10
<khaase>
erderd: than you cannot access session/request/... as those only exist for the duration of one request
08:10
<erderd>
sinatra instance sounds good
08:10
<khaase>
s/than/then
08:10
<namelessjon>
erderd: A sinatra instance only exists for one request.
08:10
<khaase>
or you suffer concurrency wise
08:10
<erderd>
i see. however, the methods that need to use use session
08:10
<erderd>
would be called only during a request.
08:11
<namelessjon>
There is no global list of sinatra instances though.
08:12
<namelessjon>
So I think at some point, either constructor, or method call, you need to pass the current request, or sinatra instance, or whatever into the class/methods
08:22
<erderd>
are all helper methods only available during a request?
08:33
<namelessjon>
erderd: Yes, they're instance methods on the sinatra instance. This is why they can access instance variables.
08:33
<khaase>
erderd: yes. helper methods are defined on the instance side of your sinatra class and instances are created per request.
08:53
<aresnick>
Is there more involved in converting a classic app to a modular app than enclosing the routes in a class that subclasses Sinatra::Base and requiring sinatra/base instead of sinatra? I get "no such file to load -- active_support/core_ext/object/singleton_class (LoadError)" when trying just that--
08:54
<khaase>
aresnick: you're using active support?
08:55
<khaase>
aresnick: looks more like you upgraded AS (they changed active_support/core_ext/kernel/singleton_class to active_support/core_ext/object/singleton_class or the other way around)
08:55
<khaase>
aresnick: using any extensions?
08:55
<aresnick>
khaase: To be frank, I'm not sure re: AS--I'm using compass, pony, and sinatra-reloader
08:56
<khaase>
aresnick: yeah, sinatra-reloader requires either AS or backports, but it prefers backports if AS hasn't already been loaded.
08:56
<cschneid>
aresnick: pony pulls into AS
08:56
<cschneid>
khaase: pony too :)
08:56
<cschneid>
at least I think so
08:57
<khaase>
and sinatra-reloader is triggering a require 'active_support/core_ext/object/singleton_class'
08:58
<khaase>
if you use AS
08:58
<khaase>
yeah I know
08:58
<khaase>
you use AS 2.3.5 or earlier
08:59
<khaase>
aresnick: ⇧⇧⇧
08:59
<khaase>
that is probably caused by pony
08:59
<khaase>
wait a sec
09:05
<khaase>
aresnick: no, that's not it, 2.3.5 has a active_support/core_ext/object/singleton_class
09:05
<cschneid>
khaase seems to be on top of this, but may I just say that AS sucks. So many problems end up related to it, and it's huge to pull into an app
09:06
<khaase>
cschneid: that is why sinatra-reloader will only use it if already loaded and otherwise use backports
09:06
<khaase>
and backports is rather nice
09:06
<harryv>
backports?
09:06
<khaase>
small, simple, clean
09:06
<cschneid>
haven't seen backports - pulls 1.9 stuff into 1.8 I assume?
09:08
<khaase>
uh, oh, have to apply patches for 3.0.0
09:11
<khaase>
aresnick: you are probably on some strange AS version, so 3.0 prerelease
09:13
<khaase>
aresnick: make sure you either downgrade to AS 2.3.8 or upgrade to AS 3.0 + monkey-lib 0.5.3
09:13
<khaase>
aresnick: btw. pony has a dependency to AS >= 2.3.6, not sure it works properly with 3.0
09:20
<khaase>
I hate AS for changing paths all the time.
09:20
<khaase>
I think the next release of sinatra-reloader will simply depend on backports
09:55
Yuffster_work joined
10:11
<aresnick>
khaase: Awesome; thanks!
10:12
<khaase>
aresnick: no problems. feel free to ping me if you have issues with sinatra-reloader or akin.
10:13
<khaase>
aresnick: no problems. feel free to ping me if you have issues with sinatra-reloader or akin.
10:13
<khaase>
sorry if i said that twice, am on a train, connection is lousy.
10:15
<khaase>
that's how I know I'm reaching outer berlin: internet gets sucky. if quality would stay the same all the time I would probably miss my station.
10:17
<aresnick>
khaase: haha
10:21
<aresnick>
khaase: In case you can't tell, I'm pretty new to Ruby/Sinatra--I don't quite understand what magic goes on such that when I "ruby app.rb" a server starts up. Now that I've subclassed my app, can I recover/control that behavior? i.e. I'd like to easily switch from running my app via unicorn to just running it from the command line.
10:22
<khaase>
aresnick: you could add a `App.run! if $0 == __FILE__` to your app file to be able to run `ruby app.rb`
10:23
<aresnick>
khaase: Oh, I see--ok, thanks!
10:23
<khaase>
aresnick: but better yet, you probably wrote a config.ru for unicorn anyways, so you can do a `rackup` in that folder.
10:26
josephholsten joined
10:27
<aresnick>
khaase: Oh, sure--OK
10:48
krainboltgreene joined
11:04
BrianTheCoder joined
11:06
slackstation joined
11:33
<aresnick>
I've converted my app from a classic to a modular app, and now sinatra/reloader doesn't seem to be reloading--any suggestions on how I might go about testing this?
11:38
<harryv>
aresnick: how do you set up sinatra-reloader?
11:38
<aresnick>
harryv: Right now I just 'require sinatra/reloader' -- it's not clear to me what should change in switching to a modular app
11:39
<harryv>
in the botto.
11:39
<aresnick>
harryv: =/ Sorry! Totally missed that in skimming
11:42
<aresnick>
Also, I'm trying to render different partials on different pages as part of the same layout, and having some trouble. Meaning, I have a view A, which calls partial B (via
http://gist.github.com/119874). Partial B includes partial C, and the identity of partial C is determined by the route rendering A. As I have it setup, I just have "= partial @filename_of_partial.to_sym", but this seems to break the site, the styl
11:48
chriskjennings joined
11:49
<aresnick>
Err, totally dumb mistake; was including the _ prefix.
11:52
chriskjennings joined
12:49
BrianTheCoder joined
13:05
slackstation_ joined
13:12
<irjudson>
What's the most up to date, correct way to expose restful routes in a sinatra app? (I see sinatra-rest-addon is the most recent code, but want to be sure I'm using the right pieces)
13:14
<cschneid>
irjudson: most people just roll it themselves. get '/users', get '/users/new', post '/users', etc.
13:15
<cschneid>
you end up needing to define the code anyway
13:15
<cschneid>
the route part is the smallest
13:15
<cschneid>
and I prefer less abstraction :)
13:15
stephenjudkins joined
13:15
<irjudson>
is there any special work for handling json as the payload type?
13:15
<irjudson>
(a pointer to an example page would be fine)
13:15
<namelessjon>
JSON.parse(request.body.read) or so
13:16
<irjudson>
namelessjon, golly, here too?
13:16
<cschneid>
irjudson: he's sneaky, also helpful.
13:16
<cschneid>
irjudson: yeah, body.read will get the raw body (ie, without trying to decode html form encoding)
13:16
<cschneid>
to send json down to browser
13:17
<cschneid>
content_type :json \n {my => object}.to_json
13:17
<cschneid>
you may need to require 'json' up top
13:17
<irjudson>
no worries there
13:17
<namelessjon>
Or Yajl, which is my preference.
13:18
<harryv>
you can throw the content_type(:json) in a before-filter as well
13:19
<harryv>
which comes handy if all (or most) of your routes returns json anyways.
13:19
<irjudson>
they're all going to do json
13:19
<irjudson>
in and out
13:19
<irjudson>
no other formats for now
13:19
<harryv>
yeah, then before {content_type :json}
13:20
<namelessjon>
Yeah, I've used that pattern a few times. Also checking users and setting default cache control headers.
13:26
<irjudson>
that is easy
13:33
<codebeaker>
random question, anyone using Warden in here could help me out, I have some problems and nobody seems to be able to help (and there's no mailing list)
13:54
<aresnick>
Are there good setups for easily switching how stylesheets get included (e.g. relative linking breaks on local development when you add nesting)
13:58
<namelessjon>
aresnick: What do you mean by nesting?
14:10
<aresnick>
namelessjon: well in my layout I have src="stylesheets/..." but on pages that aren't at the root (foo.com/bar/baz/fuzz) the css breaks
14:13
<aresnick>
namelessjon: Err, man--I was just missing the leading slash. Sorry!
14:15
<namelessjon>
aresnick: Glad to act as a rubber duck ;)
14:16
<poloych>
Using the pony to send mail, is it possible to send mail to several addresses at the same time? is just to: 'email1@exaple.com, email2@exaple.com,email3@exaple.com'
14:20
<namelessjon>
poloych: I suggest you try it and see :)
15:35
BrianTheCoder joined
15:52
<plopette>
Hi there
15:52
<plopette>
I have the strangest case, I don't get it
15:53
<plopette>
p string1; p string2
15:53
<plopette>
"$2a$10$SSXRy3t0SGiNss7wotohme5RlD3bnKdL3hBLrQnoNgvg.yb.g3vcO"
15:53
<plopette>
"$2a$10$SSXRy3t0SGiNss7wotohme5RlD3bnKdL3hBLrQnoNgvg.yb.g3vcO"
15:53
<plopette>
in the shell
15:53
<plopette>
Then when I do string1 == string2, it returns false
15:53
<plopette>
but when I do string1.eql?(string2) it returns true
15:54
<jorrizza>
khaase: I've broken my Ruby 1.9 installation, so I'm afraid I'm not able to test the unicode patch just yet
15:54
<namelessjon>
plopette: Are they both actually strings?
15:54
<namelessjon>
plopette: p string1.class, p string2.class
15:54
<plopette>
oh thank you, I was wondering how to do just that
15:55
<plopette>
namelessjon: both of them are BCrypt::Password instances
15:56
<plopette>
I will use eql? I guess :)
15:56
<namelessjon>
plopette: bcrypt overrides ==
15:56
<namelessjon>
Which lets you do this:
15:57
<namelessjon>
string1 == string2_before_you_use_bcrypt_on_it
15:57
<plopette>
Yes, you are absolutely right
16:01
<plopette>
namelessjon: may I ask where you live namelessjon?
16:01
<namelessjon>
The UK
16:03
<plopette>
Look at you helping me all the time
16:03
<plopette>
Your ancestors were calling my people frogs
16:03
<plopette>
I like it better nowadays :D
16:04
<plopette>
It's nice cause not so long ago, we used to be at war with the British up north, and the German on the right
16:05
<namelessjon>
plopette: You can't help being french, so it seems rude to hold it against you ;)
16:05
<plopette>
namelessjon: well, those german people certainly weren't thinking like that when they took revenge with WWII
16:06
<plopette>
I mean, it took quite a masacre, but it seems that we Europeans are getting along super well these days
16:07
<plopette>
Now, to be perfectly honest, I went to London for two weeks a while ago, and the food you have there... not the best I've tasted :(
16:08
<plopette>
I was talking to some local inhabitants and they were all telling me how food is an issue in England
16:08
<plopette>
I saw a lot more fat people than I was expecting too
16:11
<huma>
plopette: it's not food that is an issue. it's people who eat it.
16:13
<huma>
also, you can find crap/awesome food in any city. ask a few locals. they know the good places.
16:16
<plopette>
huma: I was in a youth residence, and the people there were eating fish and chips, kebabs, and burgers a lot
16:17
<plopette>
mostly fastfood (and bad quality fastfood :/), and pasta
16:18
<plopette>
I went to the local groceries (a lot of indian people ! reminded me of Apu :D) and couldn't find vegetables
16:19
<plopette>
Of course it must depend on the place, but all in all, my experience there with food was desatrous
16:19
<plopette>
The architecture is great there though
16:19
<plopette>
And I came back with a "Mind the gap" tshirt
16:20
<plopette>
it's so goddamn annoying when you hear it at every stop. I had to have one of those :')
16:21
<huma>
well, students (youth) eat same crap anywhere :)
16:22
<huma>
glad you enjoyed it nonetheless :)
16:27
<namelessjon>
plopette: btw, are you tripdragon?
16:27
<plopette>
namelessjon: no
16:28
<plopette>
I appear here with the nicknames lolette, plopette, or oakleaf maybe
16:28
<namelessjon>
I was just curious if you employed yet another alias for googlegroups :)
17:04
Yuffster_work joined
17:05
<plopette>
namelessjon: good night :)
17:47
<krainboltgreene>
Hello.
18:14
charlenopires joined