« Back to channel list

#RubyOnRails - 17 December 2018

« Back 1 day Forward 1 day »
[00:00:38] cnsvc_: has joined #RubyOnRails
[00:31:02] MasterAsia: has joined #RubyOnRails
[00:58:44] sevenseacat: has joined #RubyOnRails
[01:57:41] bambanx: has joined #RubyOnRails
[02:00:11] ariedler: has joined #RubyOnRails
[02:00:56] ariedler: has joined #RubyOnRails
[02:01:44] ariedler: has joined #RubyOnRails
[02:02:30] ariedler: has joined #RubyOnRails
[02:03:17] ariedler: has joined #RubyOnRails
[02:04:03] ariedler: has joined #RubyOnRails
[02:04:50] ariedler: has joined #RubyOnRails
[02:27:45] kapil____: has joined #RubyOnRails
[02:45:38] carbone5: has joined #RubyOnRails
[02:54:15] carbone5: has joined #RubyOnRails
[02:56:00] MasterAsia: has joined #RubyOnRails
[02:56:15] Saukk: has joined #RubyOnRails
[03:16:03] carbone5: has joined #RubyOnRails
[03:20:37] srinidhi: has joined #RubyOnRails
[03:26:48] carbone5: has joined #RubyOnRails
[03:34:45] ariedler: has joined #RubyOnRails
[04:01:54] orbyt_: has joined #RubyOnRails
[04:02:27] cnsvc_: has joined #RubyOnRails
[04:09:37] braincrash: has joined #RubyOnRails
[04:16:04] roshanavand1: has joined #RubyOnRails
[04:19:24] quazimodo: has joined #RubyOnRails
[04:19:41] quazimodo: has joined #RubyOnRails
[05:21:26] gambl0re: has joined #RubyOnRails
[05:22:10] uksio: has joined #RubyOnRails
[05:53:21] dionysus69: has joined #RubyOnRails
[06:15:20] conta: has joined #RubyOnRails
[06:28:13] roshanavand: has joined #RubyOnRails
[06:29:19] za1b1tsu: has joined #RubyOnRails
[06:40:47] endemic: has joined #RubyOnRails
[06:45:42] hammer065: has joined #RubyOnRails
[06:46:03] srinidhi: has joined #RubyOnRails
[07:11:42] KeyJoo: has joined #RubyOnRails
[07:12:54] MasterAsia: has joined #RubyOnRails
[07:15:57] cnsvc_: has joined #RubyOnRails
[07:59:46] gambl0re: has joined #RubyOnRails
[08:20:42] za1b1tsu: has joined #RubyOnRails
[08:40:34] defsdoor: has joined #RubyOnRails
[08:51:37] mikecmpbll: has joined #RubyOnRails
[08:57:18] roshanavand: has joined #RubyOnRails
[09:07:44] za1b1tsu: has joined #RubyOnRails
[09:14:45] Sylario: has joined #RubyOnRails
[09:52:04] ellcs: has joined #RubyOnRails
[10:06:43] za1b1tsu: has joined #RubyOnRails
[10:17:19] Milos: has joined #RubyOnRails
[10:26:52] blackmesa: has joined #RubyOnRails
[10:27:15] cnsvc_: has joined #RubyOnRails
[10:40:27] ellcs: has joined #RubyOnRails
[10:57:39] roshanavand: has joined #RubyOnRails
[11:06:40] conta: has joined #RubyOnRails
[11:11:24] dirceu: has joined #RubyOnRails
[11:15:28] Jervis_: has joined #RubyOnRails
[11:43:09] dachi``: could you tell me couple of words, about using actioncable without user registration?
[11:43:35] dachi``: ie good way to still being able to send to one client / all except one
[11:48:50] ellcs: has joined #RubyOnRails
[11:53:37] Guest61854: has joined #RubyOnRails
[11:55:39] ariedler: has joined #RubyOnRails
[11:57:09] ariedler: has joined #RubyOnRails
[12:25:46] lxsameer: has joined #RubyOnRails
[12:28:39] za1b1tsu: has joined #RubyOnRails
[12:30:42] deathwishdave: has joined #RubyOnRails
[12:33:12] noob_on_rails: has joined #RubyOnRails
[12:34:08] noob_on_rails: hey all, in a transaction block like this -> https://gist.github.com/frcake/365e83ca843e905a9f5cbec1fceed42f
[12:34:42] noob_on_rails: where the collection is a set of instantiated objects ready to be saved, why would rails let the first model get saved, if the second one fails due to a validation error ?
[12:41:30] noob_on_rails: also a relevant post about it https://www.ruby-forum.com/t/how-can-i-handle-multiple-models-saves-in-a-single-transactional/134496/7 , am i doing something very wrong here?
[12:57:22] cnsvc_: has joined #RubyOnRails
[12:57:40] roshanavand: has joined #RubyOnRails
[13:03:40] noob_on_rails: https://gist.github.com/frcake/365e83ca843e905a9f5cbec1fceed42f <- the working.rb gist is working.. still don't get why
[13:07:30] jottr: has joined #RubyOnRails
[13:10:05] DTZUZO: has joined #RubyOnRails
[13:11:48] OTC: has joined #RubyOnRails
[13:12:31] OTC: hey guys, I'm new to ruby, wondering how you call the "mixins", e.g. "skip_before_filter ..." in a controller?
[13:12:50] tbuehlmann: that's actually a class method being called
[13:12:56] OTC: ok I see
[13:12:59] OTC: thanks!
[13:19:31] paranoicsan: has joined #RubyOnRails
[13:34:02] OTC: I defined a method on ApplicationController, "def is_from_proxy?", and I want to use it in a subclass of that controller, UserController, in a before filter call like "before_filter :filter, :unless is_from_proxy?
[13:34:28] OTC: but I get undefined method is_from_proxy?
[13:35:11] tbuehlmann: can you gist your controllers?
[13:35:17] sevenseacat: this is where learning ruby syntax before jumping into rails comes in handy :)
[13:35:41] tbuehlmann: righty, there's something wrong :)
[13:36:52] OTC: ok I will try to isolate. and sorry to bother with overly broad questions, I'm trying to automate actions to an old backend and have to find a way to go through CSRF and other protections, while knowing nothing about ruby
[13:37:49] sevenseacat: I recommend picking up a copy of the well-grounded rubyist
[13:38:14] sevenseacat: its not overly broad, it's just not appropriate to this channel
[13:45:58] OTC: thanks! figured it by the way, needed to wrap my call in Proc.new
[13:46:28] OTC: #ruby-lang is invite-only, figured I'd come here next :P
[13:46:50] TvL2386: hey guys, I'm querying data from a mysql database I have read access to. There is a datetime column that has no timezone information. When I query on that field (gteq: Time.now), the query will actually use (Time.now-1.hour) because I'm in GMT+1.
[13:47:03] TvL2386: OTC I use #ruby for ruby questions
[13:47:36] OTC: TvL2386 I see, I guess ruby-lang is for people working on the language then
[13:48:57] TvL2386: OTC I have no idea what it's for :)
[13:50:05] TvL2386: On the ruby website they promote #ruby as: The Ruby Language IRC Channel is a wonderful way to chat with fellow Rubyists.
[13:51:22] sevenseacat: OTC - that's not what you need to do
[13:52:05] sevenseacat: :unless is_from_proxy? doesn't make sense
[13:52:11] sevenseacat: and adding Proc.new will not help
[13:52:15] sevenseacat: it's not valid syntax
[13:57:49] tbuehlmann: TvL2386: rails assumes your times are saved using UTC and will convert times to it when querying. you should setup config.time_zone and use Time.current instead of Time.now
[14:01:17] TvL2386: tbuehlmann: I already have `config.time_zone = 'Amsterdam'` in my application.rb
[14:01:56] sirensari2: has joined #RubyOnRails
[14:02:01] TvL2386: tbuehlmann: using Time.current instead of Time.now (or Time.zone.now) all result in the same query... Starting from an hour ago instead of now
[14:02:22] TvL2386: is there a way to tell activerecord that this particular model is not UTC?
[14:13:18] beholders_eye: has joined #RubyOnRails
[14:15:39] cnsvc_: has joined #RubyOnRails
[14:30:44] alan_w: has joined #RubyOnRails
[14:35:00] kapil____: has joined #RubyOnRails
[14:37:13] roshanavand: has joined #RubyOnRails
[14:44:06] deathwishdave: has joined #RubyOnRails
[14:44:17] tuor: has joined #RubyOnRails
[14:54:10] CGibsonmm: has joined #RubyOnRails
[14:54:52] CGibsonmm: Anyone know why calling Time.now in a private controller method in rails returns a time 18 years ago?
[14:55:10] TvL2386: server time not up to date?
[14:55:31] TvL2386: server time set at 2000?
[14:56:37] CGibsonmm: How would you change that? or what would cause that?
[14:56:56] CGibsonmm: All of my other time methods are correct
[14:57:24] TvL2386: cgibsonmm: well... It could be set wrong from the start, it probably does not sync with a ntp server. Or it drifted too far and is set to not autocorrect it
[14:57:59] TvL2386: cgibsonmm: so: calling Time.now from another method gives the correct value?
[14:58:04] cpruitt: has joined #RubyOnRails
[14:59:00] CGibsonmm: the default times like created_at: from rails is correct...
[15:00:02] TvL2386: cgibsonmm: I just read that using Time.now is not good. That you should use Time.current
[15:00:30] CGibsonmm: tryed that also, even DateTime.current
[15:01:05] CGibsonmm: {id: 1, published_on: "2000-01-01 14:57:59", created_at: "2018-12-17 14:57:56", updated_at: "2018-12-17 14:57:59" }
[15:02:05] TvL2386: what's the type of "published_on" in the database?
[15:03:30] CGibsonmm: haha! Thanks, have it set to time.
[15:06:05] chouhoulis: has joined #RubyOnRails
[15:28:07] maryo: has joined #RubyOnRails
[15:33:05] EminenceHC: has joined #RubyOnRails
[15:37:01] EminenceHC: I filter my index page by using conditional .where queries. The objects that do not meet the conditionals do not show in the index. Is there a way to display these objects along with a message why they did not meet one or more of the conditionals?
[15:41:04] EminenceHC: Basically an inverse of the query.
[15:50:20] jobewan: has joined #RubyOnRails
[15:55:26] dslegends: has joined #RubyOnRails
[16:07:57] cnsvc_: has joined #RubyOnRails
[16:22:57] mostlybadfly: has joined #RubyOnRails
[16:29:07] beholders_eye: has joined #RubyOnRails
[16:31:06] conta: has joined #RubyOnRails
[16:33:17] conta1: has joined #RubyOnRails
[16:35:38] TheNet: eminencehc: if the where clauses are simple you could fetch all your rows then call .group_by
[16:35:38] TheNet: https://apidock.com/ruby/Enumerable/group_by
[16:38:56] EminenceHC: TheNet: I do like that solution but my where clauses are fairly complex.
[16:40:52] TheNet: eminencehc: I'm not very familiar with active record, but could you evaluate the where clauses in the select so each record has an additional field
[16:40:59] TheNet: then you could group_by that field
[16:42:31] EminenceHC: Currently I am separating all objects that pass and all objects that fail into two active record association objects and displaying them both on the index page. For each object that fails displayed on the index I am running a separate query on the object to change text color to red. I'd like to not have to do this query on the index page.
[16:44:59] EminenceHC: TheNet: I totally like the idea of flagging the object with an additional attribute in the active record collection, but I haven't been able to figure out a way to do that whilst preserving the object methods.
[16:47:25] dslegends: has joined #RubyOnRails
[16:48:33] TheNet: eminencehc: if you figure out a way, let me know :)
[16:49:03] EminenceHC: Does anyone know a way to add an arbitrary attribute to each object in an active record association? The attribute does not need to persist to the database, it simply needs to be there when displaying it on the view.
[16:50:10] blackmesa: has joined #RubyOnRails
[16:55:30] krawchyk: has joined #RubyOnRails
[16:57:30] _aeris_: has joined #RubyOnRails
[16:58:38] orbyt_: has joined #RubyOnRails
[17:04:22] EminenceHC: TheNet: I figured it out. I used an attr_accessor and set it by using .each over the collection. @objects = Object.where(.....) @objects.each do |o| o.attr_accessor_name = "my_value"
[17:04:55] EminenceHC: I think the problem I had when trying to figure this out earlier is that I was using .map to change the object instead of setting it using .each
[17:11:06] darkhanb: has joined #RubyOnRails
[17:12:43] kidPalooma: has joined #RubyOnRails
[17:16:14] kidPalooma: Hello, I have set up an :has_many :through association on one of my app's models. I'd like to have a :has_one scope that is one of the records that my :has_many association returns, but with 2 conditions: one on the join table and one on the model associated with :has_many :through. How would you do this?
[17:17:02] dslegends: has joined #RubyOnRails
[17:27:27] kidPalooma: basically I need to extract a has_one relationship out of a has_many :through association based on conditions
[17:38:35] roshanavand: has joined #RubyOnRails
[17:50:43] Dreamer3: has joined #RubyOnRails
[17:57:29] srinidhi: has joined #RubyOnRails
[18:06:56] chouhoulis: has joined #RubyOnRails
[18:25:15] cagomez: has joined #RubyOnRails
[18:25:56] cagomez: has joined #RubyOnRails
[18:26:36] cagomez: has joined #RubyOnRails
[18:27:10] cagomez: has joined #RubyOnRails
[18:27:48] cagomez: has joined #RubyOnRails
[18:28:25] cagomez: has joined #RubyOnRails
[18:40:23] cnsvc_: has joined #RubyOnRails
[18:41:57] reber: has joined #RubyOnRails
[19:05:39] Xiti: has joined #RubyOnRails
[19:07:32] dbugger_: has joined #RubyOnRails
[19:08:52] TheNet: eminencehc: are you categorizing the elements in the query or rails?
[19:10:49] orbyt_: has joined #RubyOnRails
[19:19:20] conta: has joined #RubyOnRails
[19:40:55] krawchyk_: has joined #RubyOnRails
[20:09:42] krawchyk: has joined #RubyOnRails
[20:15:00] danst: has joined #RubyOnRails
[20:37:48] sameerynho: has joined #RubyOnRails
[20:43:27] MasterAsia: has joined #RubyOnRails
[20:58:22] context: so... bundler binstubs is nice enough to give you a --shebang option to override the shebang line, how in the hell do i do this for rails app:update:bin
[21:11:48] orbyt_: has joined #RubyOnRails
[21:39:18] cnsvc_: has joined #RubyOnRails
[21:56:42] SteenJobs: has joined #RubyOnRails
[22:09:35] roses-r-red: has joined #RubyOnRails
[22:41:23] sirensari2: has joined #RubyOnRails
[22:46:06] ivanskie: has joined #RubyOnRails
[22:49:00] blackmesa: has joined #RubyOnRails
[23:01:42] za1b1tsu: has joined #RubyOnRails
[23:09:25] za1b1tsu: has joined #RubyOnRails
[23:16:31] lexileo: has joined #RubyOnRails
[23:38:50] Fernando-Basso: has joined #RubyOnRails
[23:45:20] FernandoBasso: has joined #RubyOnRails
[23:50:29] ellcs: has joined #RubyOnRails