havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.0, 2.6.5, 2.5.7: 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!
davidw has quit [Ping timeout: 268 seconds]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
cnsvc has quit [Quit: WeeChat 2.7]
cnsvc has joined #ruby
heth has joined #ruby
davispuh has joined #ruby
Seich has quit [Quit: Gone fishing.]
Seich has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
zdm has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
lineus has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #ruby
Ven`` has quit [Client Quit]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mossplix has quit [Ping timeout: 260 seconds]
s2013 has joined #ruby
jenrzzz has joined #ruby
davidw has joined #ruby
lineus has joined #ruby
sergioro has joined #ruby
Swyper has joined #ruby
DaRock has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
DaRock has joined #ruby
NODE has joined #ruby
lineus has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lineus has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
sgen has joined #ruby
hutch has joined #ruby
Seich has quit [Quit: Gone fishing.]
reyfi9e has joined #ruby
Seich has joined #ruby
GodFather has quit [Ping timeout: 265 seconds]
fercell has joined #ruby
alex`` has quit [Ping timeout: 268 seconds]
mozzarella has quit [Quit: WeeChat 2.4]
davidw has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
sergioro has quit [Quit: leaving]
evert has quit [Read error: Connection reset by peer]
evert_ has joined #ruby
fercell has quit [Ping timeout: 272 seconds]
fercell has joined #ruby
NODE has quit [Quit: changing servers]
_Tristan_ has quit [Quit: -= A click to real life biatches!!! =-]
Tristan has joined #ruby
mozzarella has joined #ruby
NODE has joined #ruby
Tristan is now known as Guest3521
fphilipe has joined #ruby
wildtrees has quit [Quit: Leaving]
fphilipe has quit [Ping timeout: 268 seconds]
antimatroid has joined #ruby
<antimatroid> does ruby have an interpreter? when I just run 'ruby' on ubuntu it stops giving a command prompt like it might, but 'puts "hello"' for example does nothing
<mozzarella> you mean a repl? there's irb by default
<antimatroid> like with python if you enter 'python' in the command line it comes up with an interpreter you can pass commands in to and get output from
<mozzarella> yeah you're looking for irb
lucasb has quit [Quit: Connection closed for inactivity]
<antimatroid> perfect, ta
MrCrackPot has joined #ruby
<havenwood> antimatroid: Or consider the Pry gem, which is another popular REPL that doesn't ship with Ruby.
<havenwood> antimatroid: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<havenwood> antimatroid: You can also run a one-off script with: ruby -e "puts 'example'"
<antimatroid> cheers
pwnd_nsfw has quit [Ping timeout: 265 seconds]
<antimatroid> I will make those suggestions to any users I get
<havenwood> antimatroid: If you're not using gems, startup time is greatly reduced with the --disable=all flag.
MrCrackPot has quit [Client Quit]
<havenwood> antimatroid: ruby -e "puts 'hi'" --disable=all
<antimatroid> I am going to add in a way to feed io back and forth to processes with that site generator I was on here talking about yesterday
<antimatroid> should be easy enough with pstreams
<gitter1234> Is Minitest+Capybara the preferred way to test ones Rails apps?
<gitter1234> Or is it RSpec+Capybara?
<gitter1234> I just finished my app :D Gonna add testing to my todo-list, just curious which combo I have to look forward to
<havenwood> gitter1234: Either!
<gitter1234> Cool, Minitest/RSpec+Capybara it is!
<havenwood> gitter1234: My 2¢:
<havenwood> rack/test + minitest/capybara + webdrivers/geckodriver
bruce_lee has quit [Ping timeout: 265 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
<havenwood> gitter1234: nvm about minitest/capybara... "This gem is no longer maintained as Capybara has added Minitest support upstream, use that instead."
<havenwood> perfect
<gitter1234> hmmm
<havenwood> that was in 2018... and I've used Capybara without the gem since then... I was just living in the past for a sec
<gitter1234> hehe
<havenwood> rack/test is great https://github.com/rack-test/rack-test
<gitter1234> This is all new ground for me, but does this look ok?
<gitter1234> ## Todo
<gitter1234> how about just
<gitter1234> - [Testing framework](https://guides.rubyonrails.org/testing.html)
<gitter1234> no idea what is what, ill deal with it once i get there :D ive barely written a controller let alone a test
<havenwood> gitter1234: those are nice tools. i've had fairly smooth sailing, other than initial configuration being a pain, especially with headless browsers.
<havenwood> gitter1234: please ask here if you get stuck or want feedback. many ways to test!
<gitter1234> oh for sure, thanks havenwood!
anveo has quit [Quit: Textual IRC Client: www.textualapp.com]
pwnd_nsfw has joined #ruby
pwnd_nsfw has quit [Ping timeout: 240 seconds]
<gitter1234> I just translated my app into `config/locales/` with `en.yml`, `devise.en.yml`, `XX.yml` and `devise.XX.yml`. In application.rb I put `config.i18n.default_locale = :XX`.
<gitter1234> Now when I try to load my app I get `I18n::InvalidLocaleData in Devise::Registrations#new: can not load translations from devise.en.yml` regarding `t(:sign_up)` -- because `sign_up` is in `en.yml` not `devise.en.yml`.
<gitter1234> Why isn't Rails looking through `en.yml`, and also, why isn't it choosing `XX` instead of `en` as specified in application.rb?
antimatroid has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
houhoulis has quit [Remote host closed the connection]
<gitter1234> haha
<gitter1234> https://github.com/ruby-i18n/i18n/issues/64 -- "http://yaml.org/spec/1.1/current.html#id864510. In YAML format boolean true/false might be written as yes/no, so until your "no" is not escaped it's taken as boolean false. And probably it's the reason why norwegian was named as nn :)"
<adam12> gitter1234: I normally use Minitest+Capybara but lately I've been using RSpec+Capybara. For Javascript tests I add Cuprite which drives Chrome directly through the websocket.
<adam12> gitter1234: Since you're on Rails you could probably stick with Minitest since Rails has decent test runner they ship with now.
<gitter1234> I see, so RSpec is more all over the place whereas Minitest is Rails-specific. Great, can't wait!
<adam12> gitter1234: Minitest is more of a tool in a toolbox. It ships with enough to do work but you sometimes need a bit more (Mocha for mock/stub, minitest-sprint for runner, minitest-reporter for more test output, minitest-hooks for hooks, etc).
<adam12> gitter1234: RSpec ships with all that built in; so if you don't need it then maybe it's wasteful? But if you do it's there. So it's about choosing the right tool for the job :) and what makes you happy.
<adam12> gitter1234: But more importantly is just writing tests :) go get em. I'm out.
<gitter1234> Seen :)
<gitter1234> Later man!
<gitter1234> Doesn't get more happier than this though. App done after months of hard work. Go get em!
<gitter1234> Or go get her
<gitter1234> Go git her
<gitter1234> Gitter :D
* gitter1234 outie
chalkmonster has quit [Quit: WeeChat 2.7]
chalkmonster has joined #ruby
fphilipe has joined #ruby
fphilipe has quit [Ping timeout: 246 seconds]
Swyper has quit [Remote host closed the connection]
BTRE has quit [Remote host closed the connection]
braincrash has quit [Quit: bye bye]
gix- has joined #ruby
gix has quit [Disconnected by services]
braincrash has joined #ruby
groks is now known as xorl
jacksoow has left #ruby ["Saindo.."]
zdm has quit [Ping timeout: 268 seconds]
tricon has quit [Remote host closed the connection]
Azure|dc has joined #ruby
Azure has quit [Ping timeout: 260 seconds]
sergioro has joined #ruby
cd has quit [Quit: cd]
sgen has quit [Ping timeout: 260 seconds]
ttoocs has joined #ruby
tpanarch1st has joined #ruby
donofrio has quit [Remote host closed the connection]
cthulchu_ has quit [Ping timeout: 268 seconds]
cthulchu_ has joined #ruby
gix- has quit [Ping timeout: 240 seconds]
fercell has quit [Quit: WeeChat 2.7]
mossplix has joined #ruby
claw has quit [Ping timeout: 252 seconds]
mossplix has quit [Ping timeout: 265 seconds]
r3m has quit [Quit: WeeChat 2.8-dev]
r3m has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
s2013 has joined #ruby
mossplix has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BTRE has joined #ruby
juria_roberts has joined #ruby
<juria_roberts> Whats the difference between dot and square brackets in ruby?
<baweaver> Depends on the context
<baweaver> Technically square brackets are a method
<baweaver> &>> [1, 2, 3].[](2)
<rubydoc> # => 3 (https://carc.in/#/r/8g8e)
<baweaver> but depending on the class square brackets could do lots of things
<juria_roberts> I mean something like hash['id'] versus hash.id
<baweaver> &>> { like_strings: 'something'[1..3], or_procs: -> a { a + 1 }[2], or_arrays: [1, 2, 3][1], or_hashes: { a: 1 }[:a] }
<rubydoc> # => {:like_strings=>"ome", :or_procs=>3, :or_arrays=>2, :or_hashes=>1} (https://carc.in/#/r/8g8f)
VoidVextor0 has joined #ruby
<baweaver> The first gets the key id, the second gets the id of the object
<daed> yeah that's the ruby object ID, not the contents of the string 'id' key within
<baweaver> &>> a = { 'id' => 1 }; { hash_key: a['id'], object_id: a.id }
<rubydoc> stderr: -e:4:in `<main>': undefined method `id' for {"id"=>1}:Hash (NoMethodError)... check link for more (https://carc.in/#/r/8g8g)
* baweaver runs off to find docs
pandorian has quit [Ping timeout: 268 seconds]
<baweaver> &>> a = { 'id' => 1 }; { hash_key: a['id'], object_id: a.object_id }
<rubydoc> # => {:hash_key=>1, :object_id=>60} (https://carc.in/#/r/8g8h)
<daed> figured that's what it was
<baweaver> So there is no id method
<baweaver> Heh, my instinct was right on naming the example key
<baweaver> In Rails it lets those two mix to an extent
<baweaver> Which is kinda like Javascript objects, sure, but I would not assume that behavior elsewhere
<daed> juria_roberts: when in doubt, you can always type "a = {}; a.methods.sort" to get a list of methods available on a default hash
<baweaver> Mostly because there are all types of collisions and other broken things trying to get them to do that.
<daed> or just Hash.methods.sort probably
<baweaver> There was a RubyConf talk in 2018 on that iirc
<daed> wait maybe not, one is an instantiated one with more methods
<daed> forgot << self vs instantiated
sauvin has joined #ruby
<juria_roberts> Thanks baweaver and daed
<baweaver> bingo
fphilipe has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
kent\n has quit [Quit: Quitting]
kent\n has joined #ruby
pandorian has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
VoidVextor0 has quit [Ping timeout: 268 seconds]
mossplix has quit [Ping timeout: 268 seconds]
VoidVextor0 has joined #ruby
pandorian has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
fercell has joined #ruby
helpa-bot has joined #ruby
helpa has quit [Remote host closed the connection]
suukim has joined #ruby
helpa-bot has quit [Remote host closed the connection]
helpa has joined #ruby
pandakekok9 has joined #ruby
duderonomy has joined #ruby
cthulchu_ has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Quit: WeeChat 2.7]
fphilipe has quit [Ping timeout: 246 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
darkstardevx has joined #ruby
tricon has joined #ruby
pandakekok9 has quit [Ping timeout: 240 seconds]
tricon has quit [Client Quit]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pandakekok9 has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sliddjur has joined #ruby
TomyWork has joined #ruby
fphilipe has joined #ruby
sliddjur has quit [Remote host closed the connection]
conta has joined #ruby
mossplix has joined #ruby
mossplix has quit [Ping timeout: 272 seconds]
schne1der has joined #ruby
VoidVextor0 has quit [Ping timeout: 260 seconds]
<bukkitgerman> Hey, how would i go about turning a DateTime into a pretty string relative to the current time - e.g. "2020-01-24T09:33:21+01:00" to "5 minutes ago"?
sergioro has quit [Quit: leaving]
pandorian has joined #ruby
clemens3 has joined #ruby
Yuyu06 has quit [Quit: The Lounge - https://thelounge.chat]
Yuyu04 has joined #ruby
Yuyu04 has quit [Client Quit]
akemhp has quit [Ping timeout: 265 seconds]
juria_roberts has quit [Remote host closed the connection]
bruce_lee has quit [Ping timeout: 268 seconds]
bruce_lee has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
william1_ has joined #ruby
<Cork> bukkitgerman: you want duration
<Cork> it is also part of activesupport from rails
AJA4350 has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
<bukkitgerman> Cork: ty!
vondruch has quit [Quit: vondruch]
william1_ has quit [Ping timeout: 268 seconds]
conta has quit [Ping timeout: 265 seconds]
tpanarch1st has quit [Ping timeout: 255 seconds]
claw has joined #ruby
weeirc8089 has joined #ruby
pwnd_nsfw has joined #ruby
phaul_ has joined #ruby
VoidVextor0 has joined #ruby
pandorian has quit [Ping timeout: 265 seconds]
zlogan2003 has quit [Ping timeout: 246 seconds]
gorsuch has quit []
gorsuch has joined #ruby
fowlduck has quit []
darkstardevx has quit [Ping timeout: 240 seconds]
fowlduck has joined #ruby
timeless has quit []
timeless has joined #ruby
pandakekok9 has quit [Ping timeout: 240 seconds]
pandakek1k9 has joined #ruby
donofrio has joined #ruby
pandakekok9 has joined #ruby
Mutsuhito has quit []
pandakek1k9 has quit [Ping timeout: 240 seconds]
Mutsuhito has joined #ruby
i9zO5AP has quit [Ping timeout: 268 seconds]
d3bug has quit [Quit: Connection closed for inactivity]
mattwc has quit []
mattwc has joined #ruby
gitter1234 has joined #ruby
pwnd_nsfw` has joined #ruby
pwnd_nsfw has quit [Ping timeout: 268 seconds]
darkstardevx has joined #ruby
zlogan2003 has joined #ruby
_phaul has joined #ruby
phaul has quit [Ping timeout: 268 seconds]
fphilipe has joined #ruby
darthThorik has quit []
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
darthThorik has joined #ruby
pandakekok9 has quit [Ping timeout: 240 seconds]
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 265 seconds]
pandakekok9 has joined #ruby
pwnd_nsfw` has joined #ruby
ropeney has joined #ruby
pwnd_nsfw has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
zipkid has quit []
zipkid has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
vondruch has joined #ruby
alex`` has joined #ruby
gmcintire has quit []
gmcintire has joined #ruby
weeirc8089 has quit [Quit: WeeChat 2.7]
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
zdm has joined #ruby
lucasb has joined #ruby
conta1 has joined #ruby
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
pandakekok9 has quit [Ping timeout: 240 seconds]
pandakekok9 has joined #ruby
akemhp has joined #ruby
<KrzaQ> Is there a method in ruby to compare strings in terms of language collation? I'd like ł to be between l and m in Polish, or ü between u and v in German
pandakekok9 has quit [Remote host closed the connection]
phaul_ has quit [Ping timeout: 272 seconds]
<Cork> KrzaQ: don't think so, that would require uniconde glyph language lists
<Cork> if you change encoding to one "local" for the said language it might do what you want donno
phaul_ has joined #ruby
RiPuk has joined #ruby
RiPuk_ has quit [Ping timeout: 268 seconds]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
phaul_ has quit [Ping timeout: 240 seconds]
<havenwood> KrzaQ: If you happen to be using Rails: I18n.transliterate('ł') #=> "l"
suukim has quit [Quit: Konversation terminated!]
<havenwood> There are a variety of gems.
Jonopoly has joined #ruby
<Cork> havenwood: how would that help with sorting?
<havenwood> Cork: is the task not to separate the letter from its mark?
<havenwood> Cork: then you can sort it?
mossplix has quit [Ping timeout: 268 seconds]
ropeney has joined #ruby
<Cork> havenwood: i _think_ he is trying to get string sorting to sort it "the right way", but only guessing
phaul_ has joined #ruby
<havenwood> Cork: it seems the "right way" is entirely language specific, unless one just means letters with marks go after the corresponding letter.
<Cork> yup, that is my take on it too
<havenwood> Cork: Ah, I didn't actually read the question. That helps.
<havenwood> KrzaQ wants a language-specific solution, so never mind me.
fercell has quit [Quit: WeeChat 2.7]
dinfuehr has quit [Ping timeout: 265 seconds]
dinfuehr has joined #ruby
fphilipe has quit [Ping timeout: 260 seconds]
<havenwood> KrzaQ: I've not used this gem, but it does locale-sensitive collation: https://github.com/fantasticfears/ffi-icu#locale-sensitive-collation.
mossplix has joined #ruby
<havenwood> ruby -rffi-icu -e "p ICU::Collation.collate('pl', %w[ł m l])"
<havenwood> #>> ["l", "ł", "m"]
<havenwood> KrzaQ: ^
<KrzaQ> havenwood: yeah, I do want lz to come before ła
<KrzaQ> havenwood: this is exactly what I wanted, thanks!
mossplix has quit [Ping timeout: 272 seconds]
<havenwood> KrzaQ: you're welcome
darkf has quit []
darkf has joined #ruby
conta1 has quit [Quit: conta1]
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
fphilipe has joined #ruby
ndodd2 has joined #ruby
bsdbandit-01 has joined #ruby
TomyWork has quit [Read error: Connection reset by peer]
ndodd2 has quit [Quit: Leaving]
cd has joined #ruby
teej has quit []
teej has joined #ruby
fercell has joined #ruby
vondruch has quit [Quit: vondruch]
zlogan2003 has quit [Remote host closed the connection]
zlogan2003 has joined #ruby
jcalla has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
pwnd_nsfw has joined #ruby
vondruch has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 265 seconds]
fig-le-deunch has joined #ruby
fig-le-deunch has quit [Read error: Connection reset by peer]
fig-le-deunch has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
fig-le-deunch has quit [Ping timeout: 260 seconds]
fig-le-deunch has joined #ruby
john2496 has joined #ruby
tweaks has quit [Ping timeout: 272 seconds]
Swyper has joined #ruby
ellcs has joined #ruby
vondruch has quit [Quit: vondruch]
TorpedoSkyline has joined #ruby
duderonomy has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
duderonomy has quit [Ping timeout: 268 seconds]
fig-le-deunch has quit [Ping timeout: 265 seconds]
bsdbandit-01 has quit [Ping timeout: 240 seconds]
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has joined #ruby
TorpedoSkyline has joined #ruby
MentalPower has quit []
MentalPower has joined #ruby
Elundia has joined #ruby
Elundia has quit [Remote host closed the connection]
zarubin has joined #ruby
zarubin has quit [Client Quit]
zarubin has joined #ruby
zarubin has quit [Client Quit]
pwnd_nsfw` has joined #ruby
pwnd_nsfw has quit [Ping timeout: 272 seconds]
millerti has quit [Ping timeout: 268 seconds]
DaRock has quit [Ping timeout: 265 seconds]
teej has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
Jonopoly has quit [Quit: WeeChat 2.5]
dionysus69 has quit [Quit: dionysus69]
pitastrudl has quit []
pitastrudl has joined #ruby
dionysus69 has joined #ruby
TorpedoSkyline has joined #ruby
phaul__ has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
phaul_ has quit [Ping timeout: 265 seconds]
Exuma has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
<gitter1234> Hi! Silly question, I'm trying to create a link to `post_url(post)` with the text `post.comments.count` and `t :comments`.
<gitter1234> Here's without the link: `<span><%= post.comments.count %> <%= t :comments %></span>`
<gitter1234> And here's my failed attempt: `<span><%= link_to(post.comments.count + t(:comments)), post_url(post) %></span>`
<gitter1234> Last question I promise!
fig-le-deunch has joined #ruby
<gitter1234> Do I have to do some intricate interpolation here or something?
davidw has joined #ruby
<QuakePhil> didnt see a question mark anywhere there...
<QuakePhil> oh sorry, yeah, you do
<adam12> gitter1234: Is it complaining about no explicit conversion to string?
<gitter1234> Sorry, `<span class="tag"><%= link_to(post.comments.count + t(:comments), post_url(post)) %></span>`
<gitter1234> adam12: Yep
<gitter1234> Hey
<adam12> gitter1234: post.comments.count.to_s
<adam12> gitter1234: There's other ways but that will unblock you the quickest.
<adam12> gitter1234: Also look at the pluralize helper.
<gitter1234> Bless!
<gitter1234> Will do
<adam12> gitter1234: the reason <%= post.comments.count %> works is internally ERB adds .to_s to everything.
fercell has quit [Quit: WeeChat 2.7]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
<gitter1234> I really need to learn about strings and objects. I appreciate y'all being patient and putting up with my stupidity :)
<gitter1234> One day I'll pass this knowledge on to some other helpless fool
<gitter1234> Ended up with: `<%= link_to(post.comments.count.to_s + " " + t(:comments), post_url(post)) %>`
<adam12> gitter1234: Learning Ruby while learning Rails is probably something a lot of us did way back in the day (I know I did). So provided you do your own due diligence first, before resorting to asking here, everyone is probably fine with it.
* gitter1234 nods
greengriminal has joined #ruby
<adam12> Why else would we idle here :)
<gitter1234> :D
Exuma has quit [Quit: Textual IRC Client: www.textualapp.com]
<gitter1234> Gonna PM you the screenshots in a bit, its starting to look real good
<gitter1234> Cya in a bit
fig-le-deunch has quit [Ping timeout: 265 seconds]
fig-le-deunch has joined #ruby
TorpedoSkyline has quit [Ping timeout: 265 seconds]
mossplix has quit [Ping timeout: 268 seconds]
Exuma has joined #ruby
TorpedoSkyline has joined #ruby
<TorpedoSkyline> How does something like ActiveRecord dynamically create properties for a child object based off of a table's columns?
<TorpedoSkyline> I'm doing something similar. I have an object called Person that's inheriting from a SalesforceModel object. I want to be able to call person.name and have that property because the data store has a 'name' property, but I don't want to have to define each property on each object. I want it to be dynamic
<adam12> TorpedoSkyline: method_missing or delegators.
<TorpedoSkyline> I thought it might have been method_missing, but I'll look into delegators as well
<TorpedoSkyline> Is one preferred over the other?
<adam12> TorpedoSkyline: Prefer delegators if you can. They are a bit more explicit.
sergioro has joined #ruby
<adam12> TorpedoSkyline: Method missing has it's uses but is sometimes overused. And it adds a bit of indirection.
<adam12> TorpedoSkyline: If you know ahead of time which methods you want, definitely delegate.
<TorpedoSkyline> adam12, so I won't necessarily know. The Salesforce data could have any number of properties
<adam12> TorpedoSkyline: You likely want method missing then.
<TorpedoSkyline> I used the delegation pattern a decent amount in iOS so if it works the same way I'll probably have to go with method_missing
<TorpedoSkyline> adam12, thanks so much for pointing me in the right direction!
<adam12> TorpedoSkyline: Let's back up one second.
<adam12> TorpedoSkyline: What's role does Person have? Does it just look like class Person < SalesForceModel::Person or something?
<TorpedoSkyline> adam12: it looks like Person < SalesforceModel
<TorpedoSkyline> we could also have Animal < SalesforceModel
<adam12> TorpedoSkyline: Ah. How do you know which model you're talking to?
mossplix has joined #ruby
<adam12> (on the salesforce side)
pilcrow has quit []
<jhass> I like to use SimpleDelegator for simple delegators
pilcrow has joined #ruby
<TorpedoSkyline> So I have a method called object_name that the parent class also has but doesn't have an implementation for that returns a string
<gitter1234> * on to some other equally helpless fool
<TorpedoSkyline> that string will be the object name on the SF side. So Person will have a object_name of "Person__c". Salesforce is weird that way
* gitter1234 out
Exuma has quit [Quit: Textual IRC Client: www.textualapp.com]
cthulchu_ has joined #ruby
<adam12> TorpedoSkyline: Ah OK. I think your best bet might still be method_missing, but definitely check out the delegator options.
<jhass> doesn't AR query the DB on inherited does a bunch of define_method's?
fig-le-deunch has quit [Quit: Konversation terminated!]
<jhass> *and does
<adam12> jhass: It probably does now. I don't know if it always did.
<TorpedoSkyline> oh I didn't know define_methods was a thing. That might be another option
<adam12> You can define methods on the fly but don't forget Ruby has a method cache per class, and calling define_method will bust that method cache. It can be expensive.
<adam12> If you do go the method_missing route, don't forget to define respond_to_missing? as well.
<jhass> yes it's something that you want to happen at application load time, not at application runtime
<TorpedoSkyline> Ahh. Interesting.
<TorpedoSkyline> I'll look into them both. Thanks adam12 and jhass.
s2013 has joined #ruby
phaul__ has quit [Ping timeout: 240 seconds]
s2013 has quit [Client Quit]
Swyper has quit [Remote host closed the connection]
duderonomy has joined #ruby
bvdw has quit [Quit: bvdw]
duderonomy has quit [Client Quit]
Swyper has joined #ruby
bvdw has joined #ruby
fercell has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
lxsameer has quit [Quit: out]
Swyper has quit [Ping timeout: 268 seconds]
gix has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
phaul__ has joined #ruby
d3bug has joined #ruby
howdoi has joined #ruby
Ven`` has joined #ruby
tpanarch1st has joined #ruby
fercell has quit [Quit: WeeChat 2.7]
phaul__ has quit [Ping timeout: 265 seconds]
phaul__ has joined #ruby
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fercell has joined #ruby
mossplix has quit [Remote host closed the connection]
s2013 has joined #ruby
mossplix has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
clemens3 has quit [Quit: WeeChat 2.1]
akemhp has quit [Quit: Leaving]
TorpedoSkyline has joined #ruby
phaul__ has quit [Ping timeout: 260 seconds]
akemhp has joined #ruby
sagax has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
rippa has joined #ruby
wildtrees has joined #ruby
wallace_mu has joined #ruby
sergioro has quit [Quit: leaving]
dinfuehr has quit [Ping timeout: 240 seconds]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
dinfuehr has joined #ruby
Swyper has joined #ruby
i9zO5AP has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
zdm has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 272 seconds]
<TorpedoSkyline> Hey folks, is there any way I can access instance variables and instance methods from a subclass within a parent's inherited method? Basically something like this https://ghostbin.co/paste/736p2
<TorpedoSkyline> As of right now, the instance variables return nil
mossplix has joined #ruby
i9zO5AP has quit [Ping timeout: 272 seconds]
cthulchu_ has quit [Read error: Connection reset by peer]
cthulchu_ has joined #ruby
dinfuehr has joined #ruby
ooheitooh has quit [Read error: Connection reset by peer]
<adam12> TorpedoSkyline: Yes, but your @name in the subclass is a class variable.
<adam12> TorpedoSkyline: you'd probably want def initialize; @name = "Bill"; end. Or something that sets it in the instance.
ooheitooh has joined #ruby
<TorpedoSkyline> adam12, yes I realized my mistake. Here's the updated code https://ghostbin.co/paste/fjk52
<TorpedoSkyline> I get NoMethodError (undefined method `nickname' for Child:Class)
<adam12> TorpedoSkyline: You shouldn't need subclass when you call nickname.
dinfuehr has quit [Ping timeout: 240 seconds]
<adam12> TorpedoSkyline: just "#{nickname} Peterso" should do fine.
dinfuehr has joined #ruby
<adam12> TorpedoSkyline: When you use define_method, you're creating a closure. It carries internal state of the scope it was defined from, but then it's bound to where it's defined so it has access to state there too.
<adam12> TorpedoSkyline: I'm not super familiar with the actual internals of that so I might have butchered it slightly.
<TorpedoSkyline> adam12, thanks! I'm working on it now to see if I can get it to work
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zdm has joined #ruby
TorpedoSkyline has joined #ruby
<TorpedoSkyline> adam12, I'm going to try and implement this once I finish this meeting. Thanks for your help!
TorpedoSkyline has quit [Client Quit]
troulouliou_dev has joined #ruby
fphilipe has quit [Ping timeout: 272 seconds]
phaul__ has joined #ruby
nowhereman_ has joined #ruby
phaul__ has quit [Ping timeout: 265 seconds]
orbyt_ has joined #ruby
TorpedoSkyline has joined #ruby
<greengriminal> Does anyone here have experience with working with Kinesis + Ruby.
<greengriminal> For context, I've set up a AWS Kinesis client: https://docs.aws.amazon.com/sdkforruby/api/Aws/Kinesis/Client.html but I'm looking for a little direction on how to set up a consumer.
<greengriminal> Was hoping that someone here would have some insight.
Ai9zO5AP has joined #ruby
zdm has quit [Remote host closed the connection]
zdm has joined #ruby
fphilipe has joined #ruby
zdm has quit [Remote host closed the connection]
zdm has joined #ruby
tpanarch1st has quit [Ping timeout: 255 seconds]
alex`` has quit [Ping timeout: 268 seconds]
alex`` has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
zlogan85 has joined #ruby
zlogan2003 has quit [Remote host closed the connection]
nowhereman_ has quit [Ping timeout: 268 seconds]
schne1der has joined #ruby
lxsameer has joined #ruby
sagax has joined #ruby
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yoshie902a has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
<havenwood> yoshie902a: I like to commit with: git add -p
phaul__ has joined #ruby
<yoshie902a> what’s -p?
zlogan85 has quit [Read error: Connection reset by peer]
<havenwood> yoshie902a: --patch
<havenwood> yoshie902a: "Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index."
<havenwood> yoshie902a: Give it a try!
zlogan85 has joined #ruby
<havenwood> yoshie902a: It doesn't add anything before your review.
<yoshie902a> how does that revert the file?
<havenwood> yoshie902a: Ahh, I think I totally misunderstood your question.
<havenwood> yoshie902a: Can you just reset that file?
<yoshie902a> I tried that, did not work. But did find the solution. I had to do git reset file, then git restore file
<yoshie902a> not sure why
<havenwood> yoshie902a: reset then checkout?
<yoshie902a> havenwood: Thank you, I think that would work too
<havenwood> yoshie902a: np
<yoshie902a> I think the key was reseting the file first. Why is that needed?
phaul__ has quit [Ping timeout: 268 seconds]
<havenwood> yoshie902a: it updates the stage. see: https://marklodato.github.io/visual-git-guide/index-en.html#reset
<havenwood> git ¯\_(ツ)_/¯
zlogan85 has quit [Ping timeout: 246 seconds]
<yoshie902a> havenwood: thank you, still confused by will try to understand it when I have more time to read all the links.
<yoshie902a> in more detail
houhoulis has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yoshie902a has left #ruby [#ruby]
TorpedoSkyline has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
fercell has quit [Quit: WeeChat 2.7]
jenrzzz has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
tapoxi has joined #ruby
nowhereman_ has joined #ruby
nowhereman_ has quit [Remote host closed the connection]
nowhereman_ has joined #ruby
Fernando-Basso has joined #ruby
orbyt_ has joined #ruby
nowhereman_ has quit [Ping timeout: 272 seconds]
fphilipe has quit [Ping timeout: 246 seconds]
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe has joined #ruby
TorpedoSkyline has joined #ruby
SCHAPiE has quit [Excess Flood]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
SCHAPiE has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
fphilipe has quit [Ping timeout: 246 seconds]
fphilipe has joined #ruby
mossplix has joined #ruby
pwnd_nsfw has joined #ruby
TCZ has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 268 seconds]
fphilipe has quit [Ping timeout: 245 seconds]
fphilipe has joined #ruby
kristian_on_linu has joined #ruby
chalkmonster has joined #ruby
TCZ has quit [Quit: Bye Bye]
anveo has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
zdm has left #ruby ["nil"]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
john2496 has quit []
Ven`` has quit [Read error: Connection reset by peer]
wallace_mu has quit [Ping timeout: 265 seconds]
tapoxi has quit [Quit: WeeChat 2.7]
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
sergioro has joined #ruby
Frobozz has joined #ruby
prp-e has joined #ruby
jenrzzz has joined #ruby
Frobozz has quit [Remote host closed the connection]
<prp-e> Hello. I'm currently working on a rails project and I have this problem : https://stackoverflow.com/questions/59902964/recaptcha-is-fine-with-form-but-it-signs-up-without-confirmation-as-well
<prp-e> I would be thankful
<prp-e> If you guys help me solve that.
schne1der has quit [Ping timeout: 265 seconds]
nibbo has quit [Ping timeout: 240 seconds]
bvdw has quit [Read error: Connection reset by peer]
fphilipe has joined #ruby
nibbo has joined #ruby
bvdw has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FastJack has quit [Read error: Connection reset by peer]
nibbo has quit [Read error: Connection reset by peer]
chalkmonster has quit [Quit: WeeChat 2.7]
mossplix has quit [Remote host closed the connection]
lmat has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
r3m has quit [Quit: WeeChat 2.8-dev]
r3m has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
mossplix has quit [Ping timeout: 265 seconds]
Buggys has quit [Ping timeout: 260 seconds]
tricon has joined #ruby
nibbo has joined #ruby
houhoulis has quit [Remote host closed the connection]
FastJack has joined #ruby
Buggys has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
s2013 has quit [Read error: Connection reset by peer]
mistergibson[m] has joined #ruby
davidw has quit [Remote host closed the connection]
davidw has joined #ruby