00:00
bradgonesurfing joined
01:23
<philly-mac>
Hi, anyone here have experience using the padrino-framework that sits on top of sinatra?
01:33
bradgonesurfing joined
04:08
<huma>
how do i get current app :env option?
05:09
<cypher23>
huma, `settings.environment'
05:10
<cypher23>
(`options' is an alias for settings)
05:12
<cypher23>
huma, also, settings is only available from 0.9.5 onwards
05:13
<zelnick>
hey, are there any helpers to make a (DELETE|PUT) Request from a view?
05:13
<harryv>
zelnick: you can use the _method hack.
05:13
<cypher23>
zelnick, in what sense? Via AJAX?
05:14
<zelnick>
im trying to keep my application restful
05:15
<zelnick>
so i just want to delete a resource in the db...
05:16
<cypher23>
zelnick, as harryv said, just do a POST, and have a parameter called '_method' set to either 'put' or 'delete' depending on what you want to do
05:16
<zelnick>
allright, thx guys
05:16
<cypher23>
the MethodOverride Middleware will then convert the POST to the appropriate HTTP verb
05:16
<zelnick>
thats how rails does it, right?
05:16
<cypher23>
they use the same middleware
05:17
<harryv>
if you have a top level app it's enabled by default. if you subclass Sinatra::Base you have to `enable :method_override` (in some earlier version its :methodoverride iirc)
05:22
<zelnick>
its, working thx :)
06:19
<santiago>
hi all. i want to apply a filter only to certain routes, how to do that? is it possible at all?
06:20
<tbuehlmann>
you have to check the route, if that wasn't changed
06:21
<santiago>
check the route?
06:22
<namelessjon>
In the before filter
06:23
<tbuehlmann>
right, I assumed you are already working with it
06:40
hipertracker joined
06:45
<santiago>
i don't know what it means to "check" the route
06:45
<santiago>
anyways ...
06:45
<santiago>
anyone with experience with sinatra in GAE?
06:46
<cypher23>
santiago, if request.path =~ %r{/some/route}; ...; end
06:46
<cypher23>
^ check if it's the route you want to handle in your before filter
06:48
<santiago>
could be something better
06:48
<santiago>
anyone with experience deploying sinatra to GAE?
06:49
<cypher23>
santiago, you can also define multiple handlers with the same route, and simply call `pass' if the handler thinks it can't handle the request
06:49
<cypher23>
then sinatra will pass the request to the next handler with the same route
07:02
<huma>
cypher23: thanks
07:08
<pjammer>
no no this is what i need. request.query_string
07:09
<SkramX>
santiago: i know people who have deployed sinatra to GAE, what's wrong?
07:30
<santiago>
SkramX: only route that works is '/', whenever i use another route GAE complains by telling the file does not exist
07:35
<SkramX>
in the changelog for 0.9.2, there were some GAE fixes
07:37
<santiago>
i'm using 0.9.6
07:41
<cypher23>
santiago, are your paths prefixed with a '/'?
07:41
<cypher23>
ie., get '/foo/bar', or get 'foo/bar'?
07:41
<cypher23>
try removing that
07:41
<santiago>
prefixed with /
07:41
<santiago>
remove the '/' ?
07:41
<cypher23>
just test it with one URL
07:41
<santiago>
ok, i'll check
07:42
<santiago>
it is only happening with POST routes
07:49
<santiago>
with GET work aright, the prob happen with POST routes
07:50
<santiago>
Mar 11, 2010 2:48:54 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
07:50
<santiago>
WARNING: No file found for: /project.html
07:51
<santiago>
the is the route "/project", later "project" as you suggested
07:51
<santiago>
and then i do ...
07:52
<santiago>
then i get the warning
07:52
<santiago>
it seems that GAE is passing a GET request to sinatra, i think that because of this ... Mar 11, 2010 2:48:54 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
07:55
<cypher23>
santiago, I've never done anything with GAE (or jRuby, for that matter), so I can't help you there
08:28
<markwithout>
is there a right way to do a `get /:id do` where the id param is optional? Can this be solved via regex or something?
08:29
<cypher23>
`get %r{/(\d+)?}'
08:30
<harryv>
… given the id is a number :)
08:32
<markwithout>
cool thanks. \/ escape the forward though ;P
08:34
<cypher23>
markwithout, what for?
08:35
<cypher23>
that's why I used %r{}, so I didn't have to
08:36
<markwithout>
oh, sorry. well, I suppose you learn something new every day
08:36
<cypher23>
%r{} is very useful with regex routes, because escaping every single / gets old quickly
08:37
<harryv>
or %r|| or %r-- or whatever fits.
08:39
<markwithout>
thanks cypher23
09:00
<huma>
cypher23: why is it not settings.env, btw? you set :env, but look for environment. not consistent.
09:01
<cypher23>
no, you set :environment
09:02
<cypher23>
huma, you can still `set :env, :foobar', but sinatra uses :environment
09:02
<harryv>
it's deprecated. removed in 1.0
09:03
<huma>
it says :env there
09:03
<huma>
i like :env better, though. less typing :)
09:07
<cypher23>
huma, if you're typing 'environment' often enough that this is actually becoming an issue, you're probably doing something wrong :)
09:15
<huma>
why did they change it anyway?
09:16
<harryv>
it's more descriptive I guess.
09:17
<harryv>
there's really no reason to shorten it, as you don't use it very often.
09:57
<huma>
so, my layout.haml supposed to be in .views and all should work then?
10:34
flegelleicht joined
11:15
<gp5st>
hey! so, i erb :view and it's saying that the variables I use are undefined, but if I pp them before I call erb
11:24
<gp5st>
they are set*
11:24
<gp5st>
forgot that part
11:25
adulteratedjedi joined
11:26
charlenopires joined
11:59
<pjammer>
i do love how sinatra is all ruby-y. forces you to get back to ruby code, at it's core.
12:00
<ecin>
pjammer: don't get that feeling with Rails?
12:01
<pjammer>
yeah i do, but that's only when 'shit' hasn't been figured out yet.
12:01
<pjammer>
like a helper here, or a weird validation there
12:01
<pjammer>
with sinatra, it's all ruby. makes you a better man
12:02
<pjammer>
except for the rack bits....
12:02
<pjammer>
those are helper-esque.
12:29
<gp5st>
i'm having an issue where things in the public folder cause sinatra to give a 404 :-\ any idea of why or how to fix it?
12:33
<sr>
gp5st, enable :static ? also, see you have public/foo.png, you'd access it via /foo.png
12:33
<gp5st>
it works for other things, but if i add a file it won't see it
12:33
<gp5st>
sorry, i didn't mention that
12:33
<gp5st>
i restarted the test server too
12:38
<gp5st>
:-\ i made sure the perms were the same
12:40
<gp5st>
nvm, i'm just stupid
13:06
aaroninfidel joined
14:55
flegelleicht joined
15:00
BrianTheCoder joined
15:07
charlenopires joined
15:23
flegelleicht_ joined
15:45
thefifthcircuit joined
16:44
<santiago>
hi anyone with experience deploying to GAE?
17:06
BrianTheCoder joined
17:16
millionmonkey joined
17:42
flegelleicht_ joined
17:44
flegelleicht__ joined
17:48
<santiago>
what would be a reason for gettin require': no such file to load -- ostruct (LoadError)
17:49
<johnny>
you didn't require rubygems ?
17:50
<namelessjon>
santiago: A messed up ruby install?
17:51
<santiago>
yeh i commented out require 'rubygems'
17:51
<namelessjon>
ostruct is part of the stdlib though
17:52
<santiago>
but still
18:12
Swimming_Bird joined
18:12
<Swimming_Bird>
for some reason when i server up a sass file using sass :foo, :layout => false the browser doesnt parse it
18:13
<Swimming_Bird>
but the same stylesheet served from public is parsed just fine
18:13
<Swimming_Bird>
is there something i need to do to set the mime type?
18:16
aaroninfidel_ joined
19:59
aaroninfidel_ joined
20:32
flegelleicht_ joined
22:16
flegelleicht joined
23:21
bradgonesurfing joined