havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: 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!
<al2o3-cr> sometimes eval.in works others not.
clemens3 has quit [Ping timeout: 250 seconds]
<al2o3-cr> i was going to try something then, now i've forgot :/
Rich_Morin_ has quit [Quit: Rich_Morin_]
<al2o3-cr> >> [1,2,3].map { |n, @a = 5| }
<ruby[bot]> al2o3-cr: # => /tmp/execpad-9563ef90973b/source-9563ef90973b:2: formal argument cannot be an instance variable ...check link for more (https://eval.in/1077093)
<al2o3-cr> 18>> [1,2,3].map { |n, @a = 5| }
<ruby[bot]> al2o3-cr: # => /tmp/execpad-f2cea7d2c675/source-f2cea7d2c675:2: syntax error, unexpected '=', expecting '|' ...check link for more (https://eval.in/1077094)
<al2o3-cr> ah, nvm.
<al2o3-cr> i'm sure you could pass instance variables to blocks but i could be wrong.
Dbugger has quit [Ping timeout: 252 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
p1c0 has quit [Remote host closed the connection]
Dreamer3_ has joined #ruby
ericboehs has joined #ruby
dviola has quit [Quit: WeeChat 2.3]
<al2o3-cr> baweaver: check this out
<al2o3-cr> &>> def add(x,y) x + y end; TracePoint.trace(:call) { |tp| tp.self.method(tp.method_id).parameters.each { |_, p| tp.binding.local_variable_set(p, rand(100)) if tp.method_id == :add } }; add 10, 20
<rubydoc> # => 45 (https://carc.in/#/r/5zjo)
<al2o3-cr> &>> def add(x,y) x + y end; TracePoint.trace(:call) { |tp| tp.self.method(tp.method_id).parameters.each { |_, p| tp.binding.local_variable_set(p, rand(100)) if tp.method_id == :add } }; add 10, 20
<rubydoc> # => 50 (https://carc.in/#/r/5zjp)
AJA4350 has quit [Ping timeout: 250 seconds]
<al2o3-cr> put that in some rails app lol ;)
idiocrash has joined #ruby
catbusters has quit [Quit: Connection closed for inactivity]
<al2o3-cr> which reads better out of these two:
<al2o3-cr> "foo\v\tbar\n baz".chars.any? &/\p{Space}/.method(:match?)
<al2o3-cr> !"foo\v\tbar\n baz".scan(/\p{Space}/).empty?
<havenwood> al2o3-cr: In 2. 7!: chars.any? &/\s/.:match?
<havenwood> al2o3-cr: I guess you can already: any? /\s/
<havenwood> so not the best example for .: shining
<havenwood> &>> "foo\v\tbar\n baz".chars.any?(/\s/)
<rubydoc> # => true (https://carc.in/#/r/5zjs)
<al2o3-cr> havenwood: nice!
<al2o3-cr> ah, jeez yeah.
<al2o3-cr> i forgot it takes an object
<al2o3-cr> &>> [1,2.1,4.5,"d",:i].grep Float
<rubydoc> # => [2.1, 4.5] (https://carc.in/#/r/5zjt)
<al2o3-cr> facepalms
<phaul> &>> [Float].grep Float
<rubydoc> # => [] (https://carc.in/#/r/5zju)
<al2o3-cr> phaul: that is Class
<al2o3-cr> &>> [Float].grep Class
<rubydoc> # => [Float] (https://carc.in/#/r/5zjv)
AJA4350 has joined #ruby
<phaul> sure
<phaul> we all know === is bit ad hoc, but once you know it, it's fine
<phaul> &>> [1].grep 1
<rubydoc> # => [1] (https://carc.in/#/r/5zjw)
_whitelogger has joined #ruby
hutch has joined #ruby
<al2o3-cr> phaul: true for totally immutable objects.
<phaul> 'a' === 'a'
<phaul> &>> ['a'] === ['a']
<rubydoc> # => true (https://carc.in/#/r/5zjx)
<phaul> &>> (1..2) === (1..2)
<rubydoc> # => false (https://carc.in/#/r/5zjy)
hutch has quit [Ping timeout: 240 seconds]
<al2o3-cr> arrays hold reference ranges don't
hutch has joined #ruby
uplime has quit [Quit: WeeChat 2.2]
<al2o3-cr> it's MRI internal strings and arrays are funcky.
<phaul> I think it's chosen as such that if it makes sense to do a == b for a type in a program, like you would actually do it, then a === a in that type. but can be wrong
<al2o3-cr> yeah it works on eql?
tdy has quit [Ping timeout: 258 seconds]
<al2o3-cr> equal? sorry.
<baweaver> al2o3-cr, phaul, havenwood: https://github.com/baweaver/globs/pull/1 - thoughts?
<baweaver> Maybe a bit constant happy
<al2o3-cr> baweaver: nothing wrong with constants (if thats what they are constants)
ziyadb has quit [Quit: Connection closed for inactivity]
<baweaver> Anyways, playing with StringScanner. Kind of curious to see if that's actually a speed boost or not later.
<baweaver> Probably not because of all the string construction still going on in there
<al2o3-cr> i'd say it slower at an educated guess.
<baweaver> Eh, more accurate parsing at least.
<al2o3-cr> oh yeah, not saying that.
houhoulis has joined #ruby
<al2o3-cr> baweaver: you've got more gems than the queen ;)
<baweaver> I typically just make something whenever I see that it was slightly annoying to write or find a solution for
<al2o3-cr> i need to write a gem.
<al2o3-cr> i was half way into a gem "around argon2 key div"
<al2o3-cr> then guess what someone beat me to it :)
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr> just a simple one for db no secret key (otherwise i'd have to wrap it) and though nah.
<al2o3-cr> anyways a poll, what is everyones favourite gem?
<al2o3-cr> mine is packetfu.
<TheBrayn> rake
<al2o3-cr> oh, i forgot, nokogiri.
gix has quit [Ping timeout: 268 seconds]
<al2o3-cr> top five in order: packetfu, nokogiri, pry, spaghetti, bolognese.
Swyper has joined #ruby
<al2o3-cr> TheBrayn: no, i'm being daft. pasta was on my mind ;)
<al2o3-cr> should be a gem namely pecorino though.
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr> phaul: are you using parslet for rubydoc?
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
hutch has quit [Ping timeout: 250 seconds]
hiroaki has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Quit: AJA4350]
tdy has joined #ruby
cthulchu has quit [Disconnected by services]
cthulchu_ is now known as cthulchu
cthulchu_ has joined #ruby
cthulchu has quit [Read error: Connection reset by peer]
cthulchu has joined #ruby
Swyper has quit [Remote host closed the connection]
Xiti has quit [Ping timeout: 258 seconds]
Xiti has joined #ruby
sarink has joined #ruby
sarink has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 272 seconds]
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
davidw has joined #ruby
jcarl43 has joined #ruby
tdy has joined #ruby
jcarl43 has quit [Client Quit]
jcarl43 has joined #ruby
NightMonkey has quit [Ping timeout: 268 seconds]
NightMonkey has joined #ruby
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
houhoulis has quit [Remote host closed the connection]
elcontrastador has joined #ruby
Swyper has joined #ruby
sarink has joined #ruby
_whitelogger has joined #ruby
Swyper has quit [Ping timeout: 246 seconds]
sarink has quit [Ping timeout: 246 seconds]
<elcontrastador> the URI module is part of stdlib for <=2.5.3 right? I have a system that when i require 'uri' from within irb gives me false
mostlybadfly has joined #ruby
<woodruffw> elcontrastador: `require` returns false when the library is already loaded
<woodruffw> so it's possible you've already loaded it; see if the `URI` constant is available
<elcontrastador> i see that...must be loading aleady
<elcontrastador> indeed it is
<elcontrastador> i dont have an .irbrc file on this system...weird that it's loading on from somewhere
<elcontrastador> thx for help...
<woodruffw> yeah, that's strange, maybe it's become part of the corelib (i.e., the default requires)?
<woodruffw> or something in the corelib is requiring it transitively
<havenwood> It's required by RubyGems, so although it's stdlib, it'll be available unless you disable gems.
<havenwood> ruby --disable-gems -e "p require 'uri'" #=> true
<havenwood> ruby -e "p require 'uri'" #=> false
sputnik13 has joined #ruby
cschneid has joined #ruby
davidw has quit [Ping timeout: 258 seconds]
tdy has quit [Ping timeout: 272 seconds]
hutch has joined #ruby
cschneid has quit [Ping timeout: 272 seconds]
sputnik13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rich_Morin_ has joined #ruby
rippa has joined #ruby
cschneid has joined #ruby
tdy has joined #ruby
elcontrastador has quit [Read error: Connection reset by peer]
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
uplime has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
jcarl43 has quit [Quit: WeeChat 2.3]
cd has quit [Quit: cd]
brandonkal has joined #ruby
tag has joined #ruby
sarink has joined #ruby
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
hutch has quit [Ping timeout: 240 seconds]
sarink has quit [Ping timeout: 246 seconds]
cschneid has quit [Ping timeout: 272 seconds]
fatlotus has joined #ruby
hutch has joined #ruby
fatlotus has quit [Quit: Page closed]
Rich_Morin_ has joined #ruby
cschneid has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
tdy has quit [Ping timeout: 258 seconds]
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Xiti has quit [Ping timeout: 258 seconds]
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Xiti has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
am0123 has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
sputnik13 has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
sputnik13 has quit [Client Quit]
_whitelogger has joined #ruby
cschneid has joined #ruby
rindolf has joined #ruby
tiff has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
cschneid has quit [Ping timeout: 258 seconds]
Dbugger has joined #ruby
gix has joined #ruby
sarink has joined #ruby
cschneid has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikecmpbll has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
cthulchu has quit [Ping timeout: 258 seconds]
Nicmavr has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
Dbugger has quit [Remote host closed the connection]
rindolf has quit [Quit: http://www.shlomifish.org/ ; Some people grow older and wiser. Not I. I grow older and more foolish.]
mat_bug has joined #ruby
cschneid has joined #ruby
clemens3 has joined #ruby
dinfuehr has quit [Read error: Connection reset by peer]
dinfuehr has joined #ruby
gix has quit [Quit: Client exiting]
Dbugger has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid has quit [Ping timeout: 268 seconds]
dellavg_ has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 250 seconds]
reber has joined #ruby
uplime has quit [Ping timeout: 244 seconds]
Fernando-Basso has joined #ruby
reber has quit [Remote host closed the connection]
cschneid has joined #ruby
kapil____ has joined #ruby
Emmanuel_Chanel has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
themsay has joined #ruby
dinfuehr has quit [Remote host closed the connection]
dinfuehr has joined #ruby
sarink has quit [Ping timeout: 268 seconds]
mat_bug has quit [Remote host closed the connection]
mat_bug has joined #ruby
AJA4350 has joined #ruby
dinfuehr has quit [Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in]
dinfuehr has joined #ruby
cschneid has quit [Ping timeout: 245 seconds]
uplime has joined #ruby
mat_bug has quit [Ping timeout: 252 seconds]
sagax has quit [Ping timeout: 258 seconds]
yokel has joined #ruby
cschneid has joined #ruby
uplime has quit [Ping timeout: 240 seconds]
mostlybadfly has joined #ruby
lucasb has joined #ruby
cschneid has quit [Ping timeout: 240 seconds]
sagax has joined #ruby
TheBloke has quit [Read error: No route to host]
TheBloke has joined #ruby
ua__ has quit [Ping timeout: 268 seconds]
ua__ has joined #ruby
TheBloke has quit [Ping timeout: 250 seconds]
cschneid has joined #ruby
TheBloke has joined #ruby
Fernando-Basso has quit [Read error: Connection reset by peer]
apparition has joined #ruby
cschneid has quit [Ping timeout: 245 seconds]
paraxial has quit [Ping timeout: 258 seconds]
tlaxkit has joined #ruby
uplime has joined #ruby
Rich_Morin_ has joined #ruby
conta has joined #ruby
cow[moo] has quit [Ping timeout: 246 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
klaas has quit [Quit: ZNC - http://znc.sourceforge.net]
conta1 has joined #ruby
uplime has quit [Ping timeout: 240 seconds]
conta1 has quit [Ping timeout: 250 seconds]
am0123 has quit [Ping timeout: 240 seconds]
mostlybadfly has joined #ruby
cschneid has joined #ruby
apparition has quit [Quit: Bye]
uplime has joined #ruby
drale2k_ has joined #ruby
sarink has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
sarink has quit [Ping timeout: 250 seconds]
lightstalker has quit [Ping timeout: 244 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
lightstalker has joined #ruby
cschneid has quit [Ping timeout: 244 seconds]
klaas has joined #ruby
moei has quit [Ping timeout: 246 seconds]
davidw has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
uplime has quit [Ping timeout: 258 seconds]
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
roelof has joined #ruby
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
<roelof> is VSCode a good ide on Windows. Im thinking of starting with the Odin project to learn ruby and ruby on rails ?
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
hanmac has joined #ruby
cschneid has joined #ruby
<up|ime> it's not an ide, it's a text editor
<up|ime> but sure, it'll work
<havenwood> roelof: Yes, VSCode should be a good text editor. Or take a look at Atom.
<up|ime> Last time I tried RubyMine (the Jetbrains IDE) it sucked badly, 2 or so years ago
<roelof> oke, I used it for learning haskell I use vscode also
<roelof> is there some sort of tutorial what I need to make my first steps with ruby
<roelof> I can do that one also
<roelof> earlier I used rubyMonk but that one does not work properly anymore :(
PCiobanita has joined #ruby
<PCiobanita> hi there. I am new here but I need some help with ruby sinatra. Been stuck here for the past few days. I need to solve this in the next few hours. It shoulnt take to long if somone can and is willing to help let me know. also new to the platform.
<havenwood> PCiobanita: What issue are you running into?
<havenwood> ?ask
<ruby[bot]> Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
segy has quit [Ping timeout: 245 seconds]
<roelof> tryRuby is easy. I think I will start wit the Odin project
<roelof> is Atom much better then the VSCode ?
sagax has quit [Ping timeout: 258 seconds]
<PCiobanita> the issue I have is passing params from textarea into sql query. If i hardcode the messege it works. but when i try to use params form from it says undifined method for asnwer class. although it chould work. becuase if I manually post it into PG it actually prints. If i could share mys creen woulve been easier to explain. What i would like is somoen that can help me over discord for like 10 min. if is not to much of an ask. I am q
Rich_Morin_ has joined #ruby
<PCiobanita> I am quite new so i dont know how to be specific with my issues
<phaul> no chance to discord with me, but I would take a look at the code if you shared your code one way or an other. github, gists, bitbucket or whatever you like.
segy has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
hutch has joined #ruby
<phaul> usually it's a good idea to come with links to the code to IRC
m4rCsi has quit [Remote host closed the connection]
roelof has quit [Quit: Page closed]
kapil____ has joined #ruby
cschneid has quit [Ping timeout: 246 seconds]
<PCiobanita> https://github.com/ianhawe/Automated-SQL-Checker this is the github I am working on dev_02_post branch. That is where the controller and models for what i am doing are
<PCiobanita> the code is not dry at all so might be a bit hard to undertsnd
<phaul> cool, np, Im sure a few of us will take a look
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> which view file contains the form? which handler in sinatra is triggered by the post?
<PCiobanita> question_one_page.erb
<PCiobanita> answer.rb post
<PCiobanita> question.rb is also used on form but that is to show questions from database
<phaul> have you verified that params contain the expected param hash in the handler? what happens if you put a 'p params' at https://github.com/ianhawe/Automated-SQL-Checker/blob/90a637ee22296b10b79899635586fe3d82559a7e/controller/sql_controller.rb#L53
dellavg_ has quit [Ping timeout: 258 seconds]
AJA4350 has joined #ruby
<PCiobanita> i know the params are empty they are nil
drale2k_ has joined #ruby
<PCiobanita> i think I am not sure.... I dont rly know how to check tbh
<PCiobanita> i think i should say that i started with ruby 2 weeks ago
<PCiobanita> a lot of debugging and stuff is new to me
Cthulu201 has quit [Ping timeout: 272 seconds]
<phaul> no problem. I try to run it over here, and try to rerpoduce it myself
<phaul> btw, you came a long way in just 2 weeks!
Cthulu201 has joined #ruby
<PCiobanita> thank you but I feel like tomorrow I wont have much to show for it
idiocrash has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<phaul> first thing I hit is that your sql file creates SpartaSQLApp but your app connects to spartaappsql
<PCiobanita> yes i am connected trhough postgress
<PCiobanita> and in postgress i made the app with spartaappsql. it works and is connected, I just made the db manually in postgress
<PCiobanita> db name is correct for testing purposes
<phaul> nvm, it's just that the database name mismatches at those two places
<PCiobanita> I am not actually using the seed file atm
tlaxkit has quit [Quit: Saliendo...]
<phaul> ok I see one issue
<PCiobanita> yeah I shoulve removed that. I know the issue with that. is outside the loop
uplime has joined #ruby
hanmac has quit [Ping timeout: 258 seconds]
<phaul> second issue: the server is getting GET requests on submit not POST.
<phaul> therefore the post handler in sinatra doesn't run
<phaul> you should see this on your side if you look at the server log. When you submit your form the server outputs "GET .. " on the console
<PCiobanita> yeah but the post stil runs
<PCiobanita> it does run get but also post. if i were to change the sql with hardcoded number and string it would post it in the database
mostlybadfly has quit [Quit: Connection closed for inactivity]
<phaul> it runs post if you see POST in your server logs. You don't - correct?
<PCiobanita> i do
<PCiobanita> i see post
<PCiobanita> in log
<phaul> ok.
davidw has quit [Ping timeout: 268 seconds]
<phaul> the main issue is that the way forms work is that you need a form per question. you have a single form and many submit buttons in it, one per question. The way to do this is to have a separate form per question, and the submit button in the form would send up the data from the form that it is in
<PCiobanita> but is a loop it creates a seperate from for each question
<phaul> no, the loop is inside the single form tag
<PCiobanita> if injects array with question and for each it ptints the question the adds a textarea and then add a submit button
<PCiobanita> not the answer loop but the other one
<phaul> Im talking about the literal <form> tag. that is outside
<PCiobanita> a bit above is the @poosts loop
<PCiobanita> the one inside just loops the answers to match it with question id
tdy has joined #ruby
<phaul> ah Im blind. I take that back.
<PCiobanita> no worries I am horible in making my coide dr
<PCiobanita> code dry* is supper messy
orbyt_ has joined #ruby
<phaul> ok you have a form outside of everything. that causes issues. Please remove that
<PCiobanita> removed it... i didnt make the erb's to be fair
<phaul> i removed that form tag from outside and I can confirm the params are correctly sent up to the post handler
<phaul> the outside post tag screwed up firefox and made the submit a GET request.
<phaul> you might not be on firefox, so you might see slightly different behaviour
<phaul> but it was wrong anyway
<PCiobanita> what would I have to type in the sql inside the answer post. in the save function
<PCiobanita> answer model sorry
<phaul> what is the error that you are now getting/
<phaul> ?
<PCiobanita> undifined method for student answer
<phaul> read carefully the error report. the word student
<PCiobanita> NoMethodError at /question/1 undefined method `sudentanswer' for #<Answer:0x00007fbb4e31f158> Did you mean? studentanswer studentanswer=
<phaul> sudent vs student
<PCiobanita> oh
<phaul> our brains are programmed to fix spelling errors for us, it's really hard to spot especially if you wrote it
uplime has quit [Ping timeout: 240 seconds]
<PCiobanita> i feel like an idiot
<phaul> dont. its very typical in programming,
<phaul> happens to everybody
<PCiobanita> it works now the next issue is how to take the id.. from the first loop
<PCiobanita> so i can match in the database the answer to the question id
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<PCiobanita> thank you btw
lucasb has quit [Quit: Connection closed for inactivity]
<phaul> np. I dont know your background, but what you are working with after 2 weeks is pretty impressive. I would argue that you are maybe progressing too fast. Is this some course exercise? Did you have a programmer background ?
conta has quit [Quit: conta]
<PCiobanita> no i just enroled into a bootcamp.. so i can learn programing
<PCiobanita> and it has 2 courses sql and ruby so I am trying to develop a app that checks querys automatically. I think it has evreything login, a bit of front end backend.. so i thought is good to practice all these diff parts
sagax has joined #ruby
<PCiobanita> <phaul> if u are still here can u tell me how should i go to take the post.id from the first loop on each submit
<phaul> let me think
<PCiobanita> i wanna match the answer with the questionid
orbyt_ has joined #ruby
<PCiobanita> ok
tdy has quit [Ping timeout: 250 seconds]
hutch has quit [Ping timeout: 250 seconds]
<phaul> I think this bit is conceptually broken: <% if(post.id == answer.id) %>
<phaul> <%= answer.studentanswer%>
<phaul> <% end %>
<phaul> the post is the question. the answer might be filled in might not, but shouldn't it be something like post.id == answer.post_id ? what is the id column of the answer table?
<PCiobanita> the reason is like this is beacuse i would like a student to be able to go back to the test and have the answers saved. so if the questionid from question table matches with questionif from answers place the answer there
<phaul> yeah, I get that part Im confused by the ids being equal? Is the answer.id a reference into post ? ( if so it's better to call it post_id )
dinfuehr has quit [Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in]
<PCiobanita> answer.id is question id.. which is foreign key of question.id from questiontable
<PCiobanita> answer and question have id primary and foreign key
<phaul> right. usually ppl call foregin keys, like <other_table>_id, it just confused me that's all. but now I get it
am0123 has joined #ruby
am0123 has quit [Remote host closed the connection]
<phaul> you could have a hidden form input with the id encoded in its value.
am0123 has joined #ruby
<PCiobanita> how would i make it hidden?
<PCiobanita> _HIDDEN?
<phaul> <input type="hidden" name="post_id" value="<%=post.id%>" />
<phaul> then read post_id out of params in the sinatra handler
cthulchu has joined #ruby
<PCiobanita> ill try
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
conta has quit [Ping timeout: 240 seconds]
Puffball has joined #ruby
<PCiobanita> no matter what i try it gives 0 in post.id
<phaul> do you mean in the controller side?
<phaul> we send up params[post_id]
<PCiobanita> it says it breaks the fkey cuz no questionid 0 in questiuon table
<PCiobanita> tehrefore it carries 0 as value
<phaul> push you code up to github, I take a look
dellavg_ has joined #ruby
<PCiobanita> dont
<PCiobanita> done
<PCiobanita> it doesnt work with <%=%>
<PCiobanita> nv,
<PCiobanita> sry it works
tdy has joined #ruby
<PCiobanita> i need the = my abd
<PCiobanita> bad
<phaul> ah, ok. no problem
<PCiobanita> nvm
<PCiobanita> it doesnt wok
<PCiobanita> i made the think unhidden it has the right number but stilll get same error
<PCiobanita> id is 0
houhoulis has joined #ruby
<PCiobanita> so if i have the input type not hidden it does print the correct number but when i take the params it doesnt work
<phaul> you have to have =
<phaul> <%= post.id %>
<phaul> and you have to move it inside the form tag
<PCiobanita> ok
<PCiobanita> ill try that
<phaul> the way form submitting works is that it gathers all input from the same form tag as the submit button was pressed in
<PCiobanita> it works thx a lot
<phaul> yw
tdy has quit [Ping timeout: 258 seconds]
duderonomy has joined #ruby
ua__ has quit [Read error: Connection reset by peer]
pskosinski has joined #ruby
orbyt_ has joined #ruby
themsay has quit [Ping timeout: 272 seconds]
ua has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
pskosinski has quit [Ping timeout: 250 seconds]
<PCiobanita> so i managed to make something for tomorrow to show dude you took so much time to help me thx a lot
<phaul> you are welcome, if you feel stuck in the future #ruby is the place :)
dinfuehr has joined #ruby
dviola has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
am0123 has quit [Ping timeout: 258 seconds]
hutch has joined #ruby
hanmac has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 250 seconds]
sagax has quit [Ping timeout: 246 seconds]
rubydoc has quit [Remote host closed the connection]
tdy1 has joined #ruby
rubydoc has joined #ruby
<phaul> &>> RUBY_VERSION
<rubydoc> # => "2.6.0" (https://carc.in/#/r/5zo5)
<phaul> &>> (1..)
<rubydoc> # => 1.. (https://carc.in/#/r/5zo6)
<phaul> thanks jhass
tiff has joined #ruby
sagax has joined #ruby
DTZUZO has quit [Ping timeout: 244 seconds]
reber has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
reber has quit [Remote host closed the connection]
Nicmavr has joined #ruby
mostlybadfly has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy2 has joined #ruby
xlued has quit [Read error: Connection reset by peer]
hutch has quit [Ping timeout: 258 seconds]
tdy1 has quit [Ping timeout: 250 seconds]
xlued has joined #ruby
hutch has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
nowhere_man has quit [Ping timeout: 252 seconds]
nowhere_man has joined #ruby
hanmac has quit [Ping timeout: 240 seconds]
noboruma has joined #ruby
davidw has joined #ruby
am0123 has joined #ruby
cthulchu has quit [Ping timeout: 268 seconds]
xlued has quit [Read error: Connection reset by peer]
xlued has joined #ruby
sarink has joined #ruby
tdy2 has quit [Ping timeout: 252 seconds]
xrexeon has joined #ruby
xrexeon has quit [Remote host closed the connection]
xrexeon has joined #ruby
xrexeon has quit [Client Quit]
xlued has quit [Read error: Connection reset by peer]
xlued has joined #ruby
dellavg_ has quit [Ping timeout: 272 seconds]
bmurt has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.3]
dviola has quit [Quit: WeeChat 2.3]
sarink has quit [Remote host closed the connection]
al2o3-cr has joined #ruby
sarink has joined #ruby
cthulchu has joined #ruby
sarink has quit [Ping timeout: 250 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
orbyt_ has joined #ruby
xlued has quit [Remote host closed the connection]
s3nd1v0g1us has joined #ruby
am0123 has quit [Ping timeout: 258 seconds]
uplime has joined #ruby
uplime has quit [Quit: please direct all IRC questions to c]
lxsameer has quit [Ping timeout: 250 seconds]
gigetoo has quit [Ping timeout: 268 seconds]
gigetoo has joined #ruby
s3nd1v0g1us has quit [Quit: WeeChat 2.2]
xlued has joined #ruby
bmurt has joined #ruby
bmurt has quit [Client Quit]
ellcs has quit [Ping timeout: 268 seconds]
bmurt has joined #ruby
bmurt has quit [Client Quit]
r3m has quit [Quit: WeeChat 2.4-dev]
r3m has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clemens3 has quit [Ping timeout: 246 seconds]