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!
drincruz has quit [Ping timeout: 272 seconds]
<havenwood> hey
Fernando-Basso has quit [Quit: Leaving]
olddogbarks has quit [Quit: I am functioning within established parameters.]
<ewanchic> hey?
<ewanchic> Mallot1: Did you get your sinatra bug figured out?
<simonfromspace> page_title = @parsed_page.css('td.section_post_header span').text.gsub(':', '')
<simonfromspace> A semi colon was bothering me so I used gsub to replace it.
Mallot1 has quit [Ping timeout: 260 seconds]
<simonfromspace> But now I realized that other punctuations could be passed through the parsed page. What would be the easiest way to pass only letters, numbers, and spaces in the same order?
<simonfromspace> By easy, I mean, a one liner.
<simonfromspace> In my head, I'm thinking something like this -> gsub('!^[A-Za-z0-9 ]', '')
<simonfromspace> But that just looks wrong
Mallot1 has joined #ruby
<Mallot1> Hey @ewanchic
GodFather has joined #ruby
<simonfromspace> I guess I'm trying to replace anything that's not an alphabet or a letter into '' in my string.
<Mallot1> I got that working, but now I'm trying to figure out how to use ActiveRecord. I'm able to generate a migration with "rake db:create_migration NAME=db_name" but I don't know how to do C.R.U.D with it or how the migration actually connects to the controllers and views in a MVC application
<Mallot1> ewanchic: ^^
<simonfromspace> Figure it out, I guess. Solved my problem uuing--> gsub(/\W/, '')
simon__ has joined #ruby
simonfromspace has quit [Ping timeout: 268 seconds]
GodFather has quit [Ping timeout: 245 seconds]
TCZ has joined #ruby
nowhere_man has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Mallot1 has quit [Ping timeout: 260 seconds]
Lyubo1 has quit [Ping timeout: 272 seconds]
<ewanchic> Mallot1: Let me know when you have returned :)
citizentwo has quit [Remote host closed the connection]
Lyubo1 has joined #ruby
xco has joined #ruby
my_dude has joined #ruby
DaRock has joined #ruby
Arahael has quit [Ping timeout: 248 seconds]
davidw has quit [Ping timeout: 272 seconds]
<havenwood> &>> Array.new(255, &:chr).join.delete('^a-zA-Z0-9') #simonfr
<rubydoc> # => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" (https://carc.in/#/r/8l2i)
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
<havenwood> &>> ObjectSpace.each_object(String).grep(/\^/)
<rubydoc> # => ["^(date: \\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d+?)Z", "\\A[^:]+(?=(?::(.*?)=(.*))?\\z)", "#... check link for more (https://carc.in/#/r/8l2j)
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
gix has quit [Ping timeout: 272 seconds]
fercell has quit [Quit: WeeChat 2.7]
Mallot1 has joined #ruby
<Mallot1> Hello
<ewanchic> Hey!
BTRE has quit [Quit: Leaving]
<ewanchic> So, trying to figure out Rails, or still with Sinatra?
<Mallot1> Hey ewanchic
<Mallot1> !
<Mallot1> Sinatra
<Mallot1> HelloWhen I run When I run "rake db:create" I get "rake db:createrake aborted!ActiveRecord::AdapterNotSpecified: The `development` database is not configured for the `default_env` environment.Available databases configurations are:Tasks: TOP => db:create" how do I fix this? Please help. Thanks
jenrzzz_ has joined #ruby
<ewanchic> Sounds like it doesn't know what kind of db you are using => hence the adapter
<havenwood> Mallot1: Is it an open source project you're trying to run?
<ewanchic> psql, mysql, sqlite3, or other?
<Mallot1> ewanchic. Oh i see. I'm using sqlite3
Bounga has joined #ruby
<Mallot1> havenwood: It's my first sinatra project with activerecord
<havenwood> Mallot1: Is it open source?
<havenwood> Mallot1: Have a link to the repo?
<ewanchic> so in your database.yml (I think) you need to specify the adapter: mysql3 ...?
<ewanchic> ok, let me see.
<Mallot1> havenwood: It's not online right now.
<havenwood> Mallot1: Ah, okay.
<Mallot1> havenwood: I can send the code though
<ewanchic> or, let us see :)
<Mallot1> ewanchic: I'm using sqlite3
<Mallot1> Here's my database.yml:
ChmEarl has quit [Quit: Leaving]
<Mallot1> adapter: sqlite3database: db/database.sqlitepool: 5timeout: 5000
<Mallot1> adapter: sqlite3 database: db/database.sqlitepool: 5timeout: 5000
<Mallot1> adapter: sqlite3 database: db/database.sqlite pool: 5 timeout: 5000
<Mallot1> Hold on
jenrzzz has quit [Ping timeout: 245 seconds]
<ewanchic> Do you have a line like this in your file: DataMapper.setup( :d efault, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/development.db")
<Mallot1> ewanchic: Which one
jenrzzz_ has quit [Ping timeout: 260 seconds]
<ewanchic> That does look correct...
Bounga has quit [Ping timeout: 272 seconds]
<ewanchic> did you install the gem 'sqlite3'
<ewanchic> do you have a Gemfile?
<Mallot1> Yes
<Mallot1> Here's my gemfile
<ewanchic> so 'bundle install' installed the sqlite3 gem?
<ewanchic> type 'gem list' to make sure
<havenwood> "The `development` database is not configured for the `default_env` environment."
<ewanchic> ahh, I see havenwood's point.
<havenwood> ewanchic: Sinatra uses APP_ENV for environment these days?
<havenwood> Mallot1: export APP_ENV=development
<ewanchic> havenwood: I don't know? :D I'm not a sinatra coder :)
<havenwood> Mallot1: Curious to see the whole project.
<ewanchic> https://dpaste.org/gygm here is an example
<havenwood> ewanchic: I moved from Sinatra to Roda. :)
chalkmonster has joined #ruby
<havenwood> ewanchic: Yeah, I'd expect to inherit from the default, not *be* a "default_env."
<ewanchic> havenwood: Interesting :) I'm still a Rails guy :
<havenwood> Mallot1: Does explicitly setting RACK_ENV or APP_ENV to development help? Show your DB YAML file?
<Mallot1> havenwood: I'm not sure how I can get it hosted
<havenwood> Mallot1: Have a GitHub account?
<havenwood> Mallot1: https://github.com/
<ewanchic> Mallot1: so what havenwood is talking about, is you might need the development: section in your database.yml file.
<apotheon> havenwood: Why did you switch to Roda? (just curious about reasoning)
chalkmonster has quit [Client Quit]
<Mallot1> havenwood: "Mallot1: export APP_ENV=development" where do I put that
<havenwood> Mallot1: Just type it once in your shell then try again.
<havenwood> or prefix `APP_ENV=development` in front of the command.
<havenwood> apotheon: It ended up being a variety of reasons.
<Mallot1> havenwood: "Mallot1: Does explicitly setting RACK_ENV or APP_ENV to development help? Show your DB YAML file?" I don't know. Here's my database.yml:
<havenwood> Mallot1: So no environments?
<havenwood> Mallot1: That's the whole file?
<havenwood> apotheon: One reason was I wanted something that used less memory and was generally closer to Rack speeds.
<havenwood> apotheon: It excels there, with almost no footprint on top of Rack.
<ewanchic> Mallot1: Change your database.yml file to this, and see it that works: https://dpaste.org/MAKu
<Mallot1> havenwood: That's the whole file
<havenwood> apotheon: Another reason was being burned a few times by Sinatra internals leaking into my namespace, taking a long time to debug.
<havenwood> apotheon: I also found I often used ad hoc plugins with a Sinatra app, and it was much tidier using Roda's plugin system.
<ewanchic> Mallot1: You can see how I encapsulated your code into a 'default' branch, and then added a 'development' branch, and pointed it back to the default.
<havenwood> apotheon: The Roda plugins are also higher quality on average, especially those in Roda's repo.
<havenwood> apotheon: Jeremy Evans also maintains the project. He's also the Sequel maintainer. That's a huge win for me, since he's on Ruby core and a remarkable maintainer.
<ewanchic> Mallot1: What tutorial are you using for Sinatra?
<Mallot1> ewanchic: havenwood: Thanks so far. Same error so far
<Mallot1> ewanchic: What I can find on the internet.
<Mallot1> ewanchic: Unfortunately it seems ruby is not as easy to find information for as PHP
<havenwood> apotheon: I also found that I didn't use Sinatra functionality often, and Roda is great at composing the framework you need.
<Mallot1> I'm mostly finding learn.co articles
<havenwood> apotheon: I generally like starting with nothing and cherry picking plugins to compose a framework.
<havenwood> apotheon: Roda is one of the highest-quality code bases I've seen.
<ewanchic> That's what they all say... What are you trying to accomplish? Learn Ruby, Learn a Website...in Ruby. Build a particular kind of site? etc.
<ewanchic> What's the main goal here.
<havenwood> apotheon: As apps grow, I find the routing tree naturally DRYs up things that would take far more composing to get rid of otherwise.
<Mallot1> I just want to be able to make a CRUD app with Ruby
<apotheon> havenwood: I didn't realize it was the same maintainer as Sequel. That's interesting.
<havenwood> Mallot1: I can't recommend Roda enough: https://roda.jeremyevans.net/
<havenwood> Mallot1: Sequel is a lovely alternative to ActiveRecord: https://sequel.jeremyevans.net/
<apotheon> havenwood: Cool. Thanks for the info.
<Mallot1> havenwood: Thanks, unfortunately I have to use ActiveRecord for this prokect
<ewanchic> Well, IMHO, I would actually start with Rails, and maybe rails 5.1 or 5.2? Rails was built with CRUD in mind. Sinatra and Roda would be if you know the in's and out's of what your doing, and need something lean, mean, and thight.
<Mallot1> *project
<apotheon> I've been looking at Roda for an application rewrite, but wasn't entirely convinced yet.
<apotheon> I'm getting there, though.
<Mallot1> I'm so close, just can't seem to get db:create to work.
<ewanchic> what version of ruby are you using?
<Mallot1> I've figured out views, controllers, making a basic migration
<havenwood> apotheon: FWIW, it's very interesting in a microbenchmark: https://github.com/luislavena/bench-micro#requestssec
<Mallot1> ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
<Mallot1> ewanchic: ^^
<havenwood> apotheon: An it routinely does several times better than Sinatra or Rails in real tests too.
<ewanchic> Mallot1: Great. and Great. You can do all of this stuff in rails. Here, I'll walk you through it. Start with 'gem install rails -v 5.2 --no-document'
<apotheon> havenwood: That's what I've seen for Roda performance, in my readings online.
<havenwood> apotheon: I'd like to try a Roda app backed by Falcon and an Async adapter for the DB/memory store/web/disk.
<Mallot1> ewanchic: I would but I have to use Sinatra for this project unfortunately
<havenwood> apotheon: Falcon is looking really nice.
<havenwood> apotheon: My partner has a Roda app she switched over to Falcon: https://github.com/stephaniewilkinson/yonderbook
Mrgoose845701915 has quit [Ping timeout: 265 seconds]
<howdoi> How's ROR doing when compared to nodejs in the industry?
<ewanchic> Well you can still go back to Sinatra. Rails will get you there quicker, and then maybe you know what to look for. In the meantime, I look for some sinatra tutorials for you.
<ewanchic> howdoi: I really won't touch nodejs. I've hated it everytime I look at it. It's a huge step backwards IMPO.
<havenwood> howdoi: Rails is doing great. I don't know I'd compare a single framework to a... what is Node?
<ewanchic> Mallot1: what version of sinatra are you using?
<Mallot1> I don't know how to check
<havenwood> howdoi: A language? Not really. A browser VM that you can run on the server. I'd compare Node.js to Ruby probably.
Mrgoose845701915 has joined #ruby
<ewanchic> gem list sinatra
<Mallot1> Oh yeah
<Mallot1> sinatra (2.0.8.1, 2.0.7)
<Mallot1> thanks
<howdoi> In 2009 in did ROR for an year and switched to Python and later to nodejs and haven't turned back
<havenwood> howdoi: I'd guess that Ruby probably has more traction than Node.js overall? It's hard to say. JavaScript is certainly huge on the browser.
<howdoi> But recently got an interesting gig on ROR
TCZ has quit [Quit: Leaving]
<howdoi> Bit confused, considering the market trends
<havenwood> howdoi: Ruby and Node.js are both pretty vibrant communities.
<apotheon> havenwood: I take it you mean this Falcon. https://github.com/socketry/falcon
<havenwood> apotheon: Yup!
<apotheon> cool
<apotheon> Does your partner use it in production, or just for dev?
<ewanchic> Mallot1: let me know when rails is all installed.
<howdoi> Yes, flacon, Sinatra, have used them
<ewanchic> Mallot1: my pleasure
<havenwood> howdoi: Falcon is quite new. Exciting concurrency things around Ruby 3. https://www.codeotaku.com/journal/2019-12/ruby-concurrency-progress-report/index
<howdoi> havenwood: job trends doesn't suggest that though
<havenwood> apotheon: She uses it in prod.
<ewanchic> howdoi: Just wait until I get 'Freight' out for Ruby on Rails, then you'll know what I'm talking about.
<havenwood> howdoi: Where do you live? How's it trending there?
<Mallot1> ewanchic: I can't use rails. I'm doing a sinatra project
<howdoi> havenwood: Bay Area 🙆‍♂️
<howdoi> ewanchic: I am curious
<havenwood> howdoi: So many Ruby jobs!
<havenwood> howdoi: Come work at Square. :P
<havenwood> Lots of Node.js too, so you have your pick.
<havenwood> (Not at Square, but in the Bay Area.)
<howdoi> havenwood: less salary, I am in Square's competitor 😅
<howdoi> Decent RoR jobs, less pay
<havenwood> howdoi: In the Bay Area, I'd say pick your poison based on your personal preferences. What makes you happy?
<howdoi> After 9+ years of slogging with JS, switching back to RoR makes sense?
<havenwood> howdoi: That makes sense to me!
<apotheon> havenwood: Do you work at Square?
<howdoi> JS makes me happy, it's not that RoR doesn't, Ruby has given me joy
<havenwood> howdoi: I wouldn't mind starting a Rails 6 app these days. It's so nice.
<apotheon> Yeah, Ruby's fun.
<ewanchic> Mallot1: I just realized this...di you require 'sqlite3' ?
coderhs has joined #ruby
<howdoi> Okies! I can still keep in touch with JS anyway
<havenwood> apotheon: Yup!
<apotheon> hmm
<Mallot1> ewanchic: Yes
<Mallot1> ewanchic: Where
* howdoi will sleep over with this thought
<apotheon> I'd love to get a remote, part-time Ruby job.
<howdoi> Thanks for the chat!
<apotheon> Nobody really hires devs part-time, though, sadly.
<howdoi> I'll come back and pester more sooner
<havenwood> howdoi: The last I did Rails was for a little experiment around Rails 5.2: https://youtu.be/6h5TbKBnLws
<havenwood> apotheon: I agree! I wish there was more general flexibility with percent of time. It makes being a contractor appealing, except for every. other. thing. about it.
<ewanchic> howdoi: gem 'freight' long story short, I started this gem back in Aug '19, but I didn't own the name yet. I'm currently at version 0.10.x on my dev machine, but I'm trying to slowly translate what I have working back into the public gem, and add testing. ...it is SLOW, but progressing. I just finished a major stage just the other night. Now are to the third stage...I am so pumped!
<ewanchic> howdoi: second and third on my dev gem, not the public.
<howdoi> Nice, I'll wait for it.
<howdoi> havenwood: I'll listen to it. Thanks
<ewanchic> Mallot1: I'm looking for tutorials still. I was going to walk you through the Rails. If you need active record, it's not much different. You'll probably be done in 10 mins. Then you can take what you learned and able it back to Sinatra.
<apotheon> havenwood: agreed, re "every other thing about it"
<Mallot1> Alright, thanks I appreciate it :)
<apotheon> havenwood: It doesn't help that laws made to supposedly protect contractors actually screw contractors over in a major way.
<ewanchic> Mallot1: Is this what you are following?
<Mallot1> ewanchic: No, I've never seen that before
<ewanchic> Mallot1:, Yeah, forget the database.yml. Looks like it's just a tight piece of code. Create an app.rb file, just declares the db, right there.
<Mallot1> okay
jenrzzz has joined #ruby
<ewanchic> Mallot1: This might be what you need.
<Mallot1> ewanchic: It looks like a great find
<ewanchic> I googled: sinatra 2.0.7 with activerecord tutorial
<ewanchic> Mallot1: let me know how that works out for ya!
bsdband21 has joined #ruby
<ewanchic> havenwood: How did your experiment go?
bsdbandit-01 has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
BTRE has joined #ruby
* howdoi is overthinking
<havenwood> ewanchic: I had a blast and was thrilled to find out how relatively easy it was to wrap an API in an ActiveRecord-like interface.
<ewanchic> havenwood: Yes, it is awesome stuff, that rails!
evert has quit [Quit: ZNC - https://znc.in]
evert has joined #ruby
Tristan has joined #ruby
Tristan is now known as Guest84291
Guest78152 has quit [Read error: Connection reset by peer]
<Mallot1> don't disconnect
<Mallot1> sweet, that should buy me some time lol
<ewanchic> Mallot1: Awesome! Glad it's working for ya!
<Mallot1> ewanchic: Thanks, still working on trying to get activerecord working. All in good time I guess lol
simon__ has quit [Ping timeout: 265 seconds]
yasumi2136 has joined #ruby
<ewanchic> Mallot1: Since this is Windows 10, did you install Sqlite3?
<howdoi> > According to the results from the same survey, globally Ruby developers have a salary of $64000. That’s quite lower than Clojure ($72000), Rust ($69 000), Erlang ($67000) or even Go ($66000) but much higher than JavaScript ($55000).
Mallot1 has quit [Ping timeout: 260 seconds]
bsdband21 has quit [Ping timeout: 248 seconds]
bsdbandit-01 has joined #ruby
orbyt_ has joined #ruby
Mallot1 has joined #ruby
<Mallot1> hello
<ewanchic> Hey
<Mallot1> I'm so confused with migrations. When I create a migration and run it what actually happens?
<Mallot1> Like what file is generated? How can I see what happened?
<ewanchic> Is there a schema.db that's created?
<ewanchic> Sorry, schema.rb?
coderhs has quit [Remote host closed the connection]
<Mallot1> it runs but no schema.rb is made
<ewanchic> It's probably more complete in Rails than it is in sinatra. The way migrations work is really cool! There is another table that's created in your db called schema migrations. It' keeps track of your tables that get added to the db. You can create, migrate, rollback, drop, and append existing table.
<Mallot1> oh sweet
<Mallot1> thanks
<ewanchic> Migrations can give you the oppurtunity to morph/transpose data if you need to, from table change ti table change. The idea is , if you need to go backwards in your project development, you can.
<ewanchic> Yeah, from this tutorial, sinatra might be lacking, I don't know for sure. But, it makes sense. Rails is designed for setting up the whole framework for development. You can go lean and mean with sinatra. But, my projects are never lean and mean in nature. They have to be robust and productive/feature rich apps.
<ewanchic> That's why I think if you created a rails app in 10 mins, you'd find easier why sinatra might or might not be doing this or that.
<Mallot1> Could wor
ttoocs has joined #ruby
<Mallot1> k
raven__ has joined #ruby
darkstardev13 has quit [Ping timeout: 268 seconds]
tredkilla has joined #ruby
Bounga has joined #ruby
Bounga has quit [Ping timeout: 248 seconds]
bsdbandit-01 has quit [Ping timeout: 265 seconds]
bsdband58 has joined #ruby
braincrash has quit [Quit: bye bye]
ur5us has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
jenrzzz has joined #ruby
LinuxKnight has joined #ruby
alfiemax has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
StoneCypherMac has joined #ruby
<StoneCypherMac> Hi, I barely ruby, I'm trying to hack my way through it on other code, and I'm missing something. I wrote a module, and in irb it seems to do what I expect. I'm trying to write a spec but I can't load spec_helper.
<StoneCypherMac> I'm really hoping this is a common mistake and that I'm about to feel silly
<StoneCypherMac> it's not clear to me whether there's an expected path, whether i need to have done whatever ruby's package or project creation dance is, &c. i'm trying to rtfm but i haven't found the relevant page yet
ur5us has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
splud_wurk has quit [Quit: splud_wurk]
<havenwood> StoneCypherMac: We'd be happy to help. Have you committed your project to a repo and uploaded it anywhere you can share so we can take a look?
<havenwood> StoneCypherMac: Do you have a spec_helper.rb file?
<havenwood> StoneCypherMac: To require a helper from the same directory, you could: require_relative 'spec_helper'
akemhp has joined #ruby
StoneCypherMac has quit [Ping timeout: 272 seconds]
StoneCypherMac has joined #ruby
yasumi2136 has quit [Remote host closed the connection]
duderonomy has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ewanchic> If I'm running ordinary gem server, and I source to it, and I ask for a gem that's not installed, will it search up inside the gem server to download it into it's repo, and then give it to me, or will it skip?
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
mozzarella has quit [Remote host closed the connection]
chalkmonster has joined #ruby
mozzarella has joined #ruby
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
<ewanchic> mmm :( gem server works, but I still cannot install gems from it.
connor_goodwolf has quit [Quit: leaving]
connor_goodwolf has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
cxl has quit [Quit: bye]
jenrzzz has joined #ruby
sergioro has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 248 seconds]
coffeex3 has joined #ruby
sauvin has joined #ruby
sauvin has quit [Max SendQ exceeded]
StoneCypherMac has quit [Ping timeout: 245 seconds]
sauvin has joined #ruby
schne1der has joined #ruby
cxl has joined #ruby
hoijui has joined #ruby
Bounga has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
Bounga has quit [Ping timeout: 245 seconds]
fphilipe has joined #ruby
coffeex3 has quit [Ping timeout: 245 seconds]
ur5us has joined #ruby
StoneCypherMac has joined #ruby
schne1der has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
StoneCypherMac has quit [Ping timeout: 268 seconds]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
snuz has quit [Read error: Connection reset by peer]
StoneCypherMac has joined #ruby
postmodern has quit [Read error: Connection reset by peer]
StoneCypherMac has quit [Ping timeout: 265 seconds]
postmodern has joined #ruby
fercell has joined #ruby
Arahael has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
my_dude has quit [Quit: ZZZzzz…]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
NODE has quit [Quit: changing servers]
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
NODE has joined #ruby
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
conta has joined #ruby
my_dude has joined #ruby
cthulchu_ has quit [Ping timeout: 268 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TomyWork has joined #ruby
fphilipe has quit [Ping timeout: 245 seconds]
my_dude has quit [Quit: my_dude]
schne1der has joined #ruby
Eiam has quit [Ping timeout: 248 seconds]
nowhere_man has joined #ruby
csaunders_ has quit [Ping timeout: 248 seconds]
pinpox has quit [Ping timeout: 260 seconds]
csaunders has joined #ruby
pinpox has joined #ruby
teej has quit [Ping timeout: 248 seconds]
gorsuch has quit [Ping timeout: 248 seconds]
grvgr has quit [Ping timeout: 248 seconds]
infinity2022 has quit [Ping timeout: 248 seconds]
grvgr has joined #ruby
gorsuch has joined #ruby
kapil_ has quit [Ping timeout: 248 seconds]
JayDoubleu has quit [Ping timeout: 248 seconds]
maxmanders has quit [Ping timeout: 248 seconds]
jnoon has quit [Ping timeout: 248 seconds]
pitastrudl has quit [Ping timeout: 248 seconds]
ctp has quit [Ping timeout: 248 seconds]
wbnns has quit [Ping timeout: 248 seconds]
mkroman has quit [Remote host closed the connection]
infinity2022 has joined #ruby
JJonah_ has quit [Ping timeout: 248 seconds]
jhill has quit [Ping timeout: 248 seconds]
jerme_ has quit [Ping timeout: 248 seconds]
ReinH has quit [Ping timeout: 248 seconds]
kermit has quit [Ping timeout: 248 seconds]
mkroman has joined #ruby
maxmanders has joined #ruby
pitastrudl has joined #ruby
ReinH has joined #ruby
jnoon has joined #ruby
NODE has quit [Excess Flood]
ctp has joined #ruby
JayDoubleu has joined #ruby
wbnns has joined #ruby
kapil_ has joined #ruby
Bounga has joined #ruby
teej has joined #ruby
NODE has joined #ruby
jerme_ has joined #ruby
JJonah_ has joined #ruby
kermit has joined #ruby
jhill has joined #ruby
my_dude has joined #ruby
fphilipe has joined #ruby
Jonopoly has joined #ruby
NODE has quit [Quit: Benett]
clemens3 has joined #ruby
mikecmpbll has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
sagax has joined #ruby
NODE has joined #ruby
nowhere_man has joined #ruby
code_zombie__ has quit [Quit: Leaving]
ur5us has quit [Ping timeout: 260 seconds]
Bounga` has joined #ruby
Bounga has quit [Ping timeout: 272 seconds]
xco has joined #ruby
my_dude has quit [Quit: ZZZzzz…]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
my_dude has joined #ruby
my_dude has quit [Client Quit]
mkroman has quit [Remote host closed the connection]
sergioro has quit [Quit: leaving]
my_dude has joined #ruby
my_dude has quit [Client Quit]
mkroman has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
JediMaster has joined #ruby
<JediMaster> Hi all, I've got a dependency conflict between two gems, 'acme-client' and 'inspec-core'. They both require the 'faraday' gem, both work with 0.9.1 and above, but inspec-core doesn't have a ~> dependency so it tries to install 1.0.0 which then conflicts with the requirements for acme-client. Does anyone have any ideas on a workaround?
<JediMaster> I need both running at the same time (inspec-core is required by Chef's client, and I need acme-client for a Chef recipe)
<JediMaster> It looks like gem recommends having a limiting ~> requirement on all packages, it warns when you don't have one, and inspec-core doesn't have it
<JediMaster> Is there a way I could stop faraday 1.0.0 from being installed despite inspec-core's >=0.9.0 dependency that automatically installs the very latest version?
<JediMaster> This issue has only happened since faraday 1.0.0 was released
alfiemax has quit [Remote host closed the connection]
gigetoo has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
gigetoo has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
Fernando-Basso has joined #ruby
chalkmonster has joined #ruby
StoneCypherMac has joined #ruby
Arahael has quit [Ping timeout: 240 seconds]
StoneCypherMac has quit [Ping timeout: 240 seconds]
TCZ has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
my_dude has joined #ruby
TCZ has quit [Quit: Leaving]
Arahael has joined #ruby
<IGnorAND> I like ruby, and would thus like to write ruby. I however need to run several scripts on servers which dont have ruby installed. One option is to write the scripts in sh/bash. Is there a way to make a elf binary from ruby so I can avoid writing sh scripts?
alfiemax has joined #ruby
<IGnorAND> rubinius looks like what I want, but the page is 'blank'
leitz has joined #ruby
<IGnorAND> seems it needs a Rubinius VM as well. Sigh so not byte code
xco has joined #ruby
alexherbo2 has joined #ruby
<leitz> Is there a need for a gem that helps you format your resume data into txt and html, from the same source? I got tired of being asked for word versions, and I needed a web version on my site. Not sure if anyone else would want it.
<leitz> Well, with their own resume data. :)
postmodern has quit [Quit: Leaving]
Bounga` has quit [Ping timeout: 245 seconds]
NODE has quit [Quit: changing servers]
conta has quit [Quit: conta]
Bounga` has joined #ruby
NODE has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
klaas has quit [*.net *.split]
klaas has joined #ruby
bsdband58 has quit [Ping timeout: 240 seconds]
cxl has quit [Ping timeout: 240 seconds]
cxl has joined #ruby
bsdbandit-01 has joined #ruby
Ytrezar has quit [Quit: See ya]
<IGnorAND> @leitz you could make a prawn version of it
<IGnorAND> creates pdf
Ytrezar has joined #ruby
<leitz> IGnorAND, not a bad idea!
davor_ has joined #ruby
davor has quit [Ping timeout: 268 seconds]
davor_ is now known as davor
tredkilla has quit [Ping timeout: 272 seconds]
TCZ has joined #ruby
StoneCypherMac has joined #ruby
buckworst has joined #ruby
StoneCypherMac has quit [Ping timeout: 258 seconds]
drincruz has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
Mallot1 has quit [Remote host closed the connection]
JJonah_ has quit [Quit: Connection closed for inactivity]
alfiemax has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
hoijui has quit [Ping timeout: 248 seconds]
vondruch_ has joined #ruby
tredkilla has joined #ruby
xco has joined #ruby
NODE has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
vondruch_ is now known as vondruch
JediMaster has quit [Quit: fnarble]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
stryek has joined #ruby
burningserenity has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
burningserenity has quit [Quit: Leaving.]
burningserenity has joined #ruby
kinduff has joined #ruby
kinduff has joined #ruby
kinduff has quit [Changing host]
lucasb has joined #ruby
markopasha has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
Arahael has quit [Ping timeout: 240 seconds]
buckworst has quit [Quit: WeeChat 2.7]
tredkilla has quit [Ping timeout: 248 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
snuz has joined #ruby
alfiemax has joined #ruby
schne1der has quit [Ping timeout: 245 seconds]
jacksop has joined #ruby
simonfromspace has joined #ruby
dreamreal has quit [Quit: WeeChat 2.7]
cd has joined #ruby
dreamreal has joined #ruby
bkuhlmann has joined #ruby
bkuhlmann has quit []
royal_screwup21 has joined #ruby
jottr has joined #ruby
m_antis has joined #ruby
dionysus69 has joined #ruby
m_antis has quit [Client Quit]
StoneCypherMac has joined #ruby
bsdband34 has joined #ruby
TCZ has quit [Quit: Leaving]
StoneCypherMac has quit [Ping timeout: 265 seconds]
bsdbandit-01 has quit [Ping timeout: 265 seconds]
zacts has joined #ruby
schne1der has joined #ruby
minall has joined #ruby
<minall> Hello Ruby community!
<minall> I'm studying Ruby and I reached the concept of 'symbols', which are 'lightweight strings'. I somewhat understand it, but I want a situation in which I'll use symbols instead of strings
<leitz> minall, as a key for a hash.
<havenwood> minall: I'll quote Jeremy Evansn, "Symbols are a simple way to get a unique named identifier, and Strings represent arbitrary data/text."
<havenwood> minall: Or Matz, "Symbols in Ruby are for identifiers. They are kind of like Enums in other languages such as Swift or C# (although Symbols are more primitive)."
bsdband34 has quit [Ping timeout: 272 seconds]
royal_screwup21 has quit [Remote host closed the connection]
<havenwood> minall: There's discussion of the distinction in these issue tickets:
bsdbandit-01 has joined #ruby
jottr has quit [Ping timeout: 258 seconds]
<havenwood> minall: Strings => data, Symbols => identifiers
seenseen has joined #ruby
vondruch_ has joined #ruby
<havenwood> minall: Symbols are like a number wearing a name tag. They don't store text, they just happen to use a bit in their name tag.
my_dude has quit [Quit: ZZZzzz…]
citizentwo has joined #ruby
GodFather has joined #ruby
<havenwood> minall: A language can unify what Ruby calls Symbols and Strings or go the other way and have more distinctions than just two primitives for identifiers and text data. At some point languages draw lines between primitives, and sometimes they seem to overlap somewhat.
<havenwood> {label: 'some text data'}
vondruch has quit [Ping timeout: 268 seconds]
vondruch_ is now known as vondruch
<havenwood> minall: leitz's example ^
jottr has joined #ruby
* leitz heads out for a bit. Liking the learning, though.
<minall> Thanks guys!, that's more aclaratory!
fercell has quit [Quit: WeeChat 2.7]
simon_ has joined #ruby
simon_ has quit [Client Quit]
<simonfromspace> havenwood, I can't find it here any longer but what the testing tool you suggested for my scraper?
zacts has quit [Quit: zacts]
<simonfromspace> A three letter tool
<havenwood> simonfromspace: vcr
<simonfromspace> ty
ammar has quit [Quit: Lost terminal]
<seenseen> I've created a few scrapers in my past, but are they easier to create in Ruby than for instance in Node?
<seenseen> Like Ruby's not made for "low level" file and folder management like shells, from what I understand it's not very well suited for "low level" web scraping
<seenseen> "high level stuff" took on a whole new meaning after I came to this conclusion, however wrong it may have been.
<seenseen> * but aren't they
codefriar has joined #ruby
SeepingN has joined #ruby
<seenseen> * but are, sorry misread
<jacksop> I've found the mechanize gem (https://github.com/sparklemotion/mechanize) useful for scraping.
<seenseen> Did an A/B test and it turns out JS scrapers are way easier to create than Ruby scrapers
<seenseen> jacksop: It's
<seenseen> Went through Mechanize and its forks but still :/
dionysus69 has quit [Ping timeout: 240 seconds]
<seenseen> Ruby is destined for greater things than to scrape web pages
<seenseen> Like scraping garbage off the streets
<havenwood> seenseen: You mean controlling robots.
<havenwood> seenseen: Yes.
<seenseen> Ruby is what makes the streets. And the skyscrapers they house.
<simonfromspace> You're a wizard, Ruby
<seenseen> havenwood: Yes sir!
<jhass> but don't we want robots so we don't have to scrape garbage off the streets anymore ourselves...?
<havenwood> jhass: then the robots will build organic lifeforms since they learn they don't want to do it either.
<havenwood> maybe we should just stop throwing garbage in the streets?
<jhass> you make it sound easy
<jhass> reminds me of the short movie where the automated factories build their own consumers
jottr has quit [Ping timeout: 255 seconds]
<havenwood> now if the street itself was alive...
<seenseen> I love where this is going :)
<havenwood> the street could make its own garbage and we and the robots could clean it up.
<havenwood> by working together.
<simonfromspace> havenwood, I need to make unit tests for my code. I was suggested by Reddit and this channel, to have a local static page to test against. So far I only know RSpec. Does this mean I don't need to use vcr? Or would I be able to do the same with vcr?
impermanence has joined #ruby
<havenwood> simonfromspace: Minitest is a test framework that ships with Ruby. RSpec is a popular alternative to Minitest. VCR is a different thing that works with either Minitest or RSpec. VCR will fake a "replay" of a web request so you can test the web offline.
<simonfromspace> Oh, so it works on top of RSpec.
<havenwood> seenseen: Have you tried anemoe, spidr or wombat?
chalkmonster has quit [Quit: WeeChat 2.7]
<havenwood> seenseen: Lots of crawler options. Whether it works for you depends largely on what you're doing. Headless browsers are sometimes easier. I've found Ruby quite adept at scraping. YMMV.
al2o3-cr has quit [Ping timeout: 256 seconds]
royal_screwup21 has joined #ruby
al2o3-cr has joined #ruby
<seenseen> havenwood: Interesting
<seenseen> havenwood: I think I tried spidr, but it was a while back. Ended up creating our own spider in Node :/
<seenseen> After careful consideration
duderonomy has joined #ruby
<seenseen> I might have to revisit that decision, but in a way it makes sense to parse HTML with JS rather than Ruby
<havenwood> seenseen: I can't imagine it much matters whether you crawl or parse in JavaScript or Ruby. They both seem quite similar in that regard.
jottr has joined #ruby
al2o3-cr has quit [Client Quit]
<havenwood> seenseen: They both have a ton of tools to do the crawling and parsing. The fast parts of both are written in C. They expose a very similar level of abstraction. I'd guess it's more about whether coding in Ruby or JavaScript makes you happier.
<havenwood> seenseen: If I wrote the same crawler and parser in both I'd imagine I'd not much prefer one to the other. ¯\_(ツ)_/¯
<havenwood> seenseen: Unless there's some magical library you love that's just available in one of them.
stdedos has joined #ruby
<havenwood> seenseen: As interoperability get better, even that matters less.
AndreYuhai has joined #ruby
<AndreYuhai> Hey there, can I use active record for my non-rails project? To create a database table and model.
<havenwood> AndreYuhai: Yes, you can.
<havenwood> AndreYuhai: Consider Sequel as an alternative.
<AndreYuhai> havenwood, is it a good way though?
<havenwood> AndreYuhai: Sequel and ActiveRecord are the two most popular outside of Rails.
<havenwood> AndreYuhai: https://sequel.jeremyevans.net/
<AndreYuhai> havenwood, oh I haven't heard of Sequel, I will check that as well. Thank you :)
al2o3-cr has joined #ruby
<havenwood> AndreYuhai: It's quite nice. :)
<havenwood> AndreYuhai: The maintainer also authored Roda and is on the Ruby core team.
<havenwood> AndreYuhai: http://roda.jeremyevans.net/
<havenwood> AndreYuhai: Both Sequel and Roda have a plugin system, so you can get a bunch of features by cherry picking them.
<havenwood> AndreYuhai: I highly recommend both. Lots of folk do also use ActiveRecord outside of Rails effectively.
<havenwood> AndreYuhai: Whatcha using a DB for?
alfiemax has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
<AndreYuhai> havenwood, Oh I haven't heard of that either. I actually just started learning some rails for fun. What I am doing right now is that I have a scraper and I keep whatever scraped in a mysql DB.
vondruch has joined #ruby
<havenwood> We should better document YDBM: https://docs.ruby-lang.org/en/2.7.0/YAML/DBM.html
<AndreYuhai> havenwood, I was using mysql2 gem with some module I wrote to make it easy to do CRUD but that becomes pain
jottr has quit [Ping timeout: 258 seconds]
<havenwood> AndreYuhai: For just a key/value store you can even use something built in to Ruby to persist data. Ruby ships with a whole menagerie of interesting things along those lines.
<havenwood> We should really better document YDBM, on that front: https://docs.ruby-lang.org/en/2.7.0/YAML/DBM.html
zacts has joined #ruby
<havenwood> adam12: DBM is a little key/value DB that Ruby has a variety of adapters for in the stdlib, like DBM, GDBM, and SDBM.
<havenwood> oops, MT
StoneCypherMac has joined #ruby
<havenwood> AndreYuhai: One limitation of DBM is that it only stores strings for both key and value. YDBM just auto-serializes values to YAML so you can store more than strings.
<havenwood> AndreYuhai: Anyway: YAML + DBM = YDBM
<havenwood> YDBM lets you use String keys to store values to the DB.
<AndreYuhai> havenwood, so what if I have multiple columns per row
<havenwood> Or YAML::Store is similar, but persists to disk: https://docs.ruby-lang.org/en/2.7.0/YAML/Store.html
<havenwood> AndreYuhai: Are there any associations?
<AndreYuhai> havenwood, nope
<havenwood> AndreYuhai: Or no edges connect?
ChmEarl has joined #ruby
<havenwood> AndreYuhai: With YDBM you can do like: DB['a row'] = {column_1: [1, 2, 3], column_2: [4, 5, 6]}
<havenwood> AndreYuhai: I need more coffee to think DBs!
<havenwood> AndreYuhai: Both YAML::Store and YAML::DBM persist YAML with a key value. So it's like using a Ruby Hash with String keys.
DaRock has quit [Ping timeout: 272 seconds]
<AndreYuhai> havenwood, oh all right haha, I will have a look at that as well.
royal_screwup21 has quit [Remote host closed the connection]
nowhere_man has quit [Ping timeout: 240 seconds]
ttoocs has quit [Ping timeout: 260 seconds]
<havenwood> AndreYuhai: It's handy but more often than not a fancier DB is called for. ¯\_(ツ)_/¯
<havenwood> AndreYuhai: Sequel is quite nice for those fancy DBs. :)
StoneCypherMac has quit [Ping timeout: 240 seconds]
<AndreYuhai> havenwood, yeah it looks really cool. I'd started with active record though but I will definitely use Sequel, looked simpler. :D
drincruz has quit [Ping timeout: 260 seconds]
Bounga` has quit [Ping timeout: 272 seconds]
DTZUZU2 has joined #ruby
GodFather has quit [Ping timeout: 255 seconds]
DTZUZU has quit [Ping timeout: 272 seconds]
royal_screwup21 has joined #ruby
Ytrezar has quit [Quit: See ya]
Ytrezar has joined #ruby
fphilipe has quit [Ping timeout: 260 seconds]
royal_screwup21 has quit [Remote host closed the connection]
clemens3 has quit [Quit: WeeChat 2.1]
codefriar has quit [Ping timeout: 258 seconds]
nibbo_ has quit [Ping timeout: 240 seconds]
cthulchu_ has joined #ruby
jacksop has quit []
davidw has joined #ruby
davidw has quit [Changing host]
davidw has joined #ruby
citizentwo has quit [Remote host closed the connection]
fphilipe has joined #ruby
alfiemax has joined #ruby
StoneCypherMac has joined #ruby
zacts has quit [Remote host closed the connection]
orbyt_ has joined #ruby
codefriar has joined #ruby
LinuxKnight has quit [Ping timeout: 245 seconds]
Mallot1 has joined #ruby
<Mallot1> Hello
<havenwood> Mallot1: hi
<Mallot1> Anyone know ActiveRecord? I'm a beginner and I just am trying to setup my project but "bundle exec rake db:create" is not working
<Mallot1> I'm using Sinatra
jottr has joined #ruby
<Mallot1> Hey havenwood, nice to see you again
kinduff has quit [Remote host closed the connection]
<Mallot1> I'm getting this error: "ActiveRecord::AdapterNotSpecified: The `development` database is not configured for the `default_env` environment."
<havenwood> Mallot1: Link to the repo with your code?
<Mallot1> havenwood: I don't have a repo. I'll upload it to github
jottr has quit [Ping timeout: 240 seconds]
jintseng has joined #ruby
royal_screwup21 has joined #ruby
coderhs has joined #ruby
citizentwo has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TomyWork has quit [Ping timeout: 256 seconds]
<havenwood> Mallot1: This is a new project I'm assuming? You're sure you can't just use Sequel?
<havenwood> Mallot1: Seems like you haven't specified the database.yml location or that file is borked.
<havenwood> Mallot1: Confirm 1) the APP_ENV you're running under, 2) whether your database.yml file is properly "set," 3) whether the content of your database.yml file is correct.
<havenwood> Mallot1: I'd be happy to help you start a quick Roda app with Sequel if you get stuck or tired of debugging.
<havenwood> Mallot1: Lots of folk here use Sinatra and ActiveRecord though, so sharing a repo should work to get help with those.
drincruz has joined #ruby
<Mallot1> havenwood: I apologize for the wait, I was putting the project onto Github. Here it is: https://github.com/Mallot1/SimpleSinatraActiveRecord
duderonomy has joined #ruby
howdoi has joined #ruby
<Mallot1> havenwood: I would use mysql, but I'm doing a project that requires I use sinatra and activerecord, and they use sqlite3
<havenwood> Mallot1: Ah, like for class? Nice.
Bounga` has joined #ruby
Ytrezar has quit [Quit: See ya]
Mallot1 has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> Mall, ah they left?
<havenwood> (The config/environment.rb file wasn't getting required since it was commented out.)
<havenwood> ¯\_(ツ)_/¯
Bounga` has quit [Ping timeout: 240 seconds]
alfiemax has quit [Remote host closed the connection]
Mallot1 has joined #ruby
<Mallot1> Hey
Esa_ has joined #ruby
<Mallot1> Sorry havenwood I got disconnected
alfiemax has joined #ruby
<havenwood> Mallot1: I created a PR to fix the issue.
<havenwood> Mallot1: (Uncomment a single line in your Rakefile.)
Ytrezar has joined #ruby
<havenwood> Mallot1: Channel logs are here if you ever want to check the backlog: https://irclog.whitequark.org/ruby
alfiemax has quit [Ping timeout: 258 seconds]
<Mallot1> havenwood: Thanks, I removed the line but same error :(
<havenwood> Mallot1: Uncomment!
<havenwood> Mallot1: Don't remove the line. Uncomment the line.
gix has joined #ruby
<havenwood> Mallot1: Or once you fix the new errors the old error comes back?
<havenwood> Mallot1: Sec, lemme try.
DTZUZU2 has quit [Ping timeout: 260 seconds]
DTZUZU2 has joined #ruby
<AndreYuhai> How can I call another rake task depending on the result of the task I ran earlier ? If that's possible.
<Mallot1> havenwood: Thanks, it progressed to then scrutinizing my require "models/car.rb" file. I then changed that to "require_relative "../app/models/car.rb" . Same error now
jtdowney has quit [Quit: Bye]
jintseng has quit [Ping timeout: 240 seconds]
<havenwood> Mallot1: Updating the PR as I fix.
<havenwood> Mallot1: Multitasking with work so this may be slow.
<havenwood> Mallot1: Actually, I don't have time right now. :( But very happy to help later today.
<havenwood> Mallot1: I just pushed a commit setting RACK_ENV, which changes the error.
jtdowney has joined #ruby
<havenwood> (Tiny changes.)
<havenwood> Mallot1: ENV['RACK_ENV'] ||= "development"
<havenwood> Mallot1: Now the error is: The `development` database is not configured for the `development` environment.
<havenwood> Mallot1: So those match. >.>
MrETH has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 265 seconds]
davor_ is now known as davor
MrETH has quit [Killed (Sigyn (Spam is off topic on freenode.))]
<Mallot1> havenwood: I see "ActiveRecord::AdapterNotSpecified: The `development` database is not configured for the `development` environment." thanks so far
mikecmpbll has quit [Quit: inabit. zz.]
royal_screwup21 has quit [Remote host closed the connection]
Jonopoly has joined #ruby
JJonah_ has joined #ruby
jintseng has joined #ruby
chalkmonster has joined #ruby
<havenwood> Mallot1: It was a missing require. This sinatra/activerecord is fincky.
<Mallot1> havenwood: Oh nice, which one?
Guest19403 has joined #ruby
<havenwood> Mallot1: Updated PR, but really have to work now!!
<Mallot1> havenwood: I have "Couldn't create 'db/database.sqlite3' database. Please check your configuration." now from adding a ENV["DATABASE_ENV"] Okay, thanks!
<Guest19403> newbie of ruby here , hello , everybody
Guest19403 is now known as RedNinja
<Mallot1> *ENV["DATABASE_URL"]
<havenwood> RedNinja: Welcome!
<Mallot1> havenwood: Yes, perfect! You rock bro!
<Mallot1> It works, thanks again! :)
splud_wurk has joined #ruby
<RedNinja> thanks
Bounga` has joined #ruby
jottr has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
Bounga` has quit [Ping timeout: 272 seconds]
RedNinja has quit [Remote host closed the connection]
Mallot1 has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 240 seconds]
nowhere_man has joined #ruby
DTZUZU2 has quit [Read error: Connection reset by peer]
DTZUZU2 has joined #ruby
Mallot1 has joined #ruby
m_antis has joined #ruby
Mallot1 has quit [Remote host closed the connection]
citizentwo has quit [Ping timeout: 248 seconds]
minall has left #ruby ["ERC (IRC client for Emacs 26.3)"]
rippa has joined #ruby
StoneCypherMac has quit [Ping timeout: 260 seconds]
citizentwo has joined #ruby
dionysus69 has joined #ruby
pwnd_nsfw has joined #ruby
StoneCypherMac has joined #ruby
timmow has quit [*.net *.split]
nfsnobody has quit [*.net *.split]
timmow has joined #ruby
nfsnobody has joined #ruby
clemens3 has joined #ruby
markopasha has quit [Ping timeout: 268 seconds]
StoneCypherMac has quit [Ping timeout: 255 seconds]
houhoulis has joined #ruby
nowhereman has joined #ruby
<sagax> hi all!
<sagax> i don't understand - why i don't use rackup? where rackup it's must be have?
markopasha has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
my_dude has joined #ruby
houhoulis has quit [Ping timeout: 255 seconds]
AndreYuhai has quit [Remote host closed the connection]
my_dude has quit [Client Quit]
<havenwood> sagax: Huh?
<havenwood> sagax: What are you asking about rackup?
<havenwood> I can't parse this, could you say it another way?: "where rackup it's must be have?"
kira_rose[m] has joined #ruby
<havenwood> sagax: This is the `rackup` executable: https://github.com/rack/rack/blob/master/bin/rackup
<havenwood> sagax: It's a common way to start Rack apps, regardless of the webserver they're using. Alternatively, most webservers ship with their own executable. So, you can use `falcon`, `puma`, `unicorn` or `thin` in place of `rackup` depending on which webserver you're using.
<havenwood> sagax: All of the above work with rackup files, by convention named: config.ru
<havenwood> ".ru" for rack up
<seenseen> seen seen!
<sagax> hm. i understand now, before i use `thin` and `unicorn`
<sagax> havenwood: thanks,
<havenwood> sagax: you're welcome
<seenseen> sagax: havenwood is the #1 go to
kira_rose[m] has left #ruby [#ruby]
<seenseen> sagax: But lemme just add "rack-attack" to the mix
<seenseen> Save your ass from script kiddies and the like, if your app really gets popular :)
sauvin has quit [Read error: Connection reset by peer]
StoneCypherMac has joined #ruby
teardown has quit [Ping timeout: 268 seconds]
codefriar has quit [Ping timeout: 258 seconds]
my_dude has joined #ruby
chalkmonster has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
StoneCypherMac has quit [Ping timeout: 260 seconds]
bvdw has joined #ruby
kent\n has quit [Quit: No Ping reply in 180 seconds.]
fphilipe has quit [Ping timeout: 272 seconds]
kent\n has joined #ruby
citizentwo has quit [Remote host closed the connection]
StoneCypherMac has joined #ruby
citizentwo has joined #ruby
seenseen is now known as TinderFX
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
alfiemax has joined #ruby
chalkmon1 has joined #ruby
siery has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Ping timeout: 240 seconds]
<simonfromspace> I have a variable inside a method. Is it possible to set that variable to whatever I want using let in rspec?
hoijui has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
<simonfromspace> the variable already has a value, so I'm looking to change that value when testing the method
<ewanchic> You might need to change it to an instance var, as in @variable
chalkmon1 has quit [Read error: Connection reset by peer]
<simonfromspace> I thought so, and I wanted to confirm
<_phaul> but the fisrt question should be if you really want to do this in the first place. Test from what visible to the outside.. Everything hidden inside is hidden for a reason
<_phaul> testing internal state makes tests fragile
<jhass> ^ you might want to resarch dependency injecton
nowhereman has quit [Ping timeout: 255 seconds]
<simonfromspace> Well, _phaul I am making a scraper and supposed to build unit tests for it. I have a variable set to the website (probably not the best idea but it does the work, and as ewan suggested, I'll make it into an instance variable).
<simonfromspace> I'm making a static site for rspec to run the tests on.
<simonfromspace> And I want rspec to point it to that test site instead of a live one.
<simonfromspace> I was suggested vcr but I've been having trouble understanding how to implement it.
StoneCypherMac has quit [Ping timeout: 240 seconds]
<simonfromspace> I hope that explains my situation. I need to set the variable to my static site when running rspec.
<_phaul> is it passed in from the outside? Then you have access to it from rspec that passes it in ( as jhass said that would be basically dependency injection )
<simonfromspace> No, it's set inside the method.
<simonfromspace> I guess I'll set it outside as an instance which should work, right?
<simonfromspace> I'll give it a shot.
<_phaul> site = 'site' ; scraper = Scaper.new(site: site); is the usage. Then you can let(:site) {double('site')}; subject {Scraper.new(site: site) }; and expect on it like expect(site).to receive :whatever
StoneCypherMac has joined #ruby
<_phaul> if the site is actually worked out inside the Scraper, then that is telling you that the scraper class does too much
splud_wurk has quit [Quit: splud_wurk]
<simonfromspace> Setting it up like that might need a lot more refactoring.
<simonfromspace> I have till tomorrow morning but I'll try my best. THank you
Bounga` has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
StoneCypherMac has quit [Ping timeout: 258 seconds]
royal_screwup21 has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
<_phaul> good luck. I hope I haven't sent you down on a rabbit hole that's too deep. But usualy if something is hard to test then the problem is with the something
Bounga` has quit [Ping timeout: 248 seconds]
burningserenity has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
jottr has joined #ruby
citizentwo has quit [Remote host closed the connection]
burningserenity has joined #ruby
citizentwo has joined #ruby
fphilipe has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
citizentwo has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
<simonfromspace> _phaul, I'll let you know how it goes. Currently writing my tests.
citizentwo has joined #ruby
StoneCypherMac has joined #ruby
StoneCypherMac has quit [Ping timeout: 240 seconds]
TCZ has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
hoijui has quit [Ping timeout: 240 seconds]
cliluw has joined #ruby
AndreYuhai has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
StoneCypherMac has joined #ruby
cliluw has joined #ruby
siery has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
<ewanchic> So last night I tried to use regular 'gem server'. The webbrowser works, and it updates as I install more gems. But I get an error when I try to download gems from it using gem install. https://dpaste.org/iCyc
StoneCypherMac has quit [Read error: Connection reset by peer]
chalkmonster has quit [Quit: WeeChat 2.7]
fphilipe has quit [Ping timeout: 272 seconds]
nowhereman has joined #ruby
<ewanchic> I'm not sure where to go from here. Basically I'm have the same issue with gem server and gemirro.
<AndreYuhai> Hey there, I have a database model and it has one attachment called file, a csv file. The client is able to directly upload the CSV to an amazon bucket. Then I read the content of it, do some manipulation in the background, create a new local CSV and upload it back to the bucket using amazon sdk. What I have problem with here is that how do I attach this file to a model as well?
<AndreYuhai> so I need to be able to create active_storage_attachments and blobs entries for the file
<AndreYuhai> But couldn't figure out how to do taht
<AndreYuhai> especially for blobs table because it has some columns that I have no idea where we are getting from.
<AndreYuhai> for example: metadata, content_type, byte_size, checksum.
<ewanchic> AndreYuhai: Not sure what you mean by attach to model. Why/how are you attaching a file to a model? Do you mean you want to upload the file to the db?
StoneCypherMac has joined #ruby
<AndreYuhai> ewanchic, I create a local CSV on the server side. I want to upload this to an amazon bucket. I also have a model where I want to keep record of these uploaded files.
<ewanchic> Is this db model...a db table you to add afield that accepts blob data?
siery has quit [Ping timeout: 255 seconds]
<AndreYuhai> ewanchic, yes it's a table and in the model code I just did `has_one_attached :file`
<ewanchic> AndreYuhai: oooh, ok. New Terminology from activestorage. I'd think of it ans a one to one table relationship.
<simonfromspace> Any idea why this is happening. I've commented out all the tests yet this happens. https://dpaste.org/8Th1
<ewanchic> AndreYuhai: so, is there a reason why you want to store blobs (csv files) in the table? It's really a bad idea to do that. Files should be stored in the File Hierarchy database, aka your file folders.
<AndreYuhai> ewanchic, not sure if I understood correctly but I am not storing CSVs in table. Let me show you what's in the tables.
<havenwood> simonfromspace: p @output
<ewanchic> simonfromspace: # ./spec/eztv_scraper_spec.rb:1:in `require_relative' did you require the eztv_scraper.rb file inside of your eztv_scraper_spec.rb file?
<simonfromspace> yes I did
<ewanchic> simonfromspace: Did you require JSON lib?
<AndreYuhai> ewanchic, for example: https://imgur.com/a/2J8bKwb
<simonfromspace> I've required all the files. It works fine normally, but using RSpec messes it up.
<havenwood> simonfromspace: Share a link to the repo?
<simonfromspace> Oh do I need to require json lib inside the spec file or something?
<havenwood> simonfromspace: Nope, shouldn't need to.
cliluw has quit [Read error: Connection reset by peer]
<simonfromspace> Let me push
burningserenity has quit [Remote host closed the connection]
cliluw has joined #ruby
<AndreYuhai> ewanchic, so in blobs table there is information about the file uploaded to the bucket which I have no idea how's that happening in the background when I use direct upload.
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
<ewanchic> AndreYuhai: ...oh, so You make changes and the file uploads back to the bucket, but you don't see the changes in active storage?
<AndreYuhai> ewanchic, well I am uploading the file using the amazon sdk so I have to instantiate another model then attach the file and then save it. But when I upload the file to the amazon using the SDK I just get true as a return if the upload was successful
<ewanchic> AndreYuhai: You basically making those changes on the desktop, you re-upload the file back into the bucket directly. Going around active storage. But you don't see the changes in activestorage?
<AndreYuhai> ewanchic, no, I want to instantiate a model and attach the file that I just uploaded to the model and save it.
<AndreYuhai> ewanchic, but the thing is how do I attach this uploaded file to a model
<AndreYuhai> ewanchic, I do Model.new.file.attach (or something like this) but then how are all the column values handled
<havenwood> simonfromspace: Omit ".rb" from your executable and add a shebang. https://github.com/simonpeterdebbarma/eztv-scraper/tree/scraper/bin
<havenwood> simonfromspace: #!/usr/bin/env ruby
<havenwood> simonfromspace: That's ^ the shebang.
<havenwood> simonfromspace: Them make the file executable.
<simonfromspace> Yeah I've seen it before
<simonfromspace> So the filename becomes eztv-scraper. or no period?
<havenwood> simonfromspace: No period.
<simonfromspace> Wow
<simonfromspace> Interesting stuff
<havenwood> simonfromspace: By convention, you should have a lib/eztv_scraper.rb file that does the other requires.
<ewanchic> AndreYuhai: Well, Your Model would be the 'Post' model, and record_id is the Post.id that the attached :file is linked to.
<havenwood> simonfromspace: Then a lib/eztv_scraper/ directory for the other files that are required by lib/eztv_scraper.rb.
<simonfromspace> Let me know if you have any feedback? It's my first self built CLI app. Started yesterday.
<havenwood> simonfromspace: You should put your whole app under a single namespace.
<ewanchic> active_storage_attachements is a polymorphic table, meaning it's a catch all for all files you are uploading.
<havenwood> simonfromspace: By convention, eztv_scraper would be: module EZTVScraper
<havenwood> simonfromspace: Or: module EztvScraper
<AndreYuhai> ewanchic, then do I manually assign those values like filename, content_type, metadata, checksum etc. etc.?
<AndreYuhai> ewanchic, in my blob table
<havenwood> simonfromspace: Follow both the gem naming guidelines and directory structure carefully.
<ewanchic> AndreYuhai: When you upload the file to Post.file, then you should be sending it off to the Amazon bucket, not the other way around.
m_antis has quit [Quit: m_antis]
<simonfromspace> Okay, fixing them
<ewanchic> AndreYuhai: No it should do it for you...but it's probably not necessary becuae I assume ruby would look up the file, and ask bash for all of that info. I'll look it up ...
<havenwood> simonfromspace: You can do just `puts` instead of `puts ''`.
<havenwood> simonfromspace: No need for the empty String literal.
<AndreYuhai> ewanchic, hmm alright I will try that right now. Because then I need an object of Attachable to be able to attach the file
<havenwood> simonfromspace: You should probably run Rubocop on the code, just for some quick fixes.
<havenwood> simonfromspace: gem install rubocop && rubocop -a
<havenwood> simonfromspace: The "-a" will autofix issues.
<simonfromspace> Yeah I fixed the errors last night but I'll do again
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
<ewanchic> AndreYuhai: So, you could do things like file.video? or file.audio? to see what kind of general type it was.
cliluw has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
<ewanchic> AndreYuhai: File.content_type whould get you more info on the type
<ewanchic> havenwood: sorry to bug you, any ideas as to while I'm not downloading gems properly from gem server or gemirro?
<havenwood> ewanchic: Not off the top of my head without knowing more about the problem you're running into.
<havenwood> ewanchic: I suspect you don't need to be doing it, unless it's for fun.
<ewanchic> havenwood: no, it's for development. It's for freight gem
<havenwood> ewanchic: I have a bunch of gems but never run my own gem server for them.
<havenwood> ewanchic: I use a gem server for work, but just to get private versions of shared gems.
<ewanchic> havenwood: frieght creates a new rails app. Then I got to stick 'freight' back into the Gemfile. I've been putting a path in which messes things up when I export to the server.
<havenwood> ewanchic: Just to clarify, freight is currently closed source?
<ewanchic> havenwood: I suspect if I create a private gem server, and force the Gemfile to source to it, then I have my testing ground fixed until I get more code out publicly.
alexherbo29 has joined #ruby
alexherbo2 has quit [Ping timeout: 240 seconds]
<havenwood> ewanchic: So you're using a #source block in your Gemfile and serving the gem yourself?
<havenwood> ewanchic: Alternatively, you could use a private GitHub repo or point to a local path where the gem is located.
<AndreYuhai> ewanchic, I guess here might be the problem that I was trying to explain.
<ewanchic> haevnwood: yes and no. I want to make most of it open source, but I'm hoping to make a section of it as a subscription based. It's where coders can use most of freight for free, but if they want more predone code, you can get that from a subscription. I know I'm being generalized here, but I would like to bouce off these concepts with you and others to see if this is a fair business model or not.
<AndreYuhai> ewanchic, So I was trying to get that blob object with mentioned values and he did it with ActiveStorage::Blob.create_before_direct_upload!(params)
alexherbo2 has joined #ruby
<havenwood> ewanchic: source 'http://localhost:8808' do
<havenwood> ewanchic: gem 'freight'; end
<havenwood> ewanchic: I'd personally prefer to use a private GitHub repo than bother with a gem server if there weren't other people involved, especially.
<havenwood> ewanchic: You can just point your Gemfile to a repo.
alexherbo29 has quit [Ping timeout: 260 seconds]
<ewanchic> AndreYuhai: Awesome! Glad you found what you were looking for!
<simonfromspace> havenwood, changed file structure as instructed and pushed. gonna test rspec now that the shabang has been made
<simonfromspace> Still getting the same error.
<havenwood> simonfromspace: Where'd your lib/ dir go!?
<havenwood> simonfromspace: Make sure you committed everything?
<AndreYuhai> ewanchic, thank you for the help :)
<ewanchic> havenwood: So, If I saved the freight-x.x.x.gem files in gems.wanchic.com, and then wrote a source block to just get gem 'freight' from here, then later in gem 'freight' it would just grab it from gems.wanchic.com ?
<havenwood> simonfromspace: Oh, I dunno what I was looking at. It's back.
<ewanchic> AndreYuhai: Hey, my pleasure! Good luck to you and God bless!
<havenwood> simonfromspace: This should be: require_relative '../lib/eztv_scraper.rb'
schne1der has quit [Ping timeout: 268 seconds]
<havenwood> simonfromspace: This dir should *only* have eztv_scraper.rb: https://github.com/simonpeterdebbarma/eztv-scraper/tree/scraper/lib
<havenwood> simonfromspace: And this dir should have all the other files: https://github.com/simonpeterdebbarma/eztv-scraper/tree/scraper/lib/eztv_scraper
<simonfromspace> ahha
<simonfromspace> I switched that up. sorry :D
<havenwood> simonfromspace: Then the file structure should mirror the namespace, so EztvScraper in lib/eztv_scraper and EztvScraper::JSON in lib/eztv_scraper/json.rb, etc.
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
<havenwood> simonfromspace: Then have spec/spec_helper.rb be the only thing that requires the entry point for the lib, which requires everything else.
<havenwood> simonfromspace: You can either use #require_relative from your helper, or set up the $LOAD_PATH to include your lib/ directory. You can do the latter like I have here: https://github.com/havenwood/digest-sip_hash/blob/master/spec/helper.rb#L3-L4
<havenwood> simonfromspace: With that ^ way, you just from your helper do a: require 'eztv_scraper'
<simonfromspace> Okay, that's a lot of knowledge to intake for me but I'll try my best to process it. Let me try.
jottr_ has joined #ruby
<havenwood> simonfromspace: Once you get that structure down, all you have to do is create a eztv_scraper.gemspec to cut a gem.
buckworst has joined #ruby
jottr has quit [Ping timeout: 265 seconds]
<simonfromspace> Alrght!My rspec works fine!!
<havenwood> :)
<simonfromspace> Taking a look at your gemspec
<simonfromspace> I would like to make this into a gem. That would be pretty cool.
cliluw has quit [Read error: Connection reset by peer]
<havenwood> simonfromspace: I'd focus on the directory and file structure and matching namespace first. We can help get it in order, then it's easy to cut a gem.
cliluw has joined #ruby
<simonfromspace> "cut a gem", guessing that's a thing Rubyists say, but firts time hearing it sounds sleek.
cliluw has quit [Read error: Connection reset by peer]
<simonfromspace> s/firts/first
cliluw has joined #ruby
<ewanchic> havenwood: I'm trying to implement git right now. the reason the localhost won't work is I export my code right to a server and it needs to download new gems. It's doesn't have the path to freight.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<ewanchic> havenwood: also, recopying gems in rvm for a new gemset is taking a while. Sometimes it locks up on nokogiri or sassc gems and sits there for a long time before continuing. Just trying to make this go faster.
phage has joined #ruby
<simonfromspace> Not sure this will help anyone here but finally found an easy way to test my scraper https://blog.albertorocha.me/posts/testing-rspec-nokogiri-fragment
<havenwood> ewanchic: I don't know what you're doing, so hard to make suggestions. At the surface level, sounds like you might want to bundle and offline RVM with full gemset and move it over all at once: https://rvm.io/rvm/offline
Esa_ has quit []
Bounga` has joined #ruby
seenseen has joined #ruby
TinderFX has quit [Ping timeout: 240 seconds]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
NewAlexandria has joined #ruby
Bounga` has quit [Ping timeout: 240 seconds]
jcalla has quit [Ping timeout: 268 seconds]
StoneCypherMac has quit [Ping timeout: 260 seconds]
m_antis has joined #ruby
buckworst has quit [Quit: WeeChat 2.7]
markopasha has quit [Remote host closed the connection]
citizentwo has quit [Remote host closed the connection]
markopasha has joined #ruby
StoneCypherMac has joined #ruby
phage has quit [Ping timeout: 268 seconds]
AndreYuhai has quit [Quit: Leaving]
phage has joined #ruby
NewAlexandria has quit [Remote host closed the connection]
lucasb has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
xco has joined #ruby
hiroaki has quit [Ping timeout: 272 seconds]
phenom has quit [Quit: See ya! Wouldn't want to blah blah..]
phenom has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Bounga` has joined #ruby
jintseng has quit [Ping timeout: 240 seconds]
seenseen has quit [Read error: Connection reset by peer]
leitz has quit [Quit: Leaving]
hiroaki has joined #ruby
Mallot1 has joined #ruby
Bounga` has quit [Ping timeout: 272 seconds]
<Mallot1> Hello, why does line 11 give me the Lint "Status must be >=100 seen as integer" error? Code (Error is at the bottom): https://dpaste.org/Av9J
davidw has quit [Ping timeout: 240 seconds]
Bounga` has joined #ruby
phage has quit [Quit: Textual IRC Client: www.textualapp.com]
jenrzzz has quit [Ping timeout: 255 seconds]
StoneCypherMac has quit [Ping timeout: 260 seconds]
citizentwo has joined #ruby
coffeex3 has joined #ruby
StoneCypherMac has joined #ruby
davidw has joined #ruby
royal_screwup21 has joined #ruby
citizentwo has quit [Ping timeout: 240 seconds]
<_phaul> Mallot1: there are a few thing's I spot, these are local syntactic ones, but I'm unsure about what the code does as whole.. fisrt thing class level @record_id has no relation to @record_id at the instance methods. Second you are using === which is the case equality, when you probably mean == (normal equality)
jottr_ has quit [Ping timeout: 240 seconds]
<_phaul> &>> class X; @record_id = 'class level'; def foo; @record_id; end; end ; X.new.foo
<rubydoc> # => nil (https://carc.in/#/r/8lcr)
m_antis has quit [Quit: m_antis]
pavelz_ is now known as pavelz
<Mallot1> _phaul: Thanks, I'm trying to make sure that my if statement can check if @record_id exactly equals false, not 0
<Mallot1> _phaul: so use == instead of ===
<Mallot1> ?
<_phaul> === is special and you hardly need it. It has type specific behaviour that can be surprising
<_phaul> &>> Integer === 1
<rubydoc> # => true (https://carc.in/#/r/8lcv)
<_phaul> &>> Integer === Integer
<rubydoc> # => false (https://carc.in/#/r/8lcw)
pavelz has quit [Changing host]
pavelz has joined #ruby
<_phaul> it usually but not always means something like "matches" or "is in" a collection
<Mallot1> _phaul: Alright I changed all the === to ==
<Mallot1> How can I make it so that I have a class variable @record_id
<_phaul> classes don't share data with instances. But looking at the code I think you meant to write class methods not instance methods
<Mallot1> _phaul: And use that variable in the methods
<Mallot1> _phaul: I guess so
<Mallot1> _phaul: I just want to write methods for my Car class
<Mallot1> _phaul: And have the record_id variable be accessible throughout the whole thing
<Mallot1> Oh, do I have to use self.record_id?
royal_screwup21 has quit [Remote host closed the connection]
<_phaul> If you want to write class methods you can write def self.create_record etc
<_phaul> then create record does not belong to any instance but the class itsellf. Ie call would be Car.create_record .. not Car.new.create_record
Mallot1 has quit [Remote host closed the connection]
jenrzzz has joined #ruby
Mallot1 has joined #ruby
<Mallot1> hello
<Mallot1> _phaul: Alright. Here's what I have: https://dpaste.org/70FZ
<_phaul> you put the @ back in the class methods in front of record_id.
<_phaul> sorry. s/you// I deleted howI started the sentence
jottr_ has joined #ruby
<_phaul> I didn't mean to be offensive
jintseng has joined #ruby
<Mallot1> no worries, I didn't detect anything offensive :)
jintseng has quit [Max SendQ exceeded]
<Mallot1> _phaul: What am I supposed to do again?
<_phaul> &>> class X; @blah = 'this works'; def self.foo; @blah; end; end; X.foo
<rubydoc> # => "this works" (https://carc.in/#/r/8ld0)
jcalla has joined #ruby
GodFather has joined #ruby
<_phaul> so keep the @ signs, and keep the methods class methods
alfiemax has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
<_phaul> although, setting it to nil doesn't do much, as instance vars are automatically nil without declaring them
Mallot147 has joined #ruby
<Mallot147> back
<Mallot147> _phaul: Sorry, I don't understand https://carc.in/#/r/8ld0
Mallot1 has quit [Ping timeout: 260 seconds]
Mallot147 is now known as Mallot1
alfiemax has quit [Ping timeout: 258 seconds]
Mallot140 has joined #ruby
citizentwo has joined #ruby
<Mallot1> hi
<_phaul> ok. let's make a step back. You probably should make those methods class methods - as you have already done, because they don't operate on an instance of the class but on the class itself. We can just make this code "work" either way, but this is *the* real reason. After this change use @record_id consistently everywhere I can still see self.record_id on line 44.
<_phaul> After that I also pointed out that at the top you don't need @record_id = nil, because instance variables don't need declaring like that
<_phaul> &>> @any_variable_name # is allready nil
<rubydoc> # => nil (https://carc.in/#/r/8ld1)
<Mallot1> _phaul: Oh okay. Here's what I have now: https://dpaste.org/rFrb
citizentwo has quit [Remote host closed the connection]
<_phaul> and you still have the same issue?
<Mallot1> yes
<Mallot1> _phaul: Line 11 causes the error
<Mallot140> _phaul: I mean line 8
TCZ has quit [Quit: Leaving]
<_phaul> hm. seems bit more debug is needed, I can't see any obvious reason from the code
<leftylink> well
<leftylink> s/well./
<leftylink> s/well//
<Mallot1> _phaul: Okay, thanks so far
<Mallot1> leftylink: lol
<_phaul> there are things I find confusing about the code, about how it uses active record, but that's different question
StoneCypherMac has quit [Ping timeout: 240 seconds]
<_phaul> you don't save invalid objects in the database. And what you get back from the database should already be valid
<_phaul> normally..
<leftylink> I don't see where the code for the /createtestcar is defiend so I don't think we have enough information to answer the question at all
<_phaul> create will I think throw exception if you tried to save an invalid object. So all the validity check are a bit fishy
my_dude has quit [Quit: ZZZzzz…]
<Mallot1> I see
Mallot1 has quit [Remote host closed the connection]
Mallot140 has quit [Remote host closed the connection]
StoneCypherMac has joined #ruby
bsdbandit-01 has quit [Ping timeout: 260 seconds]
splud_wurk has joined #ruby
bsdband29 has joined #ruby
my_dude has joined #ruby
jottr has joined #ruby
<_phaul> probably the biggest confusion here is that it's inheriting ActiveRecord::Base. as it should be just having an instance of a record but it itself is not a kind of ActiveRecord..
jottr_ has quit [Ping timeout: 265 seconds]
my_dude has quit [Client Quit]
impermanence has quit [Ping timeout: 258 seconds]
<_phaul> also violating Liskov probably. trying to limit existing broader functionality
DTZUZU has joined #ruby
DTZUZU2 has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 240 seconds]
my_dude has joined #ruby
markopasha has quit [Remote host closed the connection]
markopasha has joined #ruby