Vashy

Activity Graph

Page 1 of 1

2018-11-10

[05:29:03] Vashy: has joined #RubyOnRails
[05:29:23] Vashy: what's a good way to store money values in a database?
[05:31:43] Vashy: I'm storing it as a Decimal
[05:31:48] Vashy: but I'm not sure I like that
[05:32:30] Vashy: when I console in, I get: e.cost => 0.508545e4; instead of 5085.45
[05:33:11] Vashy: I guess it doesn't really matter
[17:34:56] Vashy: has left #RubyOnRails: ("Leaving")

2018-10-24

[05:01:48] Vashy: has left #RubyOnRails: ("Leaving")
[05:01:49] Vashy: has left #ruby: ("Leaving")

2018-10-21

[07:50:28] Vashy: has joined #ruby
[07:50:48] Vashy: I recently upgraded my local ruby version from 2.4.1 to 2.5.1 and set it to the current and default with rvm
[07:51:04] Vashy: but I just tried using rails and it said the gem wasn't isntalled, and when I tried 'gem install rails' it said gem wasn't found
[07:51:18] Vashy: so I ran 'apt install rubygems'
[07:51:33] Vashy: and now when I try 'gem install rails' it tells me:
[07:51:40] Vashy: You don't have write permissions for the /var/lib/gems/2.3.0 directory.
[07:51:40] Vashy: ERROR: While executing gem ... (Gem::FilePermissionError)
[07:51:54] Vashy: any ideas how I can fix?
[22:16:13] Vashy: has joined #RubyOnRails
[22:16:28] Vashy: anyone have a guide I can follow to convert my Rails 5.2 app into a Rails API?
[22:26:34] Vashy: hd1, I guess I'm not entirely sure myself, so here's the situation: I created a rails app, created some models/views/controllers, then decided to try building a react front end but idk how to interact with the app?
[22:26:55] Vashy: some tutorials I looked up created a brand new rails api app for the tutorial using: 'rails new --api ...'
[22:30:08] Vashy: hd1, do you have some material you can point to that I can read to better understand how to use an existing rails app as an api?

2018-10-19

[05:48:21] Vashy: has left #RubyOnRails: ("Leaving")

2018-10-17

[04:04:01] Vashy: has joined #RubyOnRails
[04:04:21] Vashy: anyone have a recommendation for something like Railscast that's up to date?
[04:04:59] Vashy: e.g. I'm trying to create an edit view for a model (Property) that has_many of another model (PropertyDocument) and each of those has_one_attached document
[04:05:35] Vashy: but whenever I go to the edit view of that Property, and hit save, it creates another attachment that's a copy of the existing document
[04:05:54] Vashy: but Railscast doesn't cover any ActiveStorage material
[04:11:45] Vashy: will check it out

2018-09-19

[02:20:58] Vashy: has left #RubyOnRails: ("Leaving")

2018-09-16

[02:34:14] Vashy: has joined #RubyOnRails
[02:34:44] Vashy: anyone here switch between macos and ubuntu?
[02:34:59] Vashy: why is it such a pain to get a rails app + postgres running on ubuntu :(
[02:35:11] Vashy: it works flawlessly on my macbook
[04:15:12] Vashy: guess it's time for me to learn docker then

2018-08-10

[21:04:35] Vashy: has joined #RubyOnRails
[21:05:02] Vashy: hi all I'm following the active storage guide trying to set up a way for users to upload files in my project
[21:05:24] Vashy: it says that we can upload an attachment and that it gets associated with a record in the db
[21:05:42] Vashy: but I don't see how I can associate other data with the document
[21:06:01] Vashy: e.g. if the user wanted to leave a comment or name each document
[21:06:11] Vashy: is that covered in some other docs?
[21:06:33] Vashy: here's what I'm looking at: https://guides.rubyonrails.org/active_storage_overview.html
[21:06:46] Vashy: I only read up to section 9.4 though, so maybe it's in section 10 or 11
[21:06:54] Vashy: but I don't think it would be in there
[21:09:48] Vashy: I'm not sure how that would work when I allow mutiple docs to be uploaded at once
[21:12:16] Vashy: https://pastebin.com/xW85A2hs
[21:12:19] Vashy: tycoon177: ^
[21:12:37] Vashy: no worries then, I'll keep searching
[21:13:06] Vashy: thanks! I appreciate that
[21:13:43] Vashy: pretty new to this, I work on a back end at my job and this is for my personal project so I'm familiar with Ruby and working with the M part of MVC, but this kind of stuff is unfamiliar to me
[21:17:45] Vashy: so I would have to have the form dynamically create an input field for each document they want to upload?
[21:17:49] Vashy: I guess that's what I need to google thne
[21:18:39] Vashy: Property has many -> PropertyDocument; PropertyDocument will have the metadata and the attached file associated; the metadata will come from a form on the front end?
[21:18:46] Vashy: sorry these are super basic questions
[21:37:29] Vashy: I'll take a look, thanks!
[21:40:29] Vashy: Remote host closed the connection

2018-05-16

[00:30:23] Vashy: is it possible to tell if a linux command is installed/available from a ruby script?
[00:30:47] Vashy: e.g. I want to run: output = `lspci`
[00:30:59] Vashy: but how do I check if lspci is even available/installed ?
[00:32:23] Vashy: and if it returns nil?
[00:32:26] Vashy: which is what I'm getting
[00:32:44] Vashy: [5] pry(main)> system 'command', '-v', 'lspci'
[00:32:47] Vashy: I'm on Ubuntu
[00:33:13] Vashy: lspci definitely outputs
[00:33:43] Vashy: I'll look up the system docs
[00:33:47] Vashy: thanks havenwood !
[00:35:48] Vashy: thanks again!
[01:02:47] Vashy: it's a pretty nice web framework

2018-05-12

[02:09:21] Vashy: garyserj, it returns the string "gg"
[02:09:37] Vashy: oh someone already said that nvm
[05:59:05] Vashy: I'm trying to write my first gem, to parse the output of "lspci"
[06:00:29] Vashy: so I had ruby mine create a new gem project for me
[06:00:38] Vashy: I decided to name the project ruby-lspci
[06:00:59] Vashy: but it ended up creating a module structure kind of like this: Ruby::Lspci
[06:01:30] Vashy: is it bad to have the top level module be called Ruby?
[06:02:23] Vashy: I'll have to refactor then
[06:02:53] Vashy: yeah I think that's what I'll have to do
[06:03:04] Vashy: also, is there documentation or convention on how a project should be structured?
[06:03:10] Vashy: oic I didn't know that
[06:07:54] Vashy: baweaver, if I refactor the code to no longer use the Ruby namespace, is it okay to keep the name of the project/gem as 'ruby-lspci' ?
[06:08:34] Vashy: I'll reread the naming conventions page on rubygems just to make sure
[06:30:11] Vashy: yeah I was just reading that
[06:30:13] Vashy: thanks elomatreb =)
[07:35:29] Vashy: published a gem and got 6 downloads in a few mins...
[07:35:35] Vashy: is that normal? bots crawling or something?

2018-05-08

[04:54:07] Vashy: https://gist.github.com/hebron-george/9898dee4ff041be5355462925d9fd6b8#file-new_nil-rb-L6
[04:54:07] Vashy: hi all can someone help me debug this simple class?
[04:54:24] Vashy: I'm writing a simple rspec test that calls that class method
[04:54:34] Vashy: but new('asdf') returns nil for some reason
[04:55:01] Vashy: but if I call it from a pry session: Parser.parse('asdf') it creates the object and calls #parse
[04:55:07] Vashy: any ideas why?
[04:56:24] Vashy: [2] pry(main)> Parser.new('asdf').parse
[04:56:24] Vashy: [1] pry(main)> require 'parser'
[04:56:25] Vashy: => #<Parser:0x0000000171d4e0 @command_result="asdf">
[04:56:25] Vashy: [3] pry(main)> Parser.new('asdf')
[04:57:25] Vashy: do you mean the literal expect method?
[04:58:17] Vashy: described_class.parse("some random input")
[04:58:17] Vashy: expect(described_class).to receive(:new)
[04:59:16] Vashy: the test says new('asdf') returns nil
[04:59:22] Vashy: and tries to call "#parse" on nil
[05:00:02] Vashy: undefined method `parse' for nil:NilClass
[05:00:02] Vashy: NoMethodError:
[05:00:02] Vashy: Failure/Error: new(command_result).parse
[05:00:40] Vashy: kk one sec
[05:02:04] Vashy: https://eval.in/1000766
[05:02:08] Vashy: dminuoso, ^
[05:03:08] Vashy: I assumed that it would call new?
[05:03:17] Vashy: should I instead expect it to call initialize?
[05:04:12] Vashy: and call original :P
[05:05:49] Vashy: thanks dminuoso =)
[05:13:19] Vashy: yes that's exactly what it does
[05:13:31] Vashy: so you can chain it with .and_call_original
[05:13:32] Vashy: to not stub
[05:13:47] Vashy: i.e. expect(described_class).to receive(:new).and_call_original

2018-05-01

[02:33:07] Vashy: hi all, I'm trying to capture the output of airmon-ng, I tried something like: IO.popen(`airmon-ng wlan0`) but that doesn't work (or at least not as I expected)
[02:33:31] Vashy: basically the output of airmon-ng is constantly changing
[02:33:56] Vashy: sorry airodump-ng is what I'm trying to get the output for
[02:34:53] Vashy: here's an example of it running: https://youtu.be/AUPw15m-6uM?t=29s
[02:35:08] Vashy: does anyone know how to capture that kind of output?

2018-04-29

[18:01:14] Vashy: is there a way for ruby to capture the stdout of a streaming cli tool?
[18:01:18] Vashy: idk if that's the right words
[18:01:36] Vashy: but e.g. I know I can do something like this:
[18:01:49] Vashy: current_dir_files = `ls`.split
[18:01:59] Vashy: but what about something like:
[18:02:13] Vashy: logfile_tail = `tail -F dev.log`
[18:02:37] Vashy: I'll look those up, thanks apeiros
[18:03:36] Vashy: ah ok, well then popen sounds ideal forme

2018-04-25

[12:26:00] Vashy: *.net *.split
[12:27:22] Vashy: has joined #ruby
[15:01:30] Vashy: *.net *.split
[15:03:15] Vashy: has joined #ruby

2018-04-05

[00:50:09] Vashy: has joined #ruby

2018-04-04

[10:15:59] Vashy: *.net *.split

2018-03-03

[01:01:32] Vashy: has joined #RubyOnRails

2018-02-28

[05:04:24] Vashy: anyone know how I can check if something is installed from a ruby script? e.g. if I want to write a script that checks to see if postgres is installed
[05:04:58] Vashy: I want to write a script that will help me set up projects easily, so it will do some set up like check if postgres is installed, create a rails app, set the db credentials properly, etc
[05:05:45] Vashy: my machines are running ubuntu and macos so I'll have terminal commands to work with
[05:26:47] Vashy: has joined #RubyOnRails
[05:27:52] Vashy: I want to create a helper script to help me set up new rails apps. E.g. check and see if postgres is installed, create proper users in the db, etc; Anyone know how I can check if postgres is installed with ruby?
[05:35:33] Vashy: ok I'll read into those tools
[16:24:34] Vashy: *.net *.split
[16:24:39] Vashy: has joined #ruby

2018-02-19

[03:20:23] Vashy: try this /\"test\"/
[03:26:49] Vashy: can you show the code?
[03:30:14] Vashy: what is argv[0]
[03:35:32] Vashy: memo1, what's the exact thing you pass in? "word" ??
[03:39:08] Vashy: hm, I don't think that's what you want
[03:40:35] Vashy: I don't think the word "test" is in the html document
[03:45:14] Vashy: ah ok I see what you're saying now
[03:45:52] Vashy: hm one sec let me check
[03:46:13] Vashy: I think you have to use a regex object if I remember correctly
[03:47:02] Vashy: no worries, this is a pretty common task, we can solve it
[03:48:37] Vashy: ok memo1 figured it out
[03:48:55] Vashy: you want to do: Regexp.new(ARGV[0]) instead of /ARGV[0]/
[03:49:22] Vashy: let me know if that doesn't work
[03:51:50] Vashy: yeah it's part of standard Ruby
[03:54:08] Vashy: oh neat I didn't know about "ri" that's cool! =)
[03:54:52] Vashy: so most languages have support for Regex so I think you'll be okay with just googling mostly
[03:55:09] Vashy: but learning regex in general might help you
[03:55:32] Vashy: https://www.regexone.com/ here's an interactive tutorial
[03:56:41] Vashy: you can use the "Lesson Notes" section on the right side to choose the topic you're interested in
[03:57:34] Vashy: no problem, happy to help

2018-01-07

[05:06:33] Vashy: kapil___, hope mozzarella's answer helped -- to add to it, the reason he's passing in &block to `a` inside of `b` is because blocks are the implicit last argument to methods in ruby
[05:07:10] Vashy: but you're having to pass it in explicitly there
[05:08:47] Vashy: what mozzarella posted looked like the answer to exactly what you're asking for
[05:12:58] Vashy: kapil___, https://mixandgo.com/blog/mastering-ruby-blocks-in-less-than-5-minutes
[05:18:07] Vashy: good to hear

2018-01-04

[15:23:15] Vashy: Ping timeout: 246 seconds
[15:28:36] Vashy: has joined #ruby

2017-12-19

[05:05:52] Vashy: I want to create a scaffold for the details of a game. Something like: `rails g scaffold MatchDetails`
[05:06:13] Vashy: Is the pluralness of MatchDetails going to mess things up?
[05:06:16] Vashy: I'm a rails beginner
[05:07:19] Vashy: I want to create a scaffold for the details of a game. Something like: `rails g scaffold MatchDetails`
[05:07:26] Vashy: Is the pluralness of MatchDetails going to mess things up?
[05:07:38] Vashy: I'm a rails beginner (also posted in #RubyOnRails)
[05:13:18] Vashy: just saw there's a --force-plural flag

2017-12-18

[00:39:07] Vashy: hi all, I'm a beginner rubyist; I'm wondering how to lay out part of my project
[00:39:29] Vashy: I just started a rails project that uses a library to create an api client to make calls with
[00:39:50] Vashy: and I'm using the same client in a bunch of different files so I know i want to move it into it's own module and have these classes extend it
[00:40:36] Vashy: so for example: in my `app/jobs/` dir, I have two classes: `job1.rb` and `job2.rb`, where should I create the new module?
[00:40:56] Vashy: do I do something like: `app/jobs/new_module/api_client.rb` ?
[00:41:41] Vashy: has joined #RubyOnRails
[00:42:31] Vashy: <Vashy> do I do something like: `app/jobs/new_module/api_client.rb`
[00:42:31] Vashy: <Vashy> and I'm using the same client in a bunch of different files so I know i want to move it into it's own module and have these classes extend it... so for example: in my `app/jobs/` dir, I have two classes: `job1.rb` and `job2.rb`, where should I create the new module?
[00:42:31] Vashy: <Vashy> I just started a rails project that uses a library to create an api client to make calls with
[00:42:31] Vashy: <Vashy> hi all, I'm a beginner rubyist; I'm wondering how to lay out part of my project
[00:42:49] Vashy: sorry about the crappy copy paste, I posted it in the #ruby channel

2017-12-09

[05:06:16] Vashy: *.net *.split
[05:14:35] Vashy: has joined #ruby

2017-12-07

[03:16:59] Vashy: has joined #ruby
[14:48:32] Vashy: *.net *.split
[14:55:02] Vashy: has joined #ruby