« Back to channel list

#RubyOnRails - 13 June 2017

« Back 1 day Forward 1 day »
[00:00:28] joeyk: (so if there is a better way of dealing with that, please let me know.)
[00:17:15] brent__: If i did a query like so: Poster.joins("inner join authorships on authorships.authorable_id = posters.id").where("authorships.authorable_type = 'Poster").where("posters.state = 'published'")
[00:18:10] brent__: I want ot iterate through them and do poster.authorships, however it says authorships isn't a method, how can I access the authorships on the poster
[00:19:53] brent__: Poster is actually in the form of a ProxyPoster that just defines self.table_name = 'posters' so I don't have the normal authorships association available
[00:26:35] quirkycoders: has joined #RubyOnRails
[00:40:14] duderonomy: has joined #RubyOnRails
[00:40:31] quazimodo: has joined #RubyOnRails
[00:41:06] urkle: has joined #RubyOnRails
[00:46:44] Radar: joeyk: I want to blame the fact that it's oracle. I've got no experience with it and I don't have it installed so I am unable to reproduce it myself here.
[00:49:19] quirkycoders: has joined #RubyOnRails
[00:51:51] DoubleMalt: has joined #RubyOnRails
[00:54:12] chouhoulis: has joined #RubyOnRails
[00:56:34] ascarter_: has joined #RubyOnRails
[00:58:39] |PiP|: has joined #RubyOnRails
[00:58:54] |PiP|: if i have a serialized column, how can i access the actual serialized text/string that is stored in the database?
[00:59:27] quazimodo: has joined #RubyOnRails
[00:59:27] |PiP|: is there a way to access the raw data that was returned from the DB?
[00:59:54] joeyk: Radar: so.. it turns out, I was not able to recreate the issue in a test app. :|
[01:00:49] gusrub: has joined #RubyOnRails
[01:09:09] username1: has joined #RubyOnRails
[01:20:53] ascarter: has joined #RubyOnRails
[01:26:18] sevenseacat: has joined #RubyOnRails
[01:34:38] mikecmpbll: has joined #RubyOnRails
[01:41:06] PresidentBiscuit: has joined #RubyOnRails
[01:41:15] jane_booty_doe: has joined #RubyOnRails
[01:49:35] gusrub: has joined #RubyOnRails
[01:54:19] xx00__: has joined #RubyOnRails
[01:59:40] Scriptonaut: has left #RubyOnRails: ()
[02:00:22] Rodya_: has joined #RubyOnRails
[02:02:37] irishfromua: has joined #RubyOnRails
[02:10:22] Jameser: has joined #RubyOnRails
[02:16:57] gusrub: has joined #RubyOnRails
[02:27:41] ascarter: has joined #RubyOnRails
[02:31:24] Rodya_: has joined #RubyOnRails
[02:36:04] aperkins81: has joined #RubyOnRails
[02:36:36] greengriminal: has joined #RubyOnRails
[02:37:29] tentacle: has joined #RubyOnRails
[02:37:45] quirkycoders: has joined #RubyOnRails
[02:40:10] ascarter: has joined #RubyOnRails
[02:44:43] nesoi: has joined #RubyOnRails
[03:00:20] sandstrom: has joined #RubyOnRails
[03:05:10] fschuindt4: has joined #RubyOnRails
[03:06:48] tentacle: Hi, I'm having an issue deploying a Rails 5.1 app w/ webpack via Capistrano. I was hoping someone would be able to better understand the issue than I am. https://pastebin.com/dq6nXakY
[03:07:20] wethu: has joined #RubyOnRails
[03:07:26] Rodya_: has joined #RubyOnRails
[03:08:34] sevenseacat: looks like a yarn problem, not really capistrano
[03:09:41] tentacle: Yeah, I was just mentioning I'm using Capistrano. I'm not sure why Yarn is freaking out, I'm not even using anything from Webpack yet, it's a pretty blank config
[03:10:38] tentacle: I can precompile the assets just fine locally
[03:12:02] ascarter: has joined #RubyOnRails
[03:29:09] tofutoon: has joined #RubyOnRails
[03:34:48] ascarter: has joined #RubyOnRails
[03:39:54] wethu: has joined #RubyOnRails
[03:49:16] knight33: has joined #RubyOnRails
[03:49:19] ascarter: has joined #RubyOnRails
[03:49:54] patarr: has joined #RubyOnRails
[03:56:59] benlieb: has joined #RubyOnRails
[04:01:14] xx00__: has joined #RubyOnRails
[04:04:22] tentacle: has joined #RubyOnRails
[04:10:28] Rodya_: has joined #RubyOnRails
[04:11:52] mtkd: has joined #RubyOnRails
[04:24:18] Rodya_: has joined #RubyOnRails
[04:31:23] Rodya_: has joined #RubyOnRails
[04:32:09] tentacle: has joined #RubyOnRails
[04:35:00] Rodya_: has joined #RubyOnRails
[04:41:48] ascarter_: has joined #RubyOnRails
[04:44:39] jane_booty_doe: has joined #RubyOnRails
[04:56:47] roshanavand: has joined #RubyOnRails
[05:05:32] hnanon: has joined #RubyOnRails
[05:06:04] hnanon: I'm trying to do:
[05:06:15] hnanon: <%= link_to "Remote", remote_jobs_path, class: ("active" if current_page?(remote_jobs_path || remote_world_jobs_path )) %>
[05:07:26] hnanon: However, when I'm at remote_world_jobs_path, the "active" class is not applied.
[05:07:54] hnanon: I want it applied if the user is at remote_jobs_path or remote_world_jobs_path
[05:08:30] sevenseacat: what does current_page? take as an argument?
[05:09:49] sevenseacat: and what are you actually passing it?
[05:10:10] sevenseacat: are you passing it a path?
[05:10:30] hnanon: I guess, not exactly.
[05:10:42] sevenseacat: what does remote_jobs_path || remote_world_jobs_path equate to?
[05:11:33] hnanon: I'm not sure.
[05:11:43] sevenseacat: try it and see
[05:16:14] hnanon: has joined #RubyOnRails
[05:16:29] hnanon: sevenseacat: sorry, bad connection
[05:20:08] harfangk: has joined #RubyOnRails
[05:20:58] ascarter_: has joined #RubyOnRails
[05:46:29] Technodrome: has joined #RubyOnRails
[05:50:48] patarr: has joined #RubyOnRails
[06:08:24] xall: has joined #RubyOnRails
[06:18:49] xall: has joined #RubyOnRails
[06:20:12] adgtl: has joined #RubyOnRails
[06:20:43] ome: has joined #RubyOnRails
[06:20:45] jxf: has joined #RubyOnRails
[06:30:17] conta: has joined #RubyOnRails
[06:31:23] dionysus69: has joined #RubyOnRails
[06:33:28] dionysus69: Technodrome: It could be like that because of the in memory database (AFAIK django uses in memory db) but i dont know how it would handle relational tables without migrations.
[06:35:07] sevenseacat: ACTION raises an eyebrow
[06:56:44] quazimodo: has joined #RubyOnRails
[06:58:31] kies: has joined #RubyOnRails
[07:01:00] DoubleMalt: has joined #RubyOnRails
[07:01:54] DoubleMalt: has joined #RubyOnRails
[07:22:34] Pumukel: has joined #RubyOnRails
[07:24:40] DoubleMalt: has joined #RubyOnRails
[07:31:39] fcser_: has joined #RubyOnRails
[07:36:32] mikecmpbll: has joined #RubyOnRails
[07:36:46] sandstrom: has joined #RubyOnRails
[07:46:43] xhoy: we use the getting started for rails a lot in testing and experimenting, but it always take a little work to recreate the blog everytime, is there a repo with the guides version of the blog ?
[07:47:07] srinidhi: has joined #RubyOnRails
[07:49:19] sevenseacat: built it once, check it into your own repo?
[07:49:33] xhoy: yeah thats an option
[07:49:56] xhoy: thought maybe somebody did that for me, or i could pass some param with the command :)
[07:50:07] xhoy: lets create a repo then!
[07:51:40] patarr: has joined #RubyOnRails
[07:56:15] futilegames: has joined #RubyOnRails
[07:56:17] AzaToth: has joined #RubyOnRails
[07:56:22] nertzy: has joined #RubyOnRails
[07:58:07] rgr_: has joined #RubyOnRails
[08:00:31] DoubleMalt: has joined #RubyOnRails
[08:02:13] [spoiler]: has joined #RubyOnRails
[08:03:10] _moep_: Hey, during the upgrade from my redmine host, my system was confused and installed few RVM packages, which I removed it. But now I got these e-mails: https://paste.debian.net/hidden/ce8cf9a3/ How can I fix this?
[08:03:21] leeky: has joined #RubyOnRails
[08:04:39] universa1: _moep_: you have some cron task or whatever running?
[08:04:56] universa1: _moep_: see the last line of your gist.
[08:05:41] _moep_: yes I have, but not related to rvm
[08:06:03] universa1: well, something is trying to execute a rvm ruby.
[08:06:07] universa1: find out what.
[08:07:40] _moep_: I added the rvm stuff into path
[08:08:20] universa1: be aware if you run this from a crontab, the cron tasks usually run in a very "limited" env.
[08:08:46] _moep_: yes, I know
[08:11:36] quazimodo: has joined #RubyOnRails
[08:13:46] nertzy: has joined #RubyOnRails
[08:14:52] ascarter_: has joined #RubyOnRails
[08:16:08] _moep_: universa1: thx problem fixed
[08:16:18] universa1: _moep_: yw :-)
[08:16:33] tofutoon: has left #RubyOnRails: ()
[08:17:05] marr: has joined #RubyOnRails
[08:20:17] ferr1: has joined #RubyOnRails
[08:21:37] gremax: has joined #RubyOnRails
[08:22:32] drale2k_: has joined #RubyOnRails
[08:28:27] nertzy: has joined #RubyOnRails
[08:31:27] fschuindt4: has joined #RubyOnRails
[08:32:26] arBmind: has joined #RubyOnRails
[08:43:15] lxsameer: has joined #RubyOnRails
[08:45:35] Subfusc: has joined #RubyOnRails
[08:47:20] dionysus69: has joined #RubyOnRails
[08:56:00] quirkycoders: has joined #RubyOnRails
[09:07:57] drale2k_: has joined #RubyOnRails
[09:11:01] ur5us: has joined #RubyOnRails
[09:15:36] ascarter_: has joined #RubyOnRails
[09:16:30] quirkycoders: has joined #RubyOnRails
[09:19:37] xall: has joined #RubyOnRails
[09:35:56] nertzy: has joined #RubyOnRails
[09:37:01] Takumo: has joined #RubyOnRails
[09:41:43] Takumo: Hi all, I'm using devise with a custom registration controller, and I'm creating other records transactionally with the devise resource. How can I correctly fail if one of the other resources being created fails?
[09:42:01] Takumo: I've tried super.resoure({}) but that tries to create the resource, and I just want to go back to the page with an error message.
[09:48:25] universa1: has joined #RubyOnRails
[09:50:31] DoubleMalt: has joined #RubyOnRails
[09:52:37] patarr: has joined #RubyOnRails
[09:57:23] quirkycoders: has joined #RubyOnRails
[10:05:23] dminuoso: Takumo: !rule3
[10:05:23] helpa: Takumo: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[10:05:45] dminuoso: I do not know what super.resoure({}) means.
[10:08:02] Takumo: here's the gist of it https://gist.github.com/LeoAdamek/a0f188b844b1cbbd1717b441f33729db
[10:08:28] nertzy: has joined #RubyOnRails
[10:11:19] sevenseacat: I wouldn't take that approach - I'd customize the params that devise accepts and then use accepts_nested_attributes_for to build the user and team and the same time
[10:11:51] sevenseacat: https://github.com/plataformatec/devise/#strong-parameters
[10:11:54] Takumo: so add an accepts_nested_attributes_for to the user model?
[10:16:47] drale2k_: has joined #RubyOnRails
[10:18:18] quirkycoders: has joined #RubyOnRails
[10:18:23] Takumo: is there something else I need to configure so that when `resource` gets initializde the `team` is also initialized?
[10:18:28] Takumo: otherwise `resource.team` is nil
[10:19:02] sevenseacat: not a mindreader and can't see the changes you've made
[10:19:22] Takumo: in the view, so I can't do `fields_for resource.team` because, at that point, only `resource` is initialized, it doesn't have an associated `team`
[10:19:45] sevenseacat: `f.fields_for :team`, the same way you would any nested form
[10:20:02] sevenseacat: you'll still have to build a new team instance in the `new` action
[10:21:11] nertzy: has joined #RubyOnRails
[10:25:23] Takumo: with acceptes_nested_attributes_for, I assume that the outer resource gets created first and then the inner resource is created with the foreign key to the outer resource?
[10:26:12] Takumo: Or are the inner resources created without a foreign key first, then the outer resource is created, with the inner resources then linked to the outer resource? (Also assuming this all happens inside a DB transaction?)
[10:28:15] mikecmpbll: has joined #RubyOnRails
[10:29:53] sevenseacat: they're both validated, and if they're both valid, they both get inserted in a transaction.
[10:31:39] m_abdelfattah: has joined #RubyOnRails
[10:31:49] m_abdelfattah: I've a legacy table with column called `class`, which causes problems in the model and activeadmin. Is there any fix than renaming the column? something like `inheritance_type` for columns named `type`
[10:32:23] ascarter_: has joined #RubyOnRails
[10:35:56] dminuoso: sevenseacat | not a mindreader
[10:35:59] dminuoso: ACTION sad panda
[10:38:25] Takumo: sevenseacat: ok, I think I've got the idea now, just got to untangle the mess my previous implementation has left
[10:38:30] tbuehlmann: Takumo: add inverse_of to both models (one might suffice, but let's try it with both first)
[10:41:03] Takumo: tbuehlmann: just tried searching the docs (both Ruby and Rails) but got nothing for inverse_of, what does it do?
[10:48:27] Takumo: hmm, well the User is getting created, but there's nothing trying to create the team...
[10:50:02] sevenseacat: Takumo: we're still not mindreaders.
[10:50:27] patarr: has joined #RubyOnRails
[10:51:06] futilegames: has joined #RubyOnRails
[10:59:13] loechel: has joined #RubyOnRails
[11:08:26] ur5us: has joined #RubyOnRails
[11:08:27] Fernando-Basso: has joined #RubyOnRails
[11:16:29] DoubleMalt: has joined #RubyOnRails
[11:18:42] m_abdelfattah: I've a legacy table with column called `class`, which causes problems in the model and activeadmin. Is there any fix than renaming the column? something like `inheritance_type` for columns named `type`
[11:18:54] arBmind: has joined #RubyOnRails
[11:19:52] charlielor: has joined #RubyOnRails
[11:21:09] tbuehlmann: Takumo: inverse_of is an option you can provide to has_many and belongs_to
[11:26:08] HoierM: has joined #RubyOnRails
[11:35:41] Fernando-Basso: has joined #RubyOnRails
[11:37:56] dionysus69: my first full https site :D :) https://webgen.tk/ hosted on a home computer :)
[11:41:25] ascarter_: has joined #RubyOnRails
[11:50:33] drale2k_: has joined #RubyOnRails
[11:59:33] Ergo: has joined #RubyOnRails
[12:08:02] drale2k_: has joined #RubyOnRails
[12:14:08] quazimodo: has joined #RubyOnRails
[12:24:52] pupsicle: has joined #RubyOnRails
[12:26:09] ghormoon: has joined #RubyOnRails
[12:26:30] kitsuneyo: has joined #RubyOnRails
[12:26:48] kitsuneyo: Is there a better way to write this: `params[:include] ? params[:include] : default`
[12:30:12] wethu: has joined #RubyOnRails
[12:31:02] wethu: has joined #RubyOnRails
[12:31:36] sevenseacat: there sure is.
[12:31:44] kitsuneyo: Is it `params[:include].presence || default` ?
[12:31:50] wethu: has joined #RubyOnRails
[12:32:33] universa1: .fetch(:include, 'default'
[12:32:37] wethu: has joined #RubyOnRails
[12:33:01] tbuehlmann: that's not the same as the first piece of pasted code though
[12:33:22] wethu: has joined #RubyOnRails
[12:34:05] tbuehlmann: if you need the truthyness of your first pasted piece of code, there's probably not a better way to write this (beside styling prefs)
[12:34:35] wethu: has joined #RubyOnRails
[12:34:41] universa1: tbuehlmann: ohh... little edge case ;)
[12:34:41] tbuehlmann: so, totally up to your requirements
[12:34:54] tbuehlmann: yeah, it's always the little edge cases
[12:35:49] universa1: but given it is params ;)
[12:36:31] dminuoso: Who knows what params is.
[12:36:57] universa1: no one knows ;)
[12:37:07] mikecmpbll: has joined #RubyOnRails
[12:37:52] dminuoso: kitsuneyo: Anyway. `params[:include] || default' is the shorter equivalent of your original code. Note that *technically* it may not be equal.
[12:38:06] dminuoso: kitsuneyo: reason being the first one executes params.[](:include) twice
[12:38:28] dminuoso: (Or potentially rather)
[12:38:46] dminuoso: But as long as params[:include] doesn't mutate anything it won't matter.
[12:38:57] dminuoso: But seeing as we don't know what params is, it's hard to say.
[12:40:00] drale2k_: has joined #RubyOnRails
[12:41:39] kitsuneyo: Thanks dminuoso and others
[12:48:13] ascarter_: has joined #RubyOnRails
[12:50:06] kitsuneyo: How about this. I want to return either params[:include] if present, a default_includes variable if present, or nil if neither of the others are there. Would that just be `params[:include] || default_includes || nil` ?
[12:50:30] dminuoso: kitsuneyo: that depends on how you define "present"
[12:50:42] dminuoso: kitsuneyo: Do you mean the key is present? Or whether the value is truthy?
[12:51:09] kitsuneyo: dminuoso, whether the key is present
[12:51:10] dminuoso: and "a default_includes variable if present" probably doesnt mean what you think it means.
[12:51:14] dminuoso: kitsuneyo: Then no.
[12:51:43] dminuoso: kitsuneyo: So if you have something like GET foo?quux=
[12:51:47] dminuoso: kitsuneyo: is quux present in your eyes?
[12:51:55] shotbug: has joined #RubyOnRails
[12:52:36] kitsuneyo: Hmm. I guess not.
[12:53:33] dminuoso: So you care whether the value is truthy or not.
[12:53:45] dminuoso: kitsuneyo: Next up. What do you mean by "a default_includes variable if present"
[12:54:03] kitsuneyo: I mean whether it's set in the controller
[12:54:13] dminuoso: variables are introduced lexically.
[12:54:29] dminuoso: Do you mean whether it's nil or not?
[12:58:10] kitsuneyo: dminuoso I mean whether it's defined or not
[12:58:44] uksio: has joined #RubyOnRails
[13:00:47] arup_r: has joined #RubyOnRails
[13:02:38] dminuoso: kitsuneyo: I do not think you mean that.
[13:02:58] svetlozaurus: has joined #RubyOnRails
[13:04:56] chouhoulis: has joined #RubyOnRails
[13:07:17] kitsuneyo: dminuoso, yeah I'm hopeless with Ruby terminology
[13:08:05] drale2k_: has joined #RubyOnRails
[13:08:14] arup_r: kitsuneyo: 👋
[13:11:01] dminuoso: kitsuneyo: Without trying this code: https://gist.github.com/dminuoso/b2cb0c0c4077f589380012af598f5043
[13:11:06] dminuoso: kitsuneyo: Answer the question at the end
[13:13:03] kitsuneyo: dminuoso I'm guessing but no
[13:14:16] knight33: has joined #RubyOnRails
[13:15:03] arup_r: yes it is defined.. :)
[13:17:09] arup_r: kitsuneyo: read https://stackoverflow.com/questions/15183576/confusion-with-the-assignment-operation-inside-a-falsy-if-block
[13:24:53] hashtd: has joined #RubyOnRails
[13:27:11] Archrover: has joined #RubyOnRails
[13:27:57] charlielor: In rails console, how do I run a specific method in the model file?
[13:28:42] charlielor: In the lib/koapi.rb file, it does return data but not in the view so I am tracking where it causing the issue.
[13:29:39] dminuoso: kitsuneyo: https://eval.in/816253
[13:30:03] dminuoso: kitsuneyo: Ruby does not even care about possible execution order either
[13:30:33] dminuoso: kitsuneyo: What would this produce? `puts foo if foo = 1'
[13:31:08] arup_r: has joined #RubyOnRails
[13:32:27] Technodrome: has joined #RubyOnRails
[13:35:06] charlielor: has joined #RubyOnRails
[13:40:14] cjohnson: I'm seeing a method on a model that I can't find a def for so my guess is it's a magic method, but I'm not sure
[13:40:20] charlielor: has joined #RubyOnRails
[13:40:26] mtkd: has joined #RubyOnRails
[13:40:26] cjohnson: it's create_action_status. It's on the action model and there is an associated model called action_status
[13:40:39] cjohnson: Is there a rails magic method for create_X where X = associated model?
[13:40:44] arup_r: cjohnson: show the code in a gist
[13:41:04] cjohnson: That's really it, create_action_status(...some args....)
[13:41:10] charlielor: How do I run a modle’s method in rails console?
[13:41:20] cjohnson: Model.method works for me
[13:41:22] charlielor: Do I just call the method name?
[13:41:23] sevenseacat: http://guides.rubyonrails.org/association_basics.html#belongs-to-association-reference
[13:41:27] fryguy: charlielor: try it and see
[13:41:36] charlielor: i see, thanks! I’ll give that a try.
[13:41:43] dminuoso: kitsuneyo: No. It creates a NoMethodError.
[13:41:52] cjohnson: sevenseacat: bookmarked, thanks
[13:41:53] arup_r: cjohnson: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-belongs_to
[13:42:19] cjohnson: api or guides?
[13:42:23] dminuoso: kitsuneyo: If you imagine all the whitespace is removed, the moment that Ruby sees an assignment to a variable named "foo", all further references to "foo" are considered a reference to that variable. Otherwise foo is considered a method call.
[13:42:26] sevenseacat: theyre both official sources.
[13:42:30] arup_r: cjohnson: both works
[13:42:37] dminuoso: kitsuneyo: (With all whitespace removed, looking left to right)
[13:42:41] arup_r: cjohnson: that line "association is a placeholder for the symbol passed as the name argument, so belongs_to :author would add among others author.nil?."
[13:43:03] cjohnson: yeah, makes sense
[13:44:19] bkulbida: has joined #RubyOnRails
[13:44:44] dminuoso: kitsuneyo: Anyway to get back to the original topic: What you can do however, is first "declare" a variable "default_includes = nil", and then conditionally re-assign a new value to it.
[13:45:09] dminuoso: kitsuneyo: Also your last bit in `params[:include] || default_includes || nil' is not necessary
[13:45:25] dminuoso: (Kind of making a few assumptions, but there's little point in further nitpicking)
[13:45:41] dminuoso: Just a plain `params[:include] || default_includes' will suffice.
[13:45:43] kitsuneyo: dminuoso, ok, defining the variable sounds like a good idea
[13:47:56] dminuoso: kitsuneyo: `value || default' is a common idiom in the end. :)
[13:49:47] Technodrome: sometimes activerecrod feels like prepared statements
[13:50:28] dminuoso: Except the prepared part. :D
[13:50:45] kitsuneyo: dminuoso thanks for the help, I appreciate it
[13:51:06] umdstu: has joined #RubyOnRails
[13:51:49] Technodrome: one thing i'll give the django orm, they try to keep anything looking like prepared statements away
[13:51:54] umdstu: i'm trying to bundle install some gems but for some reason it's looking in the wrong location for the ruby.h file as opposed to (i assume non default) location of my .h file
[13:52:11] sevenseacat: good for them.
[13:52:33] umdstu: is there a way to set an env variable to tell ruby where to look for headers?
[13:53:52] ascarter_: has joined #RubyOnRails
[13:54:41] dminuoso: umdstu: Can you dumb the entire output from a) where the gem starts "Building native extensins" or better yet the entire mkmf.log file?
[13:54:55] dminuoso: Preferrably not in here. Maybe a gist or something
[13:54:58] pupsicle: umdstu: https://stackoverflow.com/questions/558803/how-to-add-a-default-include-path-for-gcc-in-linux
[13:55:15] dminuoso: You shouldn't have to.
[13:56:18] umdstu: yea give me a minute dminuoso
[13:59:56] umdstu: dminuoso: top of the output: https://gist.github.com/umdstu/102542eb8ad5650102575c331cd0fbf1
[14:00:35] sevenseacat: where exactly is your ruby.h file?
[14:01:10] umdstu: /srv/ruby-2.2.4/include/ruby/ruby.h
[14:01:40] umdstu: ruby --version yields ruby 2.2.4p230
[14:01:52] umdstu: yea idk why the admin put it there
[14:02:58] sevenseacat: I'm sure there is some way to customize it, but it's not rails-related so I have no idea :)
[14:03:02] umdstu: no worries
[14:03:11] umdstu: i'm gonna tell him to properly install ruby :)
[14:03:59] dminuoso: umdstu: No this could be fine actually.
[14:04:24] dminuoso: umdstu: Is it possible that you have the wrong PATH set up there?
[14:04:47] Technodrome: has joined #RubyOnRails
[14:04:55] dminuoso: umdstu: Since it tries to invoke /usr/bin/ruby it looks like its trying to use the system ruby (and thus looks for its respective header files)
[14:05:09] chouhoulis: has joined #RubyOnRails
[14:05:25] umdstu: dminuoso: i thought that too. but i checked /usr/bin/ruby --version and it's 2.2.4p230
[14:05:40] umdstu: dminuoso: so he must have symlinked things instead
[14:06:06] dminuoso: umdstu: Im thinking this could actually be the issue
[14:06:29] dminuoso: umdstu: Try deleting that symlink and creating it in /usr/local/bin instead.
[14:06:36] mcr-credil: has left #RubyOnRails: ()
[14:08:09] umdstu: dminuoso: just chcked, there is a /usr/local/bin/ruby as well, --version yields same as above
[14:08:20] umdstu: so i can change PATH to look there first ig uess
[14:08:43] dminuoso: umdstu: The mkmf.rb is easy to read. Give me a moment to understand how it finds that header.
[14:15:25] arBmind: has joined #RubyOnRails
[14:15:47] tedwing: has joined #RubyOnRails
[14:16:46] dminuoso: umdstu: This looks fishy.
[14:17:07] dminuoso: umdstu: Do you want to debug this properly?
[14:19:55] mcr-credil: has joined #RubyOnRails
[14:20:06] umdstu: dminuoso: umm
[14:20:12] umdstu: dminuoso: i'm not sure it's worth it
[14:20:32] umdstu: dminuoso: im leaning towards just symlinking the include dir that is good to the one it's looking for that doesn't exist
[14:20:37] umdstu: it's a test system
[14:20:52] dminuoso: umdstu: Open up a ruby shell
[14:20:55] dminuoso: what does RbConfig::CONFIG["rubyhdrdir"] give you?
[14:21:16] patarr: has joined #RubyOnRails
[14:21:17] dminuoso: umdstu: The thing right now is Im not sure its set up correctly.
[14:22:02] umdstu: dminuoso: => "/usr/include/ruby-2.2.0"
[14:22:18] dminuoso: umdstu: Then your ruby was not installed properly.
[14:22:20] dminuoso: Or configured properly.
[14:22:29] dminuoso: umdstu | dminuoso: i thought that too. but i checked /usr/bin/ruby --version and it's 2.2.4p230
[14:22:36] dminuoso: umdstu: You sir have a version mismatch going on.
[14:23:14] umdstu: dminuoso: awesome!
[14:23:34] umdstu: doesn't help yum repos are outdated and ruby has to be installed from source
[14:23:54] dminuoso: umdstu: which shell? bash?
[14:24:05] dminuoso: umdstu: please do: hash -r; which ruby
[14:24:12] umdstu: dminuoso: yes
[14:24:39] umdstu: dminuoso: /usr/local/bin/ruby
[14:25:25] dminuoso: umdstu: And that's 2.2.4p230? If you rerun (now that you have rehashed), please gist the complete RbConfig::CONFIG
[14:25:33] dminuoso: pretty printed please :P
[14:25:58] umdstu: dminuoso: yes 2.2.4p230
[14:26:25] umdstu: dminuoso: oh man
[14:26:28] umdstu: thats a lot of output
[14:26:38] dminuoso: umdstu: Yes, Feel free to non-pretty print it if its easier
[14:26:39] umdstu: like i said, this is on a test sytem, i can't copy/paste it
[14:26:55] dminuoso: umdstu: Fair enough. Just look at the keys "topdir" and "rubyhdrdir"
[14:27:16] dminuoso: If they still point to ruby-2.2.0 then the build is messed up
[14:27:32] umdstu: topdir points to ruby-2.2.0
[14:27:51] umdstu: so does rubyhdrdir
[14:28:04] tentacle: has joined #RubyOnRails
[14:28:37] umdstu: it's a mess
[14:28:51] dminuoso: umdstu: And RbConfig.ruby ?
[14:29:02] dminuoso: Does that point at *another* ruby? or the same you executed?
[14:29:21] dminuoso: If that's different your build is completely messed up.
[14:29:29] dminuoso: If its not, its still messed up.
[14:29:32] umdstu: /usr/bin/ruby
[14:33:17] mikecmpbll: has joined #RubyOnRails
[14:36:58] charlielor: has joined #RubyOnRails
[14:41:24] DoubleMalt: has joined #RubyOnRails
[14:45:09] shotbug: has joined #RubyOnRails
[14:47:29] quirkycoders: has joined #RubyOnRails
[14:51:12] kitsuneyo: has joined #RubyOnRails
[14:51:53] drale2k_: has joined #RubyOnRails
[14:52:48] umdstu: well i had him symlink the known good ruby/include/ dir that ruby couldn't see to the one it could. so now it sees it but... "checking for strlcpy() in string.h... *** extconf.rb failed ***
[14:53:06] umdstu: seems like I'm beat
[14:55:24] lacrymology: has joined #RubyOnRails
[14:56:07] quirkycoders: has joined #RubyOnRails
[14:56:18] Jameser: has joined #RubyOnRails
[14:56:21] quirkycoders: has joined #RubyOnRails
[15:00:30] ascarter_: has joined #RubyOnRails
[15:04:29] quirkycoders: has joined #RubyOnRails
[15:08:34] quirkycoders: has joined #RubyOnRails
[15:10:07] ur5us: has joined #RubyOnRails
[15:10:20] conta3: has joined #RubyOnRails
[15:15:45] dminuoso: umdstu: Im really not sure what's the cause, but symlinking your way will just lead to more troubles.
[15:15:59] dminuoso: umdstu: How was your ruby build?
[15:16:39] patarr: Why aren't all rspec described_class objects spies?
[15:16:56] dminuoso: umdstu: RbConfig::CONFIG["configure_args"] would be of interest here.
[15:18:56] dminuoso: umdstu: One last thought Im having: What does RUBY_VERSION give you from within that shell?
[15:19:25] quirkycoders: has joined #RubyOnRails
[15:20:40] pLaTo0n: has joined #RubyOnRails
[15:22:25] quirkycoders: has joined #RubyOnRails
[15:23:26] brent__: has joined #RubyOnRails
[15:23:36] dminuoso: umdstu: Also it would be wise to carry this into #ruby
[15:25:25] xx00__: has joined #RubyOnRails
[15:25:26] Rodya_: has joined #RubyOnRails
[15:27:17] hobodave: has joined #RubyOnRails
[15:28:24] mikecmpbll: has joined #RubyOnRails
[15:29:35] brent__: What is the best way to get distinct on authorships.author_id on this query, but making sure the distinct is the first record by the order
[15:29:39] brent__: ProxyPoster.joins("inner join authorships on authorships.authorable_id = posters.id").order(:published_at).select('posters.id as poster_id, authorships.author_id as author_id').where("authorships.authorable_type = 'Poster").where("posters.state = 'published'")
[15:32:35] charlielor: has joined #RubyOnRails
[15:34:51] umdstu: dminuoso: => " '--enable-pthread' '--with-opt-dir=/usr' '--enable-shared'"
[15:35:10] nahtnam: has joined #RubyOnRails
[15:35:48] umdstu: dminuoso: and => "2.2.4"
[15:35:54] umdstu: respectively
[15:37:37] pLaToOn: has joined #RubyOnRails
[15:39:15] umdstu: dminuoso: beginning to think it's just really jacked up and needs a reset
[15:40:32] roshanavand: has joined #RubyOnRails
[15:52:31] [Butch]: has joined #RubyOnRails
[15:54:45] sonOfRa: has joined #RubyOnRails
[15:55:24] joeyk: is it possible to do something like: validates :field, exception: FieldNotPressentException #?
[15:58:24] Rodya_: has joined #RubyOnRails
[15:59:46] deur-: joeyk: I'm guessing you'll have to use validate :method and throw your own custom exceptions
[16:00:04] deur-: afaik rails does not allow for exceptions to be triggered straight onto the validation
[16:03:50] matthewd: Validation doesn't use exceptions
[16:06:59] ascarter_: has joined #RubyOnRails
[16:07:15] joeyk: matthewd: hmm.. so when I do .create!() and it throws an ActiveRecord::RecordInvalid is not coming from my "vaidate :field, presence: true"
[16:07:43] charlielor: has joined #RubyOnRails
[16:08:30] matthewd: Not from the field, no. It ultimately raises an exception indicating the *record* is invalid; validating the individual fields to come to that conclusion doesn't involve exceptions.
[16:09:06] joeyk: fair enough, probably better performance that way honestly.
[16:13:16] gusrub: has joined #RubyOnRails
[16:13:22] sandstrom: has joined #RubyOnRails
[16:15:01] banisterfiend: has joined #RubyOnRails
[16:33:30] rakm: has joined #RubyOnRails
[16:42:11] marr: has joined #RubyOnRails
[16:43:16] quirkycoders: has joined #RubyOnRails
[16:45:26] charlielor: has left #RubyOnRails: ()
[16:48:51] charlielor: has joined #RubyOnRails
[16:49:07] defsdoor: has joined #RubyOnRails
[16:54:42] benlieb: has joined #RubyOnRails
[16:54:47] mikecmpbll: has joined #RubyOnRails
[16:56:39] cgfbee: has joined #RubyOnRails
[16:58:26] troys: has joined #RubyOnRails
[16:59:50] lacrymology: has joined #RubyOnRails
[17:03:49] kies: has joined #RubyOnRails
[17:04:14] uks: has joined #RubyOnRails
[17:07:21] xall: has joined #RubyOnRails
[17:11:01] ur5us: has joined #RubyOnRails
[17:12:52] uksio: has joined #RubyOnRails
[17:13:39] ascarter_: has joined #RubyOnRails
[17:13:56] cjhowe7: has joined #RubyOnRails
[17:18:41] umdstu: anyone installing rails on centos - is the recommended way to setup ruby by way of rbenv? or manu install from source
[17:20:41] uks: has joined #RubyOnRails
[17:23:25] fryguy: umdstu: rbenv gives you an environment to install multiple rubies from source (using ruby-build).
[17:26:03] umdstu: fryguy: yea i'm aware. i'm looking for best practices. historically we've had to compile ruby source, specifying libs and whatnot, and it's lead to inconsistent machines
[17:26:34] fryguy: did you use ruby-build?
[17:26:42] umdstu: fryguy: no
[17:26:47] fryguy: you should try ruby-build
[17:26:57] umdstu: well that was my question
[17:30:39] DoubleMalt: has joined #RubyOnRails
[17:31:51] DoubleMalt: has joined #RubyOnRails
[17:35:55] Aherin: has joined #RubyOnRails
[17:36:04] Jayson_Virissimo: has joined #RubyOnRails
[17:39:06] uksio: has joined #RubyOnRails
[17:39:59] daveomcd: has joined #RubyOnRails
[17:41:09] daveomcd: I'm using wicked_pdf & wkhtmltopdf to generate PDF reports. However, I've noticed when I run it on an HTML file with many table rows it seems to send the CPU % on my development machine and/or production machine to 100%. Does anyone know how I can trouble shoot this?
[17:41:50] gusrub: has joined #RubyOnRails
[17:41:52] daveomcd: I've updated both gems, and have stripped all the code to simple generate a PDF of a table with 600000 rows for demo'ing the issue currently
[17:45:26] gusrub: has joined #RubyOnRails
[17:45:26] dionysus69: has joined #RubyOnRails
[17:46:15] uks: has joined #RubyOnRails
[17:47:37] arBmind: has joined #RubyOnRails
[17:48:00] sandstrom: has joined #RubyOnRails
[17:48:47] quirkycoders: has joined #RubyOnRails
[17:49:43] fryguy: daveomcd: why is that a bad thing?
[17:51:09] daveomcd: fryguy, well it seems to drag the machine down from performing other actions while that's processing. Perhaps I just need to add it to sidekiq and background the process? But wasn't sure if that was just ignoring an actual issue
[17:52:13] fryguy: daveomcd: maybe do some performance profiling of the gem and find some way to do it more efficiency and send them a PR. otherwise it seems like generating documents is going to generally be somewhat cpu intensive.
[17:54:35] nickjj: daveomcd, if sidekiq is running on the same box your CPU will still be crushed
[17:55:06] nickjj: however, you could limit the CPU usage on the sidekiq process, or throw it onto a different box
[17:55:13] daveomcd: nickjj, right good point. im not familiar with performance profiling of a gem -- so im looking into that now
[17:55:45] nickjj: a quick and dirty way to profile it would be to just run `htop` while its doing its thing, and then filter it for your rails/sidekiq processes
[17:55:55] nickjj: or if you're using docker, there's built in profiling tools
[17:55:58] daveomcd: nickjj, could i limit the cpu usage of the wkhtmltopdf process instead then? Is that something I would do through the ubuntu box or can it be done through rails
[17:56:17] daveomcd: nickjj, nah at the moment I'm using a ubuntu server machine I set up
[17:57:02] charlielor: has joined #RubyOnRails
[17:57:03] nickjj: there probably is a way to limit the CPU usage of an arbitrary process
[17:57:12] nickjj: but it would be done at the ubuntu level
[17:57:37] daveomcd: because using glances in ubuntu terminal i can see its the wkhtmltopdf binary gem that is using up the cpyu
[17:57:49] nickjj: i mean, it would be easy to do it with any standard service monitoring tool (like systemd), but this is a different use case, wkhtmltopdf is just a binary that gets called from your app
[17:58:13] nickjj: so you would need to google for a linux tool that lets you assign a CPU cap to any binary
[17:59:35] daveomcd: nickjj, ok thanks im going to try this
[18:00:04] nickjj: html to pdf is a CPU intensive task tho, in a real production environment it sounds like you should just run it through sidekiq and put it on a different box
[18:00:39] nickjj: because if you're not already using sidekiq, then some poor user is going to see no feedback while your app generates a PDF for a long period of time
[18:01:41] nickjj: it's also going to lock your app server from serving additional requests unless you spawn multiple threads/workers
[18:02:04] daveomcd: nickjj, given that I only have one box at the moment -- would it be not best to limit the CPU and also do sidekiq. because if it understood you correctly earlier, even if put it on sidekiq it's still going to max out the cpu
[18:02:42] nickjj: it depends on the use case of the app, if it's a small app with a small work low then CPU limiting on 1 box should be fine
[18:02:46] nickjj: *work load
[18:03:06] daveomcd: yep relatively small app I would think. perhaps < 50 active users ever
[18:03:49] daveomcd: at one time less than 50 active users... I've discussed doing another machine for sidekiq but I just haven't gotten resources for it yet
[18:03:56] nickjj: also if your audience expects it to take a while for the PDF to be generated then i'm going to assume they won't care if it takes 8 or 28 seconds for it to be ready as long as you respond immediately and give them something to do while its processing
[18:04:01] xall: has joined #RubyOnRails
[18:05:02] daveomcd: currently in the development environment I was having it load up into an iframe, so I just have to figure out how to do that with sidekiq -- or come up with another way of doing it
[18:05:48] nickjj: the easiest solution would be to email them when it's ready
[18:06:01] mtkd: has joined #RubyOnRails
[18:06:43] daveomcd: nickjj, i thought about that - but figured if thats the case I might have to do soemthing that limits the size of attachment it would send
[18:06:56] nickjj: email them a link to the pdf, not the pdf itself
[18:07:12] daveomcd: ah, didn't think of that. thanks
[18:07:38] nickjj: and you can easily configure rails/nginx to only allow access to it from authenticated users
[18:08:25] nickjj: another option would be to write some javascript that checks on the status of the job and just poll it every few seconds, and update the page when it's done
[18:08:48] arBmind: has joined #RubyOnRails
[18:09:29] nickjj: and another option would be to use websockets and push a notification out when sidekiq finishes, could give you an excuse to use action cable too
[18:20:47] ascarter_: has joined #RubyOnRails
[18:25:14] jgpawletko: has joined #RubyOnRails
[18:38:55] duderonomy: has joined #RubyOnRails
[19:00:31] quirkycoders: has joined #RubyOnRails
[19:01:37] SteenJobs_: has joined #RubyOnRails
[19:02:20] mahloun: has joined #RubyOnRails
[19:03:14] username1: has joined #RubyOnRails
[19:03:55] patarr: I'm looking at some controller code and I see there is a method that has where(...) and I'm wondering - what is this? How on earth does this work? More importantly, what active record object is this operating one?
[19:04:01] patarr: Can anyone shed any light on this for me?
[19:05:11] dici: has joined #RubyOnRails
[19:06:15] patarr: Oh it's in a model file
[19:06:18] patarr: This changes things :)
[19:07:36] nesoi: has joined #RubyOnRails
[19:08:41] ur5us: has joined #RubyOnRails
[19:12:28] SteenJobs_: patarr: https://apidock.com/rails/ActiveRecord/QueryMethods/where
[19:20:17] charlielor: has joined #RubyOnRails
[19:20:44] urkle: has joined #RubyOnRails
[19:25:30] charlielor: what’s the best to sort an array in ruby on rails?
[19:26:00] tercenya: has joined #RubyOnRails
[19:27:04] SteenJobs_: mmmmmm what does best mean
[19:27:26] ascarter_: has joined #RubyOnRails
[19:27:32] SteenJobs_: also by rails do you mean ruby
[19:27:39] drale2k_: has joined #RubyOnRails
[19:28:07] noob_on_rails: has joined #RubyOnRails
[19:28:10] SteenJobs_: also sounds like a supppper googleable question
[19:28:12] charlielor: this is a ruby on rails app and I’m looking for a way to sort an array
[19:28:24] SteenJobs_: ya, Array is a ruby class
[19:28:56] charlielor: I’m not sure if I should sort the array first before picking out the items I needed or sort all the items I needed after it’s been selected from the array
[19:28:59] noob_on_rails: i have a form in which i fill the fields for a model creation , i want to get some api info from the first field (based on the content of it) and if there's any info , i'd like to populate the rest
[19:29:48] noob_on_rails: how can i call the custom action with the api call and send it the thextbox params
[19:30:45] urkle: has joined #RubyOnRails
[19:33:50] Pumukel: has joined #RubyOnRails
[19:36:10] charlielor: I wonder if I can just do this: results << r
[19:36:11] charlielor: results.sort_by{|e| e[:time_ago]}
[19:37:20] srinidhi: has joined #RubyOnRails
[19:38:11] tbuehlmann: charlielor: if possible, receive the result already sorted
[19:38:29] baweaver: https://apidock.com/rails/ActiveRecord/QueryMethods/order
[19:39:03] baweaver: charlielor: like that ^
[19:39:54] baweaver: If not, you might want to gist your code so we can see what you mean
[19:39:56] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:42:40] charlielor: https://gist.github.com/anonymous/5e0927382c8e6af2fdf158b6ee452b99
[19:46:50] charlielor: It’s not working from what I currently have.
[19:47:01] SteenJobs_: charlielor: re your question from before, select is cheaper than sort, so in theory i would say select().sort() is better in the general case
[19:47:20] noob_on_rails: anyone about my odd deal ? :D
[19:47:53] SteenJobs_: but not sure if you would notice a difference - run it using https://ruby-doc.org/stdlib-1.9.3/libdoc/benchmark/rdoc/Benchmark.html and see for yourself
[19:48:51] charlielor: Steenjobs_: so in my code, do I do response.select().sort() before the loop?
[19:49:48] SteenJobs_: seems like i’m missing something, i don’t see any select() being called in your code
[19:51:39] charlielor: no, I don’t have select in my api calling
[19:52:02] luis_alen: has joined #RubyOnRails
[19:55:07] lxsameer: has joined #RubyOnRails
[19:55:21] SteenJobs_: so then i have no idea if you want to call it before the loop since i don’t know what you’re trying to do, nor do i know what the response looks like
[19:55:47] SteenJobs_: and it most likely makes no difference, but select is O(n) and sort is likely O(n log n), so selecting first should in theory be faster
[19:57:34] charlielor: The “response” is a json object and looping through the object to pick id and name to store in an array.
[20:00:42] mahloun: has joined #RubyOnRails
[20:01:59] SteenJobs_: has joined #RubyOnRails
[20:07:38] luis_alen: has left #RubyOnRails: ()
[20:07:45] luis_alen: has joined #RubyOnRails
[20:09:56] Rodya_: has joined #RubyOnRails
[20:10:13] Jayson_Virissimo: has joined #RubyOnRails
[20:11:15] Pumukel: has joined #RubyOnRails
[20:14:23] SteenJobs_: has joined #RubyOnRails
[20:17:17] patarr1: has joined #RubyOnRails
[20:17:48] urkle: has joined #RubyOnRails
[20:22:11] futilegames: has joined #RubyOnRails
[20:28:11] SteenJobs_: has joined #RubyOnRails
[20:28:16] DoubleMalt: has joined #RubyOnRails
[20:30:55] ascarter_: has joined #RubyOnRails
[20:38:03] xx00__: has joined #RubyOnRails
[20:39:08] Technodrome: has joined #RubyOnRails
[20:42:14] rainy_mood2002: has joined #RubyOnRails
[20:43:57] arup_r: has joined #RubyOnRails
[20:45:07] quazimodo: has joined #RubyOnRails
[20:46:21] havenwood: rainy_mood2002: hi
[20:46:55] cjhowe7: has joined #RubyOnRails
[20:52:15] mahloun: has joined #RubyOnRails
[20:54:54] weathermaker: has joined #RubyOnRails
[20:57:48] ur5us: has joined #RubyOnRails
[20:58:06] safetypin: has joined #RubyOnRails
[20:59:28] patarr: has joined #RubyOnRails
[21:03:46] TinkerTyper: has joined #RubyOnRails
[21:11:20] |PiP|: has joined #RubyOnRails
[21:11:49] |PiP|: is there a way to access the raw data that activerecord receives from the database from an AR model??
[21:14:47] ur5us: has joined #RubyOnRails
[21:19:22] AzaToth: has joined #RubyOnRails
[21:20:38] mtkd: has joined #RubyOnRails
[21:22:07] Pumukel: has joined #RubyOnRails
[21:26:15] Technodrome: has joined #RubyOnRails
[21:36:47] ascarter: has joined #RubyOnRails
[21:42:46] weathermaker: has joined #RubyOnRails
[21:43:25] ascarter: has joined #RubyOnRails
[21:52:25] br0d1n: has joined #RubyOnRails
[21:52:29] Rodya_: has joined #RubyOnRails
[22:14:24] Technodrome: has joined #RubyOnRails
[22:17:40] Rodya_: has joined #RubyOnRails
[22:24:21] nesoi: has joined #RubyOnRails
[22:24:54] Rodya_: has joined #RubyOnRails
[22:25:24] AzaToth: has joined #RubyOnRails
[22:26:54] xx00__: has joined #RubyOnRails
[22:28:40] br0d1n: has joined #RubyOnRails
[22:37:21] Radar: GOOD MORNING
[22:37:26] aperkins81: has joined #RubyOnRails
[22:39:53] ascarter_: has joined #RubyOnRails
[23:04:23] wethu: has joined #RubyOnRails
[23:08:10] dmin7b5_: has joined #RubyOnRails
[23:27:01] Technodrome: has joined #RubyOnRails
[23:41:27] bkulbida: has joined #RubyOnRails
[23:45:40] ascarter: has joined #RubyOnRails
[23:50:27] xx00__: has joined #RubyOnRails
[23:52:21] |PiP|: has joined #RubyOnRails
[23:59:00] weathermaker: has joined #RubyOnRails