nemesit|znc has quit [Quit: ZNC 1.6.3+deb1ubuntu0.2 - http://znc.in]
nemesit|znc has joined #ruby
cd has quit [Quit: cd]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Liothen has quit [Ping timeout: 260 seconds]
Liothen has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
vondruch has joined #ruby
ur5us has joined #ruby
burgestrand has joined #ruby
<nakilon>
in which directory my program is supposed to store its config and other files on arbitrary Linux?
Technodrome has joined #ruby
<nakilon>
some persistent files that user does not need to see but he creates them by using my program that remembers his preferences and maybe downloads/caches sometimes more
<nakilon>
I hoped Ruby just implements these things or there is a widely used gem for that
andremed- has joined #ruby
andremedeiros has quit [Ping timeout: 240 seconds]
andremed- is now known as andremedeiros
<nakilon>
constants like... DefaultDirs::SYSTEM_CACHE, DefaultDirs::USER_CONFIG, etc. that resolves for each OS as needed
<jhass>
hehe, make a gem :D
<jhass>
easy way to get famous
stnly has joined #ruby
<nakilon>
*to start participate in linux dirs holywar
<jhass>
*and to
<nakilon>
have no clue in current Windows state though, the C:/Users folder is a nice change but there are so many aliases now there for compatibility
<nakilon>
my old program that used Nullsoft Installer now either does not install or installs but all shortcuts are dead
momoninja has joined #ruby
<momoninja>
hello
<jhass>
hi :)
<jhass>
nakilon: try to get them to set XDG_ xD
<nakilon>
that would need reboot
<jhass>
nah, I mean microsoft
<momoninja>
how would I format a gettext string like this with format(): _('%d foo %s') % [23, _('bar')]
yasumi2136 has joined #ruby
<jhass>
Kernel#format, Kernel#sprintf and String#% are the same thing really. So you could format(_('%d foo %s'), 23, _('bar')) but there's no real benefit
<momoninja>
jhass: format() processes faster than %
<nakilon>
on Windows though you are now probably supposed to just use WSL that is essentially an Ubuntu downloaded from Windows Store
<nakilon>
maybe in this way the Ruby Installer once will become obsolete
<jhass>
momoninja: by any relevant factor?
akem_ has joined #ruby
akem has quit [Ping timeout: 260 seconds]
<momoninja>
tiny
<jhass>
so yeah, unless I had proven this to be an actual bottleneck in my application (it very likely isn't), I just wouldn't bother :)
<nakilon>
made by a single guy; who is also the only member of his organisation, heh
<jhass>
seems like a pretty legit gem though :)
<jhass>
maybe a tiny bit bloated for what it does but not too bad
ap4y has quit [Ping timeout: 260 seconds]
fercell has joined #ruby
yasumi2136 has quit [Ping timeout: 258 seconds]
fercell has quit [Ping timeout: 264 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donofrio has joined #ruby
<isene>
There is a certain suckness about the Ruby curses lib - like not having the possibility to get inputs via the Readline module - so I'm writing my own Readline implementation into RTFM :-/
akem has joined #ruby
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 256 seconds]
vondruch_ is now known as vondruch
DarthGandalf has quit [Quit: Bye]
<EdwardIII>
isene: writing your own readline? brave hehe
<EdwardIII>
isene: will you be interfacing with the C readline lib to do this?
DarthGandalf has joined #ruby
cow[moo] has joined #ruby
olspookishmagus has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
sysh has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
cow[moo] has joined #ruby
dionysus69 has quit [Remote host closed the connection]
cow[moo] has quit [Client Quit]
BSaboia has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
<isene>
EdwardIII: No, I do it in pure Ruby (easier for me than figuring out how to inteface with the lib - and then I have full control)
<EdwardIII>
be interested to see how it looks when it's ready
Rudd0 has quit [Ping timeout: 264 seconds]
ruurd has quit [Quit: ZZZzzz…]
ruurd has joined #ruby
TCZ has quit [Quit: Leaving]
duckpupp- has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<isene>
havenwood: The problem is the curses library that doesn't allow any hooks to any outside library or functions that way. I literally have to write it manually, character by character from scratch
<isene>
EdwardIII: I need to keep it readable for myself - and this is what I consider readable :-)
<EdwardIII>
isene: is ruby your first language? or did you come from something else?
<isene>
Of course, suggestions for improvements are always welcome
<EdwardIII>
to be clear it wasn't a criticism :) just an observation
TCZ has joined #ruby
<isene>
I have programmed in some 30 different languages. I have done lots of OO stuff in Ruby - like the Amar Tools (https://github.com/isene/Amar-Tools) - but I didn't see the need for any OO'ing in RTFM. My main languages have been FOCAL, MCODE (assembler for the coconut), Ruby, Raven and earlier OPL, Forth,...
<isene>
I may convert some of the functions to extension of the Curses class later, but for now, this will suffice
<EdwardIII>
is amar tools anything to do with amar of dragonruby?
<isene>
Nope - it's an RPG (see https://d6gaming.org) - it handles creating random encounter, detailed NPCs, fully populated medevial towns with interpersonal relations, random weather, random names and more
<MadLamb>
I'm trying to check if a relationship exists on my model with relationship_name.any? and it is always returning false. I noticed that the SQL query is using the parent class name instead of the children model I am performing the query on. Any ideas?
cow[moo] has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
mohsen_in has quit [Quit: Leaving]
maryo has joined #ruby
<adam12>
MadLamb: Which ORM? We'd probably need to see a bit more to make any suggestions. SQL query, bits of the two models perhaps.
roadie has quit [Remote host closed the connection]
<MadLamb>
adam12, I call that and instead of putting the class name on the query, it puts the parent name
<MadLamb>
adam12, so it doesnt find anything
rubydoc has joined #ruby
rubydoc has quit [Remote host closed the connection]
<MadLamb>
adam12, using that would not even be necessary, given the id is enough to know if there is a relationship, and a id can't be of two types at the same time
rubydoc has joined #ruby
<MadLamb>
adam12, my association "has_many" is declared on the parent, but I tried to move it to the children and it still looks for the parent name :/
<jhass>
the association doesn't tell whether the hierarchy of models is realized with STI or not
<MadLamb>
jhass, its exactly this thing, but the model with has name has inheritance
<MadLamb>
sorry my ignorance, what is STI?
ur5us has joined #ruby
<jhass>
single table inheritance
<MadLamb>
ah
<MadLamb>
the class I am trying to use the any? on, inherits from Parent that inherits from ActiveRecord::Base
<MadLamb>
its a single table with 4 different objects stored
<MadLamb>
classes*
<adam12>
MadLamb: So it's STI and not polymorphic.
<MadLamb>
its both
<adam12>
MadLamb: Ah, OK
<adam12>
MadLamb: I think the problem is that inheriting from a model assumes it's keeping the same model bits
<adam12>
if it's not, you probably want an abstract model class
<adam12>
ie. If you have an Account model, then Admin < Account, the Admin model re-uses everything that Account set. So it thinks it's Account and not Admin.
<MadLamb>
the Parent class has_many of a class Feature. The Feature has belongs_to :featureable, :polymorphic => true"
<MadLamb>
this Feature is also used in a different model
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<MadLamb>
when I call any? on the Child, it should use the Child in the query, but it is using the Parent
<MadLamb>
the mapping seem reasonable, the issue is in the query IMO
<jhass>
using fake names makes this so much harder to understand :/
<MadLamb>
Parent = Post, Child = Project
ap4y has quit [Quit: WeeChat 2.9]
CactusJuan has joined #ruby
<jhass>
Project < Post? weird but ok :D
<MadLamb>
Project inherits Post
<MadLamb>
Project inherits Post inherits ActiveRecord::Base
<havenwood>
MadLamb: A project is a type of post?
<MadLamb>
havenwood, yes
<jhass>
so, you got a feature and want to do feature.post.any?
<adam12>
MadLamb: I wouldn't be surprised if this is an ActiveRecord bug.
<MadLamb>
adam12, looks like it
<MadLamb>
jhass, I want to know which Projects are featured. In the Project scope I am calling feature.any?
<jhass>
I feel like it's someting like it's picking the relationship name because it has no clear class to go to, but I have no clear picture yet to be honest
<jhass>
ah
<MadLamb>
I want to know if the current project is featured*
<jhass>
what's your exact has_many line in Project?
<adam12>
MadLamb: Maybe you can get by with defining a custom dataset that filters on the type.
<jhass>
I wonder what happens if you rename the one in Project to :project_features and try project_features.any?
<MadLamb>
jhass, this was actually declared in Post only. I moved up to see if it would make a difference
ap4y has joined #ruby
<MadLamb>
jhass, there are 4 models that extend Post
CactusJuan has left #ruby [#ruby]
<MadLamb>
adam12, that didnt work. exact same result.
<MadLamb>
adam12, SELECT 1 AS one FROM "features" WHERE "features"."featureable_id" = $1 AND "features"."featureable_type" = $2 AND "features"."featureable_type" = 'Project' LIMIT 1 [["featureable_id", 187], ["featureable_type", "Post"]]
<jhass>
hum, rewhere and respicify the id condition too?
<MadLamb>
o.id?
duckpuppy has joined #ruby
<jhass>
I guess, yeah
<jhass>
might just do a def at that point, idk
duckpuppy has quit [Client Quit]
<jhass>
def features; Feature.where(featurable_id: id, featureable_type: self.class); end
<MadLamb>
jhass, I added id, now it has 4 AND
<MadLamb>
:D
<MadLamb>
its appending, not replacing
<MadLamb>
maybe a too old rails?
<MadLamb>
Rails 4.2.11.3
ap4y has quit [Quit: WeeChat 2.9]
ap4y has joined #ruby
<MadLamb>
seems to be the latest 4.2.x release
<MadLamb>
so if there was a known bug should be fixed
<jhass>
not sure what you added now, the featurable_id snippedto adam12's version above, or also switching the where to a rewhere there or added the def in addition to the has_many?
<MadLamb>
SELECT 1 AS one FROM "features" WHERE "features"."featureable_id" = $1 AND "features"."featureable_type" = $2 AND "features"."featureable_id" = 3439 AND "features"."featureable_type" = 'Project' LIMIT 1 [["featureable_id", 3439], ["featureable_type", "Post"]]
<jhass>
so yeah, that's quite expected
<MadLamb>
I didnt code this app, just to be clear
<MadLamb>
:D
<jhass>
the idea was to use rewhere, which then makes adding the id necessary, I think
<jhass>
so, just get rid of the has_many and do the def :P
<MadLamb>
:(
<jhass>
def features; Feature.where(featurable_id: id, featureable_type: self.class); end
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
<CactusJuan>
for ext in ext_list
<CactusJuan>
Hello looking for some assistance regarding net/http and using a GET request to pull some reports that have parameters in the uri. This is a snippet of the loop i have.
<CactusJuan>
when my script gets to this point i get an error, Failed to open TCP connection to (my uri with the parameters:80) (no implicit conversion of URI::HTTPS into string) (TypeError)
<CactusJuan>
no sure why this is. i tired searching but not sure if i am looking for the right things. when i visit the uri without the :80 at the end, i see the data i want
<CactusJuan>
sorry tried to get it all in one
<jhass>
Mmmh, looking at the docs I don't think .get takes headers like that
<CactusJuan>
is the get method not correct then? i tried get_response and it gave me the same error
<jhass>
so you gave it a hash for the "path" argument which means it interprets the first argument as a host string and not an URI
<jhass>
get_response seems to sport the same API
zapata has quit [*.net *.split]
turt2live has quit [*.net *.split]
Takumo has quit [*.net *.split]
CustosLimen has quit [*.net *.split]
Phoebus has quit [*.net *.split]
Bish has quit [*.net *.split]
tweaks has quit [*.net *.split]
G has quit [*.net *.split]
SegFaultAX has quit [*.net *.split]
TheMoonMaster has quit [*.net *.split]
<jhass>
I think for net/http you need to get to the instance API, so newing one up with the right host and then using #get on it with the path and headers. If you can take an external dependency, using httprb or faraday should be much simpler :)
G has joined #ruby
Phoebus has joined #ruby
SegFaultAX has joined #ruby
tweaks has joined #ruby
zapata has joined #ruby
CustosLimen has joined #ruby
Takumo has joined #ruby
TheMoonMaster_ has joined #ruby
justHaunted has joined #ruby
turt2live has joined #ruby
teardown has quit [Ping timeout: 260 seconds]
<MadLamb>
jhass, still running my script but seem to have worked
<MadLamb>
jhass, thanks :D
<MadLamb>
adam12, thanks too <3
duckpuppy has joined #ruby
<MadLamb>
wish ActiveRecord was a little bit more decent
justHaunted has quit [Read error: Connection reset by peer]
CactusJuan has left #ruby [#ruby]
bmurt has joined #ruby
bmurt has quit [Client Quit]
justHaunted has joined #ruby
vondruch_ has joined #ruby
kristian_on_linu has joined #ruby
vondruch has quit [Ping timeout: 272 seconds]
vondruch_ is now known as vondruch
justHaunted has quit [Remote host closed the connection]
justHaunted has joined #ruby
MadLamb has quit [Ping timeout: 240 seconds]
ruurd has quit [Read error: Connection reset by peer]
ruurd has joined #ruby
mojca has joined #ruby
mojca has quit [Client Quit]
mojca has joined #ruby
mojca has quit [Client Quit]
mojca has joined #ruby
mojca has quit [Client Quit]
mojca has joined #ruby
mojca has quit [Client Quit]
mojca has joined #ruby
Rudd0 has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Ping timeout: 265 seconds]
stryek has quit [Quit: Connection closed for inactivity]
TCZ has quit [Quit: Leaving]
banisterfiend has joined #ruby
queip has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
queip has joined #ruby
s2013 has quit [Ping timeout: 260 seconds]
Technodrome has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]