Activity Graph

Page 1 of 4 | Next »


[04:38:53] garyserj: Ping timeout: 258 seconds


[23:30:19] garyserj: &>> def abc x,y; end; abc 4,{"aa":"bb"} {}
[23:30:46] garyserj: why can't I pass a block there?
[23:37:23] garyserj: what's the rule re when passing a block requires parens?
[23:39:47] garyserj: oh yeah, ok, thanks
[23:40:25] garyserj: i knew i remembered passing a block without parens. was via do end
[23:41:27] garyserj: or a no parameter situation
[23:44:27] garyserj: And if i want to pass more than one hash then I need parens, unless it's a keyword argument, right?
[23:47:30] garyserj: and a keyword argument is not a hash, right?
[23:47:45] garyserj: (i'm aware that a hash can be automatically converted to a keyword argument)


[00:24:14] garyserj: when you pass a key-value pair as an argument to a parameter where the parameter is of the form blah not blah: then is it still called a keyword argument, or just a hash?
[02:46:44] garyserj: leftylink: well, if it converts hash to keyword argument, how are we meant to know if it's passing a hash or a keyword argument, when curly braces are omitted?
[03:00:48] garyserj: we are talking about functions with empty bodies here
[03:08:14] garyserj: i'm not asking what the function is doing with the arguments though
[03:09:26] garyserj: to rephrase. If Ruby is converting hash to keyword argument, how are we meatn to know if Ruby i passsing a hash or a keyword argument to a function when curly braces are omitted?
[12:31:35] garyserj: &>> puts "asdf"
[12:33:29] garyserj: leftylink: your line works in ruby 2.4.1
[12:44:01] garyserj: &>> def abc(x:, y); end
[12:44:10] garyserj: &>> def abc(x, y:); end
[12:44:20] garyserj: Why does the first one fail?
[12:47:51] garyserj: does have a table of contents by which i'd find that methods_rdoc.html ?
[12:49:09] garyserj: looks like the 'pages' section is about as close to a table of contents as it gets, ok i guess.
[12:50:57] garyserj: ah the syntax page is pretty much it and that links to others.


[16:04:59] garyserj: i have a method jkl that takes 3 parameters. I do jkl 3,4,{puts "x"} it gives an error. why?
[16:08:19] garyserj: do you always need parentheses around prior parameters?
[16:08:27] garyserj: when passing a block
[16:43:34] garyserj: I have def abc. when I call it, this doesn't give an error abc do puts blahrandom end any idea why?
[16:44:01] garyserj: blahrandom could be asfsdfd just a non-existant variable
[16:45:06] garyserj: I guess it only becomes an error when it runs
[16:45:27] garyserj: yeah, i see now, only an error when it runs so when i do yield
[18:09:15] garyserj: if i have a method def abc x, and hash with more than one key-value pair, then let's say I want to do the call without parentheses, so I guess then a hash cannot then have curly braces? is it possible to pass the hash? abc "f":1 works, but abc "f":1,"g":2 and it thinks i'm passing multiple arguments. If I want to pass as one hash do I have to use {} and then have to use parentheses?
[18:13:48] garyserj: ah, thanks.
[18:14:52] garyserj: so if i wanted to pass two hashes would i need parens?
[18:16:19] garyserj: what is 'keyword argument style'?
[18:16:53] garyserj: well, you showed omitting curly braces and omitting parens
[18:17:00] garyserj: and you showed colon.
[18:17:03] garyserj: ok i illw, thanks


[05:25:33] garyserj: has joined #ruby


[22:33:42] garyserj: Ping timeout: 272 seconds


[01:31:49] garyserj: has joined #ruby
[01:33:45] garyserj: is this a valid json? JSON.parse('{"a":"1","a":"2"}') (I ask because I notice that in irb when I do require 'json', and I enter that line, it shows only {"a"=>"2"}


[11:48:44] garyserj: Ping timeout: 244 seconds


[10:38:56] garyserj: has joined #RubyOnRails
[10:44:58] garyserj: how does date-remote="true" work like <a href="/blah" data-remote="true">abc</a> I had thought that data-remote was a rails thing but I see it in the html. So what is causing the web browser to make the GET request via AJAX rather than the usual method that causes a webpage to load?
[11:05:18] garyserj: ah, so javascript is rewriting the link into one that uses ajax.. is it possible to see what rails-ujs converts it to?


[03:06:28] garyserj: Ping timeout: 252 seconds


[13:29:50] garyserj: when would you use throw/catch for flow control as opposed to an if statement?
[13:31:39] garyserj: why does this give a syntax error? [3,2,1].each {|x| puts x.to_s; puts x.to_s}
[13:33:35] garyserj: ah how strange. it works in irb and fails in byebug
[13:36:54] garyserj: byebug has some strange issue with a semi-colon, so in byebug you have to do [3,2,1].each { |x| puts x.to_s\; puts x.to_s }
[13:37:09] garyserj: i.e. escaping the semi-colon
[13:50:49] garyserj: why is there a cookies(plural) command, to show all cookies. But not a sessions(plural) statement, to show all sessions?


[10:51:54] garyserj: I know the alert line works though because when sending a message from server to client, I trigger it. It's just that the last line in the coffeescript, which is meant to send from client to server, is not triggering that received method, / is not causing an alert
[10:51:54] garyserj: that last line doesn't seem to cause an alert, so it doesn't seem to trigger the received method
[10:51:54] garyserj: but that last line isn't working
[10:51:54] garyserj: I am trying to use action cable. I got the server to send to the client. But I also want the client to send to the server. I tried this in my coffeescript file
[10:52:04] garyserj: sorry not sure why it put that on so many new lines but anyhow.


[05:33:49] garyserj: aaa={a::abc} so i'm a but confused over what that syntax id: :email means in terms of ruby?
[05:33:49] garyserj: this is a ruby question rather than a rails question, but i see this syntax in rails form.text_field :email, id: :email, class: :email and it puzzles me 'cos id: :email looks to me like a key value pair (is it?), but if I try in irb aaa={:a=>:4} that doesn't work. It looks like the value(of the key value pair) can't be a symbol, only the key is. You can say aaa={a:"abc"} but not
[05:44:20] garyserj: has joined #RubyOnRails
[07:29:07] garyserj: havenwood: thanks
[07:56:26] garyserj: I have a method ddd that takes two parameters. And I try to call it ddd {:g=>"aaa"},{:r=>"www"} but why does that give a syntax error regarding => and }?
[08:10:17] garyserj: havenwood: ok, thanks
[08:19:38] garyserj: ddd {:g=>"aaa"},({:r=>"www"}) <-- that also gives an error
[08:58:40] garyserj: thanks. I can see now how if the last argument contains {..} then you need parens around the arguments list, but why does this give a syntax error ddd {:g=>"aaa"},r:"www" My last argument has no {...} so why is there an issue?
[09:00:59] garyserj: ziyadb: you mean the difference?
[09:06:05] garyserj: i see a form for creating an new user, and a search form.. the new user one uses a post , the search form uses a get.. so is your question why the search form uses GET? Maybe you can share the code that produced the search form?
[09:29:46] garyserj: ryouba: i don't know, but any idea with my question, it looks easier?
[09:42:28] garyserj: ah ok, thanks.. so any { } for a hash, in any of a method's arguments, requires parens around the list of arguments?
[09:51:01] garyserj: phaul: suppose i do want to pass a block then, followed by a value. ddd {a=1},2 gives an error
[09:55:04] garyserj: so since a block can only be in the last position, why should a {} for a hash in an argument prior to the last position, cause a need for parens around all arguments?
[09:56:45] garyserj: similarly, if {block},r makes no sense, then why isn't it seen as {hash},r Why should it attempt to view an argument prior to the last argument, as a block. There is no ambiguity with an argument prior to the last argument
[09:58:05] garyserj: sounds primitive to state there's a syntax error without reading as far as the end of the line
[10:00:36] garyserj: well, if other languages do that, it doesn't seem so absurd 'cos they don't try to be clever like ruby does with skipping parens (skipping parens on a basis of ambiguity, when the interpreter isn't really spotting ambiguity properly 'cos it doesn't read to the end of a line)
[10:02:09] garyserj: ryouba: yeah well sometimes I have to read other code, like the scaffolding rails generates.
[10:37:01] garyserj: So how is it deciding whether to show a blank form or a form with a user's data? rail generate scaffold uses form_with and a file _form.html.erb which uses the same generic form for new user or editing a user, and it somehow knows what to fill the form with, but I can't see how
[10:37:01] garyserj: I can see how form_for knows whether to show a blank form, or the form with user's data, 'cos it is based on variable e.g. form_for @user and if or if e.g. user=User.all[0] Then it responds accordingly. But I understand that now form_for is replaced with form_with which has the header of form_with(model: user, local: true) do |form| So, it's not looking at a variable @user
[10:42:01] garyserj: I can't see a value ever being assigned to a variable user.. i'm looking in the user_controller.rb and in _form.html.erb
[10:44:30] garyserj: if the variable were local to the form, then how would the form know?
[10:44:54] garyserj: (I think it's the same form used for whether the user clicks edit, or whether the user clicks to create a new user)
[10:45:17] garyserj: oh I see I think it's passing a variable in
[10:50:37] garyserj: thanks.. also, when I look at the html of the form with the update button, it says method="post", whereas rails routes indicates that the acion should be 'put'. So why does it have method="post"?
[11:01:43] garyserj: wow, thanks
[11:02:08] garyserj: yeah i see now, ta


[16:50:09] garyserj: *.net *.split


[23:17:28] garyserj: has joined #ruby


[02:42:28] garyserj: has joined #ruby
[02:55:18] garyserj: Ping timeout: 246 seconds


[02:39:58] garyserj: Ping timeout: 246 seconds


[11:20:31] garyserj: has joined #ruby


[11:28:41] garyserj: has joined #ruby
[11:31:06] garyserj: Client Quit


[12:06:11] garyserj: Disconnected by services
[12:07:06] garyserj: has joined #RubyOnRails
[12:07:34] garyserj: where is rails located in mac osx? (i'm having trouble installing it so perhaps somebody can do which rails and let me know the path? thanks)
[13:18:28] garyserj: Ping timeout: 272 seconds


[14:01:38] garyserj: has joined #ruby


[23:16:53] garyserj: has joined #ruby
[23:22:58] garyserj: has left #ruby: ()


[11:31:25] garyserj: has joined #ruby
[12:06:06] garyserj: Quit: garyserj


[03:56:57] garyserj: has joined #ruby
[04:09:18] garyserj: Quit: garyserj


[03:10:08] garyserj: Quit: garyserj


[05:22:41] garyserj: Quit: garyserj
[20:22:11] garyserj: has joined #ruby
[21:02:00] garyserj: Quit: garyserj
[21:46:26] garyserj: has joined #ruby


[20:41:04] garyserj: has joined #ruby


[00:00:29] garyserj: Quit: garyserj


[01:15:19] garyserj: has joined #ruby
[03:39:08] garyserj: Quit: garyserj
[03:41:41] garyserj: has joined #ruby
[06:07:24] garyserj: I am having difficulty programmatically sending the ENTER key. I am using IRB (ruby interactive). If I do driver.find_element(:name, "q").send_keys("aaa\n"); it sends the aaa but not the ENTER. If I do driver.action.send_keys("\n").perform. That doesn’t do it either. And if I do \u0006 and \u0007 instead of \n, it still doesn’t work. i’ve also tried b=driver.find_element(:tag_name, "body”); b.send_key “\n”; b.send_keys
[06:07:25] garyserj: “n”; but it hasn’t worked either.
[06:07:56] garyserj: (using Selenium and the firefox browser. sendkeys to the searchbox on
[07:26:27] garyserj: Quit: garyserj
[13:15:59] garyserj: has joined #ruby
[13:28:00] garyserj: Quit: garyserj
[13:32:59] garyserj: has joined #ruby
[14:47:56] garyserj: Read error: Connection reset by peer
[14:49:59] garyserj: has joined #ruby
[14:54:57] garyserj: Ping timeout: 268 seconds
[15:02:24] garyserj: has joined #ruby
[15:32:20] garyserj: Quit: garyserj
[16:06:56] garyserj: has joined #ruby
[16:38:13] garyserj: Quit: garyserj
[17:01:01] garyserj: has joined #ruby
[19:34:53] garyserj: Quit: garyserj
[23:17:03] garyserj: has joined #ruby
[23:35:55] garyserj: Quit: garyserj
[23:40:48] garyserj: has joined #ruby


[15:51:54] garyserj: has joined #ruby
[16:37:40] garyserj: Quit: garyserj
[16:47:49] garyserj: has joined #ruby
[17:31:51] garyserj: has joined #ruby
[17:51:10] garyserj: Quit: garyserj
[19:14:09] garyserj: has joined #ruby
[19:53:58] garyserj: Quit: garyserj


[13:42:43] garyserj: has joined #ruby
[14:01:03] garyserj: I notice that #rails has gone invite only
[14:01:43] garyserj: how can i make 'c' continue in pry-byebug?
[14:01:48] garyserj: why isn't it default anyway?
[14:04:15] garyserj: has joined #RubyOnRails
[14:56:24] garyserj: Ping timeout: 252 seconds


[12:23:57] garyserj: has joined #ruby
[12:28:43] garyserj: i'm having trouble getting pry byebug to work. I did require 'pry' and I did binding.pry, Then I run the program and it pauses, which is good. But I can't get it to step through the code. I tried c/continue, no use. I tried n/next. No use. I tried s/step, no use. I tried 'help' but i don't see a command to step!
[12:39:36] garyserj: ah i think require 'pry-byebug' and binding.pry do it
[13:14:08] garyserj: Ping timeout: 244 seconds


[10:17:05] garyserj: Ping timeout: 248 seconds


[22:59:04] garyserj: has joined #RubyOnRails
[23:00:06] garyserj: hi. i am on macos, my rails version is 5.1.6 How do I update it?
[23:02:33] garyserj: thanks. is there a good way of doing this so that I can still go back to 5.1 if need be?


[16:12:57] garyserj: Ping timeout: 264 seconds


[16:11:30] garyserj: Ping timeout: 244 seconds
[16:12:22] garyserj: has joined #ruby


[20:35:00] garyserj: Like I do rails c and Abc.create a few times to create some records. Then I do git add -A, and git status -s, and I don't see anything listed. It doesn't show any files having changed.
[20:35:00] garyserj: Why doesn't Git detect changes to a database and add them to commits?


[00:47:18] garyserj: rule for when you put .....belongs_to?
[00:47:18] garyserj: I notice that in the case of 1-M you put has_many in one model, and belongs_to in the other one. The one with the foreign key has the belongs_to. Whereas in the M-M case, you put has_and_belongs_to_many in both of them, even though neither has a foreign key. And you do a create_join_table :blahA, :blahB line in the migration file, and that table will have the foreign keys. So what's the
[01:23:35] garyserj: Alec: like the many to many relationship between Car and Driver
[01:24:01] garyserj: where a car can have many different drivers (man, wife, son). And a driver could have many different cars.
[01:25:15] garyserj: you write has_and_belongs_to_many in both Car and Driver. Even though Car doesn't have a foreign key to driver and Driver doesn't have a foreign key to Car. I guess it's because there is a foreign key somewhere (in this case, in a linking table)


[00:14:10] garyserj: has joined #RubyOnRails
[00:17:44] garyserj: in rails, should one be able to see an instance variable in one method when it was created in another method?
[00:17:57] garyserj: i know one can in ruby normally but for some reason i can't see it in rails
[00:26:22] garyserj: here is my code
[00:26:46] garyserj: I go to /qqq then /rrr I expect XaaaX but I get XX


[00:36:57] garyserj: Ping timeout: 240 seconds
[00:37:07] garyserj: has joined #ruby


[16:03:21] garyserj: has joined #RubyOnRails
[16:03:31] garyserj: the GET request?
[16:03:31] garyserj: Is the session dependent on the TCP three way handshake? When I make a new tab I notice that my session variable isn't cleared. Whereas if I start an incognito window in chrome then the session variable clears for that window. And if it is dependent on a three way handshake, then is there a way to tell the browser to not just make a get request, but to make a new three way handshake before
[16:18:01] garyserj: I know about the layers. I'll try to find the cookie.
[16:19:59] garyserj: ah, found the cookie. Thanks!
[16:20:16] garyserj: (I wanted to know how it worked, that was all.. but found the cookie now).


[22:58:37] garyserj: has joined #ruby


[15:15:00] garyserj: Ping timeout: 260 seconds


[03:14:10] garyserj: Ping timeout: 264 seconds
[03:15:03] garyserj: has joined #ruby


[15:12:33] garyserj: Ping timeout: 248 seconds
[15:13:05] garyserj: has joined #ruby


[00:23:41] garyserj: apeiros: thanks, yeah my edit action was treating the number in the edit url as an index to the array, rather than as an id.


[21:45:46] garyserj: has joined #RubyOnRails
[21:47:45] garyserj: why is it that when I go to and submit a form in edit.html.erb then when it goes to /posts/1 when it runs the update action? Why does it increment the id?


[00:15:10] garyserj: Ping timeout: 256 seconds
[00:15:49] garyserj: has joined #ruby


[18:49:28] garyserj: has joined #RubyOnRails
[18:50:13] garyserj: I heard that controller should be plural and model singular, but at this link I see he made the controller singular. Which should it be? Thanks


[02:47:13] garyserj: *.net *.split
[02:47:59] garyserj: has joined #ruby


[21:25:38] garyserj: has joined #ruby
[21:29:19] garyserj: does ruby have a distinction between a)class variables b)class instance variables c)instance variables ?
[21:46:42] garyserj: I heard that if an instance variable is in a class method, then it is a class instance variable
[21:53:46] garyserj: if an instance variable is not class-level, is it local?
[21:54:37] garyserj: okay so when an instance level is not at class level, what is its level?
[21:54:53] garyserj: I mean.. okay so when an instance variable is not at class level, what is its level?
[21:55:20] garyserj: when you say class-level instance variable, isn't that superfluous if you mean that all instance variables are class-level?
[21:56:20] garyserj: okay so are you suggesting that some instance variables are class level and some aren't?
[21:56:40] garyserj: so are some class level and some not? or are they all class level?
[22:02:36] garyserj: why do you keep mentioning class variables though?
[22:02:46] garyserj: when i'm asking about instance variables, and class-level instance variables
[22:02:57] garyserj: are you including "class-level instance variables" as your class variables?
[22:04:39] garyserj: are all instance variables shared among instance methods?
[22:05:15] garyserj: so what causes an instance variable to be 'class level'? is it use of it outside of any methods?
[22:11:38] garyserj: suppose an instance variable is sometimes used in instance methods and sometimes outside of them. Does the fact that it's sometimes used outside of them mean that it is always referred to as a class-level instance variable. Or is it only referred to as a class-level instance variable in the places where it is used outside of instance methods?
[22:26:30] garyserj: ah sorry was afk just reading now
[22:29:40] garyserj: heh, thanks
[22:33:07] garyserj: I know java so I know the difference between static and instance.
[22:34:59] garyserj: You wrote "If you define an instance variable on a thing that is itself an instance of Class," But what defines a variable though.. it seems in ruby you just write a statement like @a=4 and hey presto that defined it, but you may have @a=4 elsewhere. So which one defined it? the one that ran first I suppose?
[22:37:12] garyserj: so if an @ variable is defined outside of methods and within instance methods, then is it class-level or not?
[22:40:34] garyserj: okay so do you think that there aren't two types of instance variables?
[22:41:13] garyserj: class-level instance variables, and instance variables that aren't class-level.
[22:42:05] garyserj: no I mean only @/
[22:42:35] garyserj: I mean @ not @@.
[22:42:45] garyserj: @@ is not an instance variable of any kind.
[22:43:56] garyserj: I don't really understand myself.
[22:44:07] garyserj: I understand what you're saying though.
[22:44:23] garyserj: but some people speak of some instance variables being class-level, so it's more a question for them.
[22:45:26] garyserj:
[22:45:32] garyserj:
[22:45:37] garyserj: that speaks of class instance variables.
[22:46:24] garyserj: "A disadvantage of class instance variables is that they cannot be used within instance methods as class variables can. Another disadvantage is the potential for confusing them with ordinary instance variables. "
[22:46:52] garyserj: so that toptalkedbooks link has a clear distinctio between two types of instance variable
[22:47:50] garyserj: If a class has instance variables, that wouldn't mean we have two types of instance variables though?
[22:48:17] garyserj: that toptalkedbooks link is showing an instance variable within a method to be not class-level, whereas an instance variable outside of a method to be class-level
[22:49:08] garyserj: An instance method used in one method, isn't it completely accessible from another instance method, so same scope?
[22:49:32] garyserj: so are you suggesting there's a scope shared by instance methods, and a scope outside of instance methods, and they're different?
[22:53:26] garyserj: interesting, thanks
[22:54:54] garyserj: what a crazy language
[22:55:38] garyserj: java is so much simpler
[22:56:24] garyserj: in terms of static(non-instance) variables and instance variables. and strictness about where they are defined and their scope.


[00:58:20] garyserj: baweaver, havenwood: thanks


[02:57:01] garyserj: i'm looking at Net::FTP in Ruby. I don't see a copy command to copy from a file from one location on the ftp server, to another. So to copy should I 'get' and then 'put', or is there a better way?
[02:58:25] garyserj: does this chat have a log?
[02:58:32] garyserj: available online


[02:17:43] garyserj: has joined #RubyOnRails
[02:17:53] garyserj: people? I thought the controller should be singular and the table will be plural. Yet it has controller as plural.
[02:17:53] garyserj: I was looking on and it says form_tag({controller: "people", action: "search"}, method: "get", class: "nifty_form") But when try that in my erb file, I get this in my html form_tag(controller: "people", action: "search", method: "get", class: "nifty_form") which is clearly not valid html. Also, should my controller be called person or


[21:33:17] garyserj: has joined #ruby