havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
drincruz has joined #ruby
venmx has quit [Ping timeout: 260 seconds]
<KrzaQ> is there a printf format that would let me say "zero-filled to two characters to the left, at most 2 decimal digits after the dot"? Conceptually something like `%02.2f`, which does not work for me
<KrzaQ> oh, %05.2f actually works, because it's the number of characters
<KrzaQ> thanks folks
Bounga has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
sylario has quit [Quit: Connection closed for inactivity]
akem has quit [Ping timeout: 260 seconds]
Swyper has quit [Remote host closed the connection]
xco has joined #ruby
<xco> hi all.
<xco> is Ruby still on track to making all strings frozen by default in Ruby 3 or something changed along the way?
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<xco> another question
<xco> when you do `/foo/.to_s` you get `"(?-mix:foo)"` what's this -m:foo here?
<apotheon> It looks like Grinch is the answer to the Cinch question.
dfucci has quit [Ping timeout: 260 seconds]
<apotheon> kaleido: It's in rubygems, so `gem install grinch` should work, I guess.
coniptor has quit [Ping timeout: 256 seconds]
gix has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
<adam12> xco: Pretty sure frozen strings isn't happening by default. Last I heard, matz doesn't want the incompatibility.
r3m has joined #ruby
<xco> adam12 hmmm good i asked. the track/plan has undergone some changes that are easy to mis
<xco> miss*
<adam12> xco: For your second question, the -m removes newline's matched by . for that grouping only.
<adam12> (the grouping being 'foo')
<adam12> i ignores case, and x ignores whitespace/comments.
<xco> adam12 awesome thanks. any where i can find documentation on this?
<adam12> xco: Definitely the Regexp docs. https://rubyapi.org/2.7/o/regexp
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
drincruz has joined #ruby
<xco> adam12 thank you very much
Emmanuel_Chanel has quit [Ping timeout: 240 seconds]
coniptor has joined #ruby
nate48423 has quit [Ping timeout: 240 seconds]
nate48423 has joined #ruby
drincruz has quit [Ping timeout: 264 seconds]
TCZ has joined #ruby
s_ has quit [Ping timeout: 260 seconds]
TCZ has quit [Client Quit]
s_ has joined #ruby
oddp has quit [Ping timeout: 264 seconds]
Emmanuel_ChanelW has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
imode has joined #ruby
ctOS has joined #ruby
ur5us has joined #ruby
coniptor has quit [Ping timeout: 240 seconds]
Emmanuel_Chanel has joined #ruby
s_ has quit [Ping timeout: 260 seconds]
s_ has joined #ruby
craig_000_ has quit [Remote host closed the connection]
craig_000_ has joined #ruby
chris__ has joined #ruby
s2013 has quit [Quit: Textual IRC Client: www.textualapp.com]
coniptor has joined #ruby
chris__ has quit [Ping timeout: 260 seconds]
imode has quit [Ping timeout: 246 seconds]
imode has joined #ruby
TvL2386_ has joined #ruby
TvL2386 has quit [Ping timeout: 256 seconds]
iNs has quit [Remote host closed the connection]
lmat has joined #ruby
<lmat> I have a <%= submit_tag 'Add New', class: 'btn btn-primary btn-block', id: 'add-document-btn' %> in a index.html.erb. What code is run when that submit is clicked?
BSaboia has joined #ruby
iNs has joined #ruby
gavlee has quit [Excess Flood]
gavlee has joined #ruby
<adam12> lmat: Depends on where the form action is pointed to.
dfucci has quit [Ping timeout: 258 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
<lmat> adam12: How do I tell that? At the bottom of that index.html.erb file, there is <%= render partial: 'form' %> . Surely that form doesn't matter because it's *below* the submit tag? So I suppose this index.html.erb is being rendered *within* some form...
dfucci has joined #ruby
<adam12> lmat: View the page source in your browser.
<lmat> Okay, verified there is no form surrounding the <input> :-/
<lmat> adam12: Yeah, just did :-)
<adam12> lmat: Ah interesting.
* lmat sigh
<adam12> lmat: Does it work? I didn't think input's could be floating (tho button's can)
BSaboia has joined #ruby
<adam12> lmat: It's possible this is a Javascript only button.
<lmat> adam12: Yes, it works. I guess the browser is being generous and interpreting the input in the context of the form even though the form is later.
<adam12> lmat: If you're familiar with Chrome DevTools, use Inspector to determine if anything is listening to Click.
<adam12> lmat: Or maybe grep for add-document-btn. The fact that it's an `id` makes me think it might have a listener attached to it.
howdoi has quit [Quit: Connection closed for inactivity]
<lmat> Okay.
<lmat> adam12: Good call! I found some .coffee js.
<adam12> lmat: fun :)
<adam12> Now just need some styles attached to the id, and an old version of Coffeescript which doesn't support sourcemaps, and we're living in 2010 again!
<lmat> \o/
<lmat> adam12: This <input> does something to another <input> (a file picker) that *is* inside the form.
<adam12> lmat: It's <input>'s all the way down. Yay webdev.
<lmat> How do I tell what code runs when the file picker inside this form: <%= form_for [@report, @document], remote: true do |f| %> is used?
<adam12> lmat: You'll need to find the Rails controller / action that it points to. See if anything sticks out in `rails routes` first.
<adam12> lmat: That's a polymorphic path (iirc?) and it doesn't have a name, so Rails is making up a name for it somehow. If you can see the actual path generated in the <form> element, could use that to narrow it down.
<adam12> It's probably reports_document_path or something.
<lmat> /reports/5728/documents
<lmat> Okay, I'll check the routing table.
<adam12> lmat: Routing table will say something like reports#documents or something.
<lmat> Yes, I think I see the entry: "resources :documents, only: [:index, :create, :update, :destroy]" inside resources :reports. A new document is being created. I added a def create in my document.rb model with a puts "howdy", but that logging statement never hit the logs.
<lmat> (I then tried def new but that didn't work either).
<lmat> I'm trying to set a value on the new document before it's getting saved :-)
<adam12> lmat: You'll want to use a callback for that (maybe; in some places it can be a smell). https://guides.rubyonrails.org/active_record_callbacks.html
<adam12> lmat: My guess is you won't be able to use `def create`. If it's SomeModel.create you're thinking of, that's a class method and you're overwriting an instance method. `def self.create(*args)` might have got you closer but bad idea with ActiveRecord. Stick to callbacks or modify the code that calls `create` inside your controller.
<lmat> adam12: "modify the code that calls `create' inside your controller." This sounds like a great idea, but I don't know where that happens :-/
<lmat> It would be in the report controller (not the document controller), right?
<adam12> lmat: DocumentsController#index (the index method in the DocumentsController) is my guess. Paste that block of your routes.rb somewhere so I can look but you said nested so that sounds right.
<adam12> lmat: if you look at the log of your `rails server` comand, it's likely in there as well.
braincrash has quit [Quit: bye bye]
<lmat> Processing by DocumentsController#create as JS
<lmat> OOOHHH controller, DUH
<lmat> I was looking at the model.
<adam12> Right. I forgot this is a form and it's a POST request. That looks correct.
<lmat> sweet.
braincrash has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
lightstalker has quit [Ping timeout: 265 seconds]
ChmEarl has quit [Quit: Leaving]
code_zombie has quit [Quit: Leaving]
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
Emmanuel_ChanelW has quit [Read error: Connection reset by peer]
lightstalker has joined #ruby
colins has quit [Ping timeout: 246 seconds]
zacts has joined #ruby
Garb0 has joined #ruby
cd has quit [Quit: cd]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 240 seconds]
BTRE has quit [Ping timeout: 258 seconds]
BTRE has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
tau has quit [Ping timeout: 240 seconds]
schne1der has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
mnathani has joined #ruby
<mnathani> How would I modify a date like "Feb 28 00:00:00 2020 GMT" to "2020-02-28 00:00:00 GMT"
<mnathani> Would like to be able to sort using that field in a spreadsheet
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
<wnd> I'm not sure if I got it right, but mayhaps you're looking for &ri Time#strftime (and possibly Time.strptime)
lightstalker has quit [Ping timeout: 240 seconds]
<havenwood> mnathani: "%Y-%m-%d %H:%M:%S %Z"
bocaneri has joined #ruby
<havenwood> &>> require 'time'; Time.parse("Feb 28 00:00:00 2020 GMT").utf.strftime("%Y-%m-%d %H:%M:%S %Z")
<rubydoc> stderr: -e:4:in `<main>': undefined method `utf' for 2020-02-28 00:00:00 +0000:Time (NoMethodError)... check link for more (https://carc.in/#/r/9cx8)
<havenwood> >.>
<havenwood> &>> require 'time'; Time.parse("Feb 28 00:00:00 2020 GMT").strftime("%Y-%m-%d %H:%M:%S %Z")
<rubydoc> # => "2020-02-28 00:00:00 UTC" (https://carc.in/#/r/9cx9)
jenrzzz has joined #ruby
<havenwood> mnathani: Can you use iso8601?
skx86 has quit [Quit: Connection closed for inactivity]
<havenwood> &>> require 'time'; Time.now.iso8601
<rubydoc> # => "2020-07-01T06:09:24+00:00" (https://carc.in/#/r/9cxa)
wymillerlinux has quit [Ping timeout: 260 seconds]
tau has left #ruby [#ruby]
venmx has joined #ruby
djdduty has joined #ruby
Industrial has joined #ruby
<Industrial> Hi!
<Industrial> So I have this gemfile right
<Industrial> and this script https://github.com/Industrial/ruby-test/blob/master/bin/runtime which runs "rerun `falcon serve --bind http://localhost:8080 --count 1 -c config.ru"`
djdduty has quit [Quit: Textual IRC Client: www.textualapp.com]
<Industrial> This starts to run, runs falcon and then I get the error
<Industrial> LoadError: cannot load such file -- rack
<Industrial> This is the first external depencency in https://github.com/Industrial/ruby-test/blob/master/src/fbp/runtime.rb
<Industrial> I did a `bundler` to install all the gems and even did a specific `gem install rack` and I still get that error. What now :S?
djdduty_ has joined #ruby
bradfordli123 has joined #ruby
<Industrial> I tried starting an irb and `require 'rack'` which works fine
djdduty_ has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
djdduty has joined #ruby
djdduty has quit [Changing host]
djdduty has joined #ruby
<mnathani> Thank you
infernix has quit [Ping timeout: 240 seconds]
<bradfordli123> Should private/protected methods be tested ? Ran across his blog about the pros and cons : https://mixandgo.com/learn/3-ways-of-testing-private-methods-in-rails
<Industrial> bradfordli123: test it if it makes you feel more secure that it will keep working that way in the future.
Uncle_Cid has joined #ruby
<bradfordli123> Industrial sounds like "its up to me" hahah
<bradfordli123> thanks =]
<Industrial> np.
<Industrial> Has anyone worked with Falcon? When I run my code with `rackup -o localhost -p 8080` then it runs fine. When I run it with `falcon serve --bind http://localhost:8080 --count 1 -c config.ru` then I get errors about all gems that I'm requiring (well, the first one and then it dies :p)
UncleCid has quit [Ping timeout: 256 seconds]
djdduty has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
djdduty has joined #ruby
djdduty has quit [Changing host]
djdduty has joined #ruby
xco has joined #ruby
Industrial has quit [Ping timeout: 260 seconds]
Industrial has joined #ruby
zacts has quit [Ping timeout: 272 seconds]
zacts has joined #ruby
apteryx is now known as Guest83291
Guest83291 has quit [Killed (weber.freenode.net (Nickname regained by services))]
BTRE has quit [Ping timeout: 260 seconds]
apteryx has joined #ruby
BTRE has joined #ruby
djdduty has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
djdduty has joined #ruby
infernix has joined #ruby
zacts has quit [Quit: WeeChat 2.8]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
cliluw has quit [Ping timeout: 246 seconds]
sarna has joined #ruby
x0n has quit [Ping timeout: 246 seconds]
x0n has joined #ruby
RiPuk has quit [Ping timeout: 240 seconds]
RiPuk has joined #ruby
Industrial has quit [Ping timeout: 260 seconds]
Industrial has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
RiPuk_ has joined #ruby
RiPuk has quit [Ping timeout: 264 seconds]
cliluw has joined #ruby
RiPuk_ has quit [Ping timeout: 240 seconds]
RiPuk has joined #ruby
jenrzzz has joined #ruby
ur5us has joined #ruby
jetchisel has joined #ruby
ur5us_ has joined #ruby
segy has quit [Excess Flood]
segy has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
ur5us_ has quit [Ping timeout: 265 seconds]
oddp has joined #ruby
mnathani has quit []
imode has quit [Ping timeout: 256 seconds]
mossplix has joined #ruby
bradfordli123 has quit [Remote host closed the connection]
G has quit [Quit: Foo]
G_ has joined #ruby
G_ is now known as G
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz_ has quit [Ping timeout: 246 seconds]
mossplix has quit [Ping timeout: 240 seconds]
akem has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charrit69 has joined #ruby
_whitelogger has joined #ruby
Garb0_ has joined #ruby
Garb0 has quit [Ping timeout: 265 seconds]
chris__ has joined #ruby
chris__ has quit [Ping timeout: 240 seconds]
guardianx has joined #ruby
TomyWork has joined #ruby
tau has quit [Quit: HAUHE]
mossplix has joined #ruby
s_ has quit [Ping timeout: 260 seconds]
s_ has joined #ruby
lightstalker has joined #ruby
mossplix has quit [Remote host closed the connection]
dfucci has joined #ruby
banisterfiend has joined #ruby
camilasan has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
camilasan has joined #ruby
MadLamb has joined #ruby
guardianx has quit [Read error: Connection reset by peer]
<MadLamb> I'm maintaining an old project that uses paperclip. I want to obtain the attachment url in the model. In the view it seems you can call a inexistent .url property when passing the attachment to the image_tag, but if I call that property directly on the model i get a "NoMethodError: undefined method `url..."
Jonopoly has joined #ruby
<jhass> compare the .class'es of where you can call url and where not
guardianx has joined #ruby
mossplix has joined #ruby
drincruz has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
guardianx has quit [Read error: Connection reset by peer]
guardianx has joined #ruby
braincrash has quit [Ping timeout: 260 seconds]
ErhardtMundt_ has joined #ruby
teclator_ has joined #ruby
ErhardtMundt has quit [Quit: No Ping reply in 180 seconds.]
rippa has quit [Ping timeout: 260 seconds]
olspookishmagus has quit [Ping timeout: 260 seconds]
olspookishmagus has joined #ruby
teclator has quit [Ping timeout: 260 seconds]
braincrash has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
guardianx has quit [Excess Flood]
RiPuk_ has joined #ruby
<MadLamb> jhass, where can I find that?
RiPuk has quit [Quit: ZNC 1.8.1 - https://znc.in]
PaulePanter has quit [Ping timeout: 260 seconds]
PaulePanter has joined #ruby
<jhass> where you call .url, call .class and output it in some way
burningserenity has joined #ruby
<jhass> log, p, binding.pry, whatever
akem has quit [Quit: Leaving]
endorama has joined #ruby
guardianx has joined #ruby
drincruz has quit [Ping timeout: 264 seconds]
guardianx has quit [Excess Flood]
guardianxx has joined #ruby
Scient has quit [Ping timeout: 260 seconds]
guardianxx has quit [Excess Flood]
Scient has joined #ruby
<MadLamb> jhass, I see
Arkantos has quit [Ping timeout: 260 seconds]
Arkantos_ has joined #ruby
olspookishmagus is now known as Guest90309
bmurt has joined #ruby
drincruz has joined #ruby
teclator_ is now known as teclator
<MadLamb> jhass, I did pp on .class, and it shows the Attachment model and it doesnt have any url method or property, but this is something I already knew. The question is that when you use it on the view with image_tag it behaves as there would be a method/property...
<MadLamb> and how to get the same behavior in the model
<jhass> so what's the class of whatever you pass to image_tag?
fanta1 has joined #ruby
oziyasin has joined #ruby
burningserenity has quit [Ping timeout: 246 seconds]
<MadLamb> jhass, the class is the ActiveRecord model
<jhass> what makes you say calling url works on it in the view then?
<MadLamb> jhass, I also checked this class, there is no method or propety url
<jhass> maybe that premise is wrong
<MadLamb> jhass, yeah that is what i want to know too
<MadLamb> jhass, some magic
<jhass> so what makes you assume it works by calling url?
<MadLamb> jhass, the class Project has this Attachment (which then is paperclip)
<MadLamb> jhass, because I see in the view it calls a method, I open the method and it calls project.attachment.url
<MadLamb> jhass, that is the parameter provided to image_tag
<jhass> that's all it does, no branching or so?
<MadLamb> jhass, inheritance?
<jhass> branching is if/else
<jhass> ternary
<jhass> case/when
<MadLamb> ah yes it does have it but in all the branches it calls .url
<jhass> but maybe not on the same thing?
<jhass> it's hard to debug this through IRC :P
troulouliou_dev has quit [Read error: Connection reset by peer]
troulouliou_dev has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.8]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
burningserenity has joined #ruby
banisterfiend has joined #ruby
skx86 has joined #ruby
charrit69 has quit [Ping timeout: 258 seconds]
TCZ has joined #ruby
Jonopoly has joined #ruby
TCZ has quit [Remote host closed the connection]
TCZ has joined #ruby
colins has joined #ruby
lypsis has quit [Quit: ZNC - https://znc.in]
lypsis has joined #ruby
ErhardtMundt_ has quit [Quit: No Ping reply in 180 seconds.]
rprimus has quit [Ping timeout: 246 seconds]
rprimus has joined #ruby
eldritch has quit [Ping timeout: 264 seconds]
ErhardtMundt has joined #ruby
eldritch has joined #ruby
Keltia has quit [Read error: Connection reset by peer]
Keltia has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
colins has quit [Ping timeout: 272 seconds]
guardianx has joined #ruby
colins has joined #ruby
orbyt_ has joined #ruby
TCZ has quit [Quit: Leaving]
nate48423 has quit [K-Lined]
guardianx has left #ruby ["Konversation terminated!"]
craig_000_ has quit [Ping timeout: 260 seconds]
nate48423 has joined #ruby
chalkmonster has joined #ruby
extrowerk has quit [Ping timeout: 264 seconds]
Industrial has quit [Ping timeout: 260 seconds]
eldritch has quit [Ping timeout: 246 seconds]
madhatter has quit [Remote host closed the connection]
madhatter has joined #ruby
extrowerk has joined #ruby
eldritch has joined #ruby
iNs_ has joined #ruby
iNs has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
Guest90309 has quit [Quit: All for nothing]
olspookishmagus has joined #ruby
BSaboia has joined #ruby
Industrial has joined #ruby
ChmEarl has joined #ruby
nate48423 has quit [Ping timeout: 260 seconds]
nate48423 has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
Industrial has quit [Ping timeout: 246 seconds]
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
alexherbo27 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo27 is now known as alexherbo2
nate48423 has quit [Ping timeout: 256 seconds]
nate48423 has joined #ruby
mniip has quit [Ping timeout: 606 seconds]
burningserenity has quit [Quit: Leaving.]
Jonopoly has quit [Quit: WeeChat 2.8]
mniip has joined #ruby
akem has joined #ruby
nate48423 has quit [Read error: Connection reset by peer]
nate48423 has joined #ruby
sarna has quit [Quit: Connection closed]
dionysus69 has joined #ruby
Industrial has joined #ruby
ellcs has joined #ruby
SeepingN has joined #ruby
Industrial has quit [Ping timeout: 260 seconds]
zacts has joined #ruby
<adam12> MadLamb: You probably can't call .url in a model because it requires a request to build the full URL.
<adam12> s/model/directly/
xco has joined #ruby
<adam12> MadLamb: Does .path work?
BSaboia has quit [Quit: This computer has gone to sleep]
TomyWork has quit [Remote host closed the connection]
chris__ has joined #ruby
tau has quit [Remote host closed the connection]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
TCZ has joined #ruby
chris__ has quit [Ping timeout: 256 seconds]
pgib has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 256 seconds]
zacts has quit [Quit: WeeChat 2.8]
zacts has joined #ruby
chalkmonster has joined #ruby
cadeskywalker has quit [Ping timeout: 240 seconds]
zacts has quit [Quit: WeeChat 2.8]
Garb0__ has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
Garb0_ has quit [Ping timeout: 246 seconds]
cadeskywalker has joined #ruby
nate48423 has quit [Ping timeout: 256 seconds]
nate48423 has joined #ruby
nate48423 has quit [Ping timeout: 246 seconds]
gnufied has joined #ruby
TCZ has quit [Quit: Leaving]
nate48423 has joined #ruby
fanta1 has quit [Quit: fanta1]
nate48423 has quit [Ping timeout: 246 seconds]
nate48423 has joined #ruby
BSaboia has joined #ruby
BSaboia has quit [Client Quit]
MrCrackPot has joined #ruby
nate48423 has quit [Ping timeout: 240 seconds]
BSaboia has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
BSaboia has quit [Client Quit]
nate48423 has joined #ruby
MrCrackPot has quit [Quit: Leaving]
nate48423 has quit [Ping timeout: 256 seconds]
vondruch_ has joined #ruby
nate48423 has joined #ruby
alfiemax has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
vondruch_ is now known as vondruch
Emmanuel_Chanel has joined #ruby
nate48423 has quit [Ping timeout: 264 seconds]
thebetra1 has quit [Ping timeout: 246 seconds]
mossplix has quit [Remote host closed the connection]
nate48423 has joined #ruby
axsuul has quit [*.net *.split]
pitastrudl has quit [*.net *.split]
DTZUZU has quit [*.net *.split]
andremedeiros has quit [*.net *.split]
sirecote_ has quit [*.net *.split]
michael_mbp has quit [*.net *.split]
llua has quit [*.net *.split]
mcspud has quit [*.net *.split]
shalok has quit [*.net *.split]
booboy has quit [*.net *.split]
thebetrayer has quit [*.net *.split]
umjisus has quit [*.net *.split]
thebetra1 has joined #ruby
mossplix has joined #ruby
umjisus has joined #ruby
pitastrudl has joined #ruby
llua has joined #ruby
DTZUZU has joined #ruby
xco has quit [Ping timeout: 246 seconds]
insolentworm has joined #ruby
shalok has joined #ruby
duderonomy has quit [Ping timeout: 246 seconds]
nate48423 has quit [Read error: Connection reset by peer]
andremedeiros has joined #ruby
booboy has joined #ruby
extrowerk has quit [Ping timeout: 246 seconds]
nate48423 has joined #ruby
extrowerk has joined #ruby
Frobozz_ has joined #ruby
mcspud has joined #ruby
Industrial has joined #ruby
Frobozz has quit [Ping timeout: 264 seconds]
duderonomy has joined #ruby
michael_mbp has joined #ruby
alfiemax has quit [Remote host closed the connection]
cadeskywalker has quit [*.net *.split]
kinduff has quit [*.net *.split]
ErhardtMundt has quit [*.net *.split]
lypsis has quit [*.net *.split]
teclator has quit [*.net *.split]
cliluw has quit [*.net *.split]
schne1der has quit [*.net *.split]
jinie has quit [*.net *.split]
nofxx has quit [*.net *.split]
Lyubo1 has quit [*.net *.split]
reaVer has quit [*.net *.split]
sagax has quit [*.net *.split]
clemens3 has quit [*.net *.split]
mozzarella has quit [*.net *.split]
ua has quit [*.net *.split]
quazimodo has quit [*.net *.split]
Xeago has quit [*.net *.split]
rubydoc has quit [*.net *.split]
sh7d has quit [*.net *.split]
hiroaki has quit [*.net *.split]
Eiam has quit [*.net *.split]
titanbiscuit has quit [*.net *.split]
stnly has quit [*.net *.split]
Rudd0 has quit [*.net *.split]
shortdudey123 has quit [*.net *.split]
electrostat has quit [*.net *.split]
Milos has quit [*.net *.split]
uplime has quit [*.net *.split]
dan64 has quit [*.net *.split]
insolentworm is now known as 17WABF10I
cadeskywalker has joined #ruby
ErhardtMundt has joined #ruby
sh7d has joined #ruby
sirecote has joined #ruby
axsuul has joined #ruby
schne1der has joined #ruby
ua has joined #ruby
reaVer has joined #ruby
sagax has joined #ruby
cliluw has joined #ruby
nofxx has joined #ruby
lypsis has joined #ruby
clemens3 has joined #ruby
teclator has joined #ruby
jinie has joined #ruby
rubydoc has joined #ruby
kinduff has joined #ruby
Lyubo1 has joined #ruby
quazimodo has joined #ruby
Xeago has joined #ruby
hiroaki has joined #ruby
titanbiscuit has joined #ruby
Eiam has joined #ruby
stnly has joined #ruby
uplime has joined #ruby
Rudd0 has joined #ruby
electrostat has joined #ruby
Milos has joined #ruby
dan64 has joined #ruby
shortdudey123 has joined #ruby
mozzarella has joined #ruby
Scient has quit [Ping timeout: 264 seconds]
Scient has joined #ruby
Rudd0 has quit [Max SendQ exceeded]
cliluw has quit [Remote host closed the connection]
Rudd0 has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
cliluw has joined #ruby
thebetra1 has quit [Ping timeout: 256 seconds]
thebetra1 has joined #ruby
drincruz has joined #ruby
stryek has joined #ruby
burningserenity has joined #ruby
chris__ has joined #ruby
burningserenity has quit [Ping timeout: 260 seconds]
nate48423 has quit [Ping timeout: 256 seconds]
nate48423 has joined #ruby
chris__ has quit [Ping timeout: 246 seconds]
Emmanuel_Chanel has joined #ruby
alfiemax has joined #ruby
bocaneri has quit [Remote host closed the connection]
alfiemax has quit [Remote host closed the connection]
lazarus1 has joined #ruby
colins has quit [Ping timeout: 256 seconds]
colins has joined #ruby
mossplix has quit [Remote host closed the connection]
Industrial has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
drincruz has joined #ruby
nate48423 has quit [Ping timeout: 244 seconds]
cd has joined #ruby
nate48423 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
gix has joined #ruby
nate48423 has quit [Ping timeout: 246 seconds]
chalkmonster has joined #ruby
nate48423 has joined #ruby
drincruz has quit [Ping timeout: 244 seconds]
GodFather has joined #ruby
drincruz has joined #ruby
alfiemax has joined #ruby
ursuta has joined #ruby
nate48423 has quit [Ping timeout: 246 seconds]
djdduty has left #ruby ["Textual IRC Client: www.textualapp.com"]
alfiemax has quit [Ping timeout: 256 seconds]
Secret-Fire has quit [Read error: Connection reset by peer]
nate48423 has joined #ruby
Benett- has joined #ruby
Secret-Fire has joined #ruby
leftylin1 has joined #ruby
nate48423 has quit [Ping timeout: 240 seconds]
tris- has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
prkn8[m] has quit [*.net *.split]
Benett has quit [*.net *.split]
tris has quit [*.net *.split]
leftylink has quit [*.net *.split]
Benett- is now known as Benett
tris- is now known as tris
nate48423 has joined #ruby
chris___ has joined #ruby
prkn8[m] has joined #ruby
nate48423 has quit [Ping timeout: 246 seconds]
imode has joined #ruby
nate48423 has joined #ruby
chris___ has quit [Ping timeout: 260 seconds]
ursuta has quit [Quit: Leaving]
Secret-Fire has quit [Read error: Connection reset by peer]
nate48423 has quit [Ping timeout: 246 seconds]
Secret-Fire has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
nate48423 has joined #ruby
ur5us_ has joined #ruby
nate48423 has quit [Ping timeout: 256 seconds]
nate48423 has joined #ruby
gitter1234 has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
schne1der has quit [Ping timeout: 240 seconds]
gitter1234 has quit []
BSaboia has joined #ruby
TCZ has joined #ruby
leah2 has quit [Ping timeout: 265 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
leah2 has joined #ruby
BSaboia has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
stdedos has joined #ruby
BSaboia has joined #ruby
BSaboia has quit [Client Quit]
nate48423 has quit [Ping timeout: 246 seconds]
nate48423 has joined #ruby
impermanence has joined #ruby
Axy has quit [Read error: Connection reset by peer]
BSaboia has joined #ruby
s_ has quit [Ping timeout: 260 seconds]
s_ has joined #ruby
BSaboia has quit [Ping timeout: 246 seconds]
chris__ has joined #ruby
mossplix has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BSaboia has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
<lmat> Is it common to feel like rails is sort of like black magic? I feel like nothing is discoverable in any of these frameworks. In order to know what's going on, you have already to know what's going on.
chris__ has quit [Ping timeout: 256 seconds]
wymillerlinux has joined #ruby
stdedos has quit [Quit: Connection closed]
TCZ has quit [Quit: Leaving]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
<apotheon> lmat: It is a bit like black magic.
<apotheon> lmat: My usual phrasing is "Rails is too full of magic, and Django is too full of thumbscrews."
<lmat> apotheon: It seems utterly undiscoverable. Is that a common reaction?
<apotheon> (because people seem to think "thumbscrew" is a fastening device on computers)
<apotheon> It happens sometimes.
<apotheon> That reaction, I mean.
<apotheon> It's not *abnormal*.
<lmat> apotheon: For instance, in C++, you look at the include files and read them until you see the definition of all functions and structs in scope. Definitions of functions are all *explicitly* given at linking stage. In Java, all classes are specified explicitly (with import statements, too) and *explicitly* specified in the compiler step. With rails, I add a line in some /config/* then "magically" I have extra
<lmat> functions available to me in all my controllers without "including" those new functions in any way.
<lmat> Maybe the best way to put it is: the "includes" (#include in C and C++, import in Java, using in C#, etc.) in rails are scattered all over the project and apply to some non-obvious set of classes and code files.
<lmat> So, to find the definition of any particular function is completely opaque.
nate48423 has quit [Ping timeout: 258 seconds]
<apotheon> There's kind of a hierarchy of files that include each other, and your source files (e.g. a model file) is included along with other stuff. That's why it works that way. The same could be done in pretty much any programming language that allows one file to include another.
<apotheon> If you want stuff that's part of Rails, read Rails documentation, which often includes links to source code.
<lmat> apotheon: Except in other languages, it's very obvious which files are being bundled together.
<apotheon> Look at a model and tell me how that, being bundled together with others by a different file, is supposed to make it obvious that something else is including it.
<lmat> apotheon: I think that's the confusing bit: in rails something *else* is including my model. In the other languages, *my* code is including everything it needs.
<apotheon> That's like saying that when you edit a header file you should then be able to tell what some other file is including along with the header file you just edited.
<apotheon> The reason Rails does it -- the reason for the magic -- is so that you don't need every single model, view, and controller file to have the same giant pile of inclusions in it.
<apotheon> It's a different way of doing things, and it just takes time and familiarity to get use to it.
<lmat> apotheon: Yup. And the "black magic" (opaque functionality) is the price we pay.
<apotheon> It has its downsides, of course. Every architectural choice in every framework in every language is full of trade-offs.
nate48423 has joined #ruby
<apotheon> I love both C and Ruby. I wouldn't say I love Rails, but it's very convenient sometimes.
<apotheon> I'm acutely aware of many trade-offs in part because I'm familiar with, and appreciate, both languages' ways of doing things.
ellcs has quit [Ping timeout: 260 seconds]
<apotheon> It actually took a *long* time for me to properly appreciate C, despite the fact I literally learned my first C about fifteen years before I learned my first Ruby, because the real elegance of C is basically ignored or hidden by everyone and everything that sets out to "teach" C.
<lmat> apotheon: "read Rails documentation" This is what I was talking about earlier, "In order to know what's going on, you have already to know what's going on." That is, when working on a new project, knowing where functions are defined or how they're made available is non-obvious. I think it's not good for maintenance. Piece of cake for new development, but I'm maintaining other code and it is FRUSTRATING.
<apotheon> A key to appreciating each, though, is to accept that things are done differently, and there will be growing pains.
<lmat> apotheon: I think I would have a good time writing a new application in rails.
<apotheon> There's a lot of stuff to help you look up stuff. There are method search interfaces online, for instance.
<lmat> Then I would be baking in my own black magic :-)
<apotheon> I can understand the frustration.
<apotheon> I just urge you to understand, in turn, that there are trade-offs, and it generally requires a bit of patience to learn to appreciate them.
<apotheon> It'll make your life less stressful and difficult, I think.
leftylin1 is now known as leftylink
<apotheon> lmat: What kind of method definition are you trying to find?
<apotheon> Is it something written by another dev on the application project?
<lmat> apotheon: Well it's always *something*. Right now I'm dealing with https://imgur.com/w5Imhr2.png
<lmat> A couple steps back... using rspec, setting up controller tests: I want to log in a user to start the test.
<lmat> require 'spec_helper'; require 'rspec/rails'; in rails_helper.rb.
<lmat> When I do it just like it says, I get https://imgur.com/uJ8PNEa.png because spec_helper uses Devise.
<lmat> When I rearrange to require 'rspec/rails'; require 'devise'; require 'spec_helper'; then I get the error I already posted: https://imgur.com/zE9xjZV.png
<lmat> I think I feel all the way across the wire how you feel reading through this stuff. You feel tired. You think "Oh man, I don't have time for this." I know you feel this way because I feel this way. TOO MUCH BLACK MAGIC.
<apotheon> I've gotta go. I'm waiting on a call to get a vehicle from the mechanic, I have company coming over in about an hour, and I'm not done with stuff I need to finish before both of those things.
<apotheon> Good luck.
<apotheon> Sorry.
<lmat> apotheon: No apology necessary. I hope your car is all fixed up and ready to go! And enjoy your company tonight! Later!
greengriminal has joined #ruby
cnsvc has quit [Quit: WeeChat 2.8]
bmurt has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
BSaboia has joined #ruby
<al2o3-cr> anyone have a good idea of how to stop freeing @work twice, my brain is fried lol
jenrzzz has joined #ruby
BSaboia has quit [Client Quit]
<al2o3-cr> ping me if anyone has an idea wtf i've done wrong :P
nate48423 has quit [Ping timeout: 240 seconds]
nate48423 has joined #ruby
quazimodo has quit [Ping timeout: 240 seconds]
<leftylink> al2o3-cr: may I ask dumb question. so comment says SEGV if digest called a second time - is that really because of being freed a second time? It looks like what's written there should work to make it not be freed twice. and instead that I would be concerned about @work being used in digest after it has been freed
<al2o3-cr> leftylink: got an idea how to go about this?
stryek has quit [Quit: Connection closed for inactivity]
BSaboia has joined #ruby
<al2o3-cr> i'll update the gist with the trace.
colins has quit [Quit: WeeChat 2.8]
<al2o3-cr> jeez christ now it just segfaults on the first call to digest :(
nate48423 has quit [Ping timeout: 240 seconds]
nate48423 has joined #ruby
<al2o3-cr> gist updated
<al2o3-cr> wtf Segmentation fault at 0x0000000000000000 how???
<al2o3-cr> a null pointer
<al2o3-cr> i give up for today.
<al2o3-cr> hold up, i see it... i think.
<al2o3-cr> i'm initializing @work with the default value of @blocks in the initialize method, but then, if i change @blocks in the block e.g tuning.blocks = 350_000 it won't have enough memory for the calculation because it's already been allocated 100_000
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr> move @work into #digest
<al2o3-cr> or set it after the yield ??
tau has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
<al2o3-cr> ffs i was passing blocks and iterations the wrong way round. blocks should be 350_000 and iterations should be 7 der. right that's that solved, back to the original question.
<al2o3-cr> leftylink: i've updated the gist with a second trace to show that calling digest a second time seg faults.
<al2o3-cr> it's exactly 16 bytes difference so it's definitely @work being freed a second time, i'm pretty sure.
<al2o3-cr> leftylink: what did you mean when you said "and instead that I would be concerned about @work being used in digest after it has been freed"
<leftylink> line 155 and 152, right?
<al2o3-cr> leftylink: yes.