Swyper has quit [Remote host closed the connection]
drincruz has joined #ruby
zlogan has quit [Ping timeout: 276 seconds]
drincruz has quit [Ping timeout: 252 seconds]
Inline has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
kobain has quit [Ping timeout: 252 seconds]
falconfox has quit [Ping timeout: 240 seconds]
bvdw has quit [Read error: Connection reset by peer]
mynameisdebian has joined #ruby
bvdw has joined #ruby
raddazong has quit [Remote host closed the connection]
Technodrome has joined #ruby
madhatter has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rainmanjam has joined #ruby
jmcgnh has quit [Ping timeout: 250 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
twb has joined #ruby
Nicmavr has joined #ruby
<twb>
OK so I inherited some ROR code that's using some kind of ORM to talk to MySQL. Once a week it dumps an SQL SELECT into CSV format, for some business-to-business crap.
<twb>
Now, it broke 4 weeks ago, and I'm trying to work out how to generate a backdated query.
<twb>
Problem is I can speak SQL and can more-or-less read ruby, but I don't speak this ORM. And it's not clear to me whether the query is done this way because of the ORM, or because the previous developer was... not fluent in SQL
<roboirc>
What is rubymine v7 as compared to rubymine 2018 from jetbrains?
<twb>
...so anyway, in that paste, you can see they're constructing a query by concatenating strings together (instead of using a query builder), AND they seem to be doing it where a simple JOIN would suffice... so wtf
<twb>
roboirc: based on ten seconds quacking, it looks to me like rubymine is *always* from jetbrains
<roboirc>
ok
<roboirc>
then how come they have software called rubymine 2018 and rubymine v7 on google in trial software?
<twb>
Can I make that function print the raw SQL query before/instead of executing it
<twb>
It looks to me like the answer is "no, because this is badly-written and does lots of small SQL queries and then joins them together in ruby, instead of just doing it all efficiently in the RDBMS"
tpanarch1st_ has quit [Ping timeout: 240 seconds]
infinityfye has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
davor has quit [Ping timeout: 240 seconds]
davor has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 250 seconds]
mynameisdebian has quit [Read error: Connection reset by peer]
mynameisdebian has joined #ruby
phaul has joined #ruby
im0nde_ has joined #ruby
im0nde has quit [Ping timeout: 276 seconds]
phaul has quit [Ping timeout: 240 seconds]
conta has joined #ruby
<twb>
ohhhhh kill me
<twb>
one of the tables in this database? It's NOT IN the database.
<catphish>
leah2: i realise it *should* close, but it seems clear that this isn't always the case, and it's quite baffling, maybe strace can shed some light on it
<leah2>
yeah look at the syscall level
conta has quit [Ping timeout: 265 seconds]
<catphish>
it doesn't seem to close it :(
<catphish>
strace -e close ruby -e 'STDOUT.close'
<catphish>
even that doesn't close it
ekaleido is now known as kaleido
<catphish>
even more explicit: strace -e close ruby -e 'IO.for_fd(1).close'
Guest53132 has quit [Ping timeout: 240 seconds]
<catphish>
extra fun: ruby -e 'IO.for_fd(1).close; STDOUT.puts "hi"'
Guest53132 has joined #ruby
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has quit [Ping timeout: 265 seconds]
<catphish>
i think there's some cleverness going on here beyond my understanding, but if anyone knows, i'd love to be filled in :)
Guest53132 has quit [Ping timeout: 250 seconds]
schne1der has joined #ruby
drincruz_ has joined #ruby
alfiemax has quit [Remote host closed the connection]
drincruz has quit [Ping timeout: 265 seconds]
Guest53132 has joined #ruby
Guest53132 has quit [Ping timeout: 265 seconds]
orbyt_ has joined #ruby
Guest53132 has joined #ruby
alfiemax has joined #ruby
GodFather has quit [Ping timeout: 246 seconds]
ivanskie has joined #ruby
Guest53132 has quit [Ping timeout: 250 seconds]
fig-le-deunch has quit [Quit: Konversation terminated!]
Guest53132 has joined #ruby
AJA4351 has joined #ruby
ule has quit [Changing host]
ule has joined #ruby
Guest53132 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
AJA4350 has quit [Ping timeout: 265 seconds]
Guest53132 has joined #ruby
jordanm has joined #ruby
grilix has quit [Ping timeout: 252 seconds]
Guest53132 has quit [Ping timeout: 276 seconds]
lalitmee has joined #ruby
NODE has quit [Quit: changing servers]
Guest53132 has joined #ruby
NODE has joined #ruby
drincruz has joined #ruby
NODE has quit [Client Quit]
alfiemax has quit [Remote host closed the connection]
drincruz_ has quit [Ping timeout: 245 seconds]
NODE has joined #ruby
Guest53132 has quit [Ping timeout: 265 seconds]
NODE has quit [Client Quit]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NODE has joined #ruby
Guest53132 has joined #ruby
grilix has joined #ruby
Guest53132 has quit [Ping timeout: 265 seconds]
alfiemax has joined #ruby
grilix has quit [Ping timeout: 252 seconds]
Guest53132 has joined #ruby
davidw has joined #ruby
davidw has joined #ruby
NODE has quit [Quit: changing servers]
Guest53132 has quit [Ping timeout: 240 seconds]
cow[moo] has quit [Ping timeout: 265 seconds]
NODE has joined #ruby
Guest53132 has joined #ruby
brool has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Nicmavr has quit [Read error: Connection reset by peer]
mark1_ has joined #ruby
ivanskie has joined #ruby
<mark1_>
Just asked this in #rubyonrails, hope I can repeat here:
Nicmavr has joined #ruby
<mark1_>
Little confused - if Puma is a webserver, what does that make Nginx? A proxy?
<mark1_>
Or is Puma only the dev mode webserver, while Nginx is the production webserver?
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Jonopoly has quit [Ping timeout: 276 seconds]
<leah2>
catphish: 4629 if (IS_PREP_STDIO(fptr) || fd <= 2) {
<leah2>
/* need to keep FILE objects of stdin, stdout and stderr */
<xpitr>
puma is more specialized i guess. and i like using nginx as caching proxy in front of it
<leah2>
it wont close them
<leah2>
curious
<leah2>
fptr_finalize_flush
<mark1_>
xpitr: Ah ok
<catphish>
leah2: interesting, you can reopen them though, which i guess uses the same FD and keeps the C file object
<mark1_>
xpitr: But how to explain this to someone who doesn't know?
<leah2>
it worked in 1.8 ;)
<catphish>
mark1_: puma is a web server that specifically runs ruby code inside it (often called an application server), nginx is a more general purpose web server, which can serve static files, and also proxy to an application server (which is the usual production setup)
<mark1_>
xpitr: I see my app's sites_enabled nginx conf references puma.sock..
<mark1_>
ah ok, cool
<catphish>
leah2: perhaps i will just go back to trusty 1.8.7 /s
<mark1_>
thanks xpitr !
Guest53132 has quit [Ping timeout: 240 seconds]
<xpitr>
mark1_: maybe puma can listen on unix socket? no idea tbh i always use tcp there
<catphish>
it probably can
<leah2>
catphish: good times :P
<xpitr>
not sure unix socket is faster but kiunda makes sense anyway
<havenwood>
mark1_: puma -e production -b unix:///var/run/puma/mark1.sock
<havenwood>
I usually see /var or /tmp
rippa has joined #ruby
<mark1_>
i got upstream myapp { server unix:/home/www/myapp/tmp/puma.sock; }
NODE has quit [Quit: changing servers]
<havenwood>
mark1_: NGINX is a webserver. Puma is a webserver. You do NOT need to put Puma behind NGINX.
<havenwood>
mark1_: That said, NGINX is quite good at serving up static files and can reverse proxy to another webserver easily.
NODE has joined #ruby
<mark1_>
i see i see, great
<xpitr>
you can also easily scale it, if you have multiple servers running puma app, then have multiple server lines in upstream { ... }
<mark1_>
havenwood: any idea if OpenBSD's new httpd can be used to serve Rails apps?
<mark1_>
haven't found any tutorials and im too stupid to make sense of this myself
<havenwood>
mark1_: Those ^ Sinatra FastCGI instructions should work with Rack apps generally.
FlorianFa has quit [Quit: Leaving]
<mark1_>
indeed indeed
<mark1_>
thanks :)
NODE has quit [Quit: changing servers]
<mark1_>
"I too find it confusing -- but what's normal is using Puma as a webserver and Nginx as cached/reversed proxy. Nginx is also good for serving static files, plus is a nice way to host multiple Rails apps."
<NL3limin4t0r>
mark1_: NGINX can also be used as a load ballancer.
Guest53132 has quit [Ping timeout: 265 seconds]
NODE has joined #ruby
<NL3limin4t0r>
Assuming you have a cluster of servers.
<mark1_>
awesome, didn't know
falconfox has quit [Remote host closed the connection]
NODE has quit [Client Quit]
AJA4350 has joined #ruby
NODE has joined #ruby
<NL3limin4t0r>
From wikipedia: Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
kapil_ has quit [Quit: Connection closed for inactivity]
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest48 has joined #ruby
monika has quit [Quit: WeeChat 2.6]
jinie_ has joined #ruby
jinie has quit [Ping timeout: 246 seconds]
jinie_ is now known as jinie
sgen has joined #ruby
krawchyk has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sgen has quit [Client Quit]
NODE has quit [Client Quit]
dev-rfc83 has quit [Ping timeout: 265 seconds]
NODE has joined #ruby
jinie has quit [Ping timeout: 265 seconds]
Guest48 has joined #ruby
ogres has quit [Quit: Connection closed for inactivity]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmonster has quit [Quit: WeeChat 2.6]
harai has quit [Quit: harai]
Guest48 has joined #ruby
joast has quit [Quit: Leaving.]
Guest48 has quit [Client Quit]
zapata has joined #ruby
BH23 has joined #ruby
jinie has joined #ruby
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
davidw has quit [Ping timeout: 276 seconds]
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
Guest48 has joined #ruby
Guest48 has quit [Client Quit]
joast has joined #ruby
IanMalcolm has left #ruby ["Leaving"]
<dionysus69>
hey all
<dionysus69>
how would I do the following, obj.instance_variable_set(:@hash, { some_key: "some_value" }) but merge to an existing @hash set earlier?
mgraf has quit [Ping timeout: 245 seconds]
Nahra has joined #ruby
<dionysus69>
ok I needed to think just a little more, obj.instance_variable_set(:@hash, (@hash || {}) .merge({ some_key: "some_value" }))
<Corey[m]>
First of all, why are you accessing the instance variable of the object using instance_variable_get instead of using it's methods/accessors?
<Corey[m]>
set*
mgraf has joined #ruby
<dionysus69>
well, I am setting controller instance variable from outside, from another method
<dionysus69>
Corey[m]: you mean, why not I just use (controller.hash || {}) .merge({ some_key: "some_value" }) ?
<Corey[m]>
Partially
<dionysus69>
yea need to play with pry little more
<Corey[m]>
I mean doesn't the controller have a function that performs the merge internally
AJA4350 has quit [Ping timeout: 268 seconds]
<Corey[m]>
There is always merge! which will mutate the hash in place
grilix has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
<Corey[m]>
Note the ! at the end of the method name
<dionysus69>
oh yea I am actually using merge!, forgot to write it here
<dionysus69>
what happens if controller.hash is undefined can it be set from scratch like this? controller.hash1 = {}