« Back to channel list

#RubyOnRails - 28 February 2018

« Back 1 day Forward 1 day »
[00:17:33] hmaronon: has joined #RubyOnRails
[00:23:56] ephemer0l: has joined #RubyOnRails
[00:24:23] blackcross: has joined #RubyOnRails
[00:29:50] dviola: has joined #RubyOnRails
[00:31:48] cstls: has joined #RubyOnRails
[00:32:09] blackcross: I have 4 models, User, Company, LineItem, and Manifest. company.rb contains has_and_belongs_to_many :users and user.rb contains has_and_belongs_to_many :companies . I also have ran rails g migration CreateJoinTableCompanyUser Company User . What would be the best way to implement LineItem has_many_and_belongs_to Manifest, LineItem belongs_to 1 User and 1 Company, and Manifest has_many_an
[00:32:09] blackcross: d_belongs_to LineItem, and Manifest belongs to 1 User and 1 Company ?
[00:33:43] blackcross: also, I am wondering if I should make User and Company associated with each other through an Employment model, thoughts?
[00:34:07] guacamole: what does your app do?
[00:34:41] blackcross: user creates an account, registers a company or 3 companies, each company can have seveal manifests that contain line items
[00:35:00] guacamole: why do you think you need an employment model?
[00:35:14] guacamole: does the user work for the company?
[00:35:30] guacamole: then sure, make an employment model
[00:35:30] blackcross: and the user may also work for more than 1 company as well
[00:35:59] guacamole: then yeah you can make the join an "employment"... i've done something similar in the past let me refer to an old app
[00:36:17] jottr: has joined #RubyOnRails
[00:37:11] rafaeldelucena: has joined #RubyOnRails
[00:39:20] workmad3: has joined #RubyOnRails
[00:39:39] blackcross: thank you guacamole, I am now thinking that I can have User and Company associated to LineItem through a Manifest model
[00:40:19] guacamole: blackcross idk if this will help, but here's the basics of the employment/user/company model from what i've worked on in the past https://gist.github.com/colleenmcguckin/33866beb7b2c908aaf1d734d1e10676c
[00:41:11] blackcross: no need for the keyword through?
[00:41:39] guacamole: where would you use through?
[00:42:30] blackcross: guacamole: like http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
[00:42:53] guacamole: can you tell me in english? like user has_many what through what?
[00:43:26] guacamole: oh like user has_many companies through :employment?
[00:43:28] quazimodo: has joined #RubyOnRails
[00:43:29] blackcross: user has_many :line_items, through: manifests
[00:43:35] blackcross: ahh, answered my own question :)
[00:43:43] guacamole: oh i didn't tackle that part, just the basics of the user/employment/company stuff
[00:43:57] blackcross: ty for your help! i appreciate it
[00:43:59] guacamole: talking it out in english is always my starting point
[00:44:04] guacamole: or wahtever language
[00:46:31] alfiemax: has joined #RubyOnRails
[00:52:14] quazimodo: has joined #RubyOnRails
[01:11:38] mjolnird: has joined #RubyOnRails
[01:17:06] alfiemax: has joined #RubyOnRails
[01:34:06] alfiemax: has joined #RubyOnRails
[01:35:45] mjolnird: has joined #RubyOnRails
[01:40:09] orbyt_: has joined #RubyOnRails
[01:41:07] mroutis: has joined #RubyOnRails
[01:41:35] mjolnird: has joined #RubyOnRails
[01:46:57] alfiemax: has joined #RubyOnRails
[01:51:51] ResidentBiscuit: has joined #RubyOnRails
[01:59:37] alfiemax: has joined #RubyOnRails
[02:05:10] jottr_: has joined #RubyOnRails
[02:16:37] darkhanb: has joined #RubyOnRails
[02:17:39] alfiemax: has joined #RubyOnRails
[02:33:25] jottr: has joined #RubyOnRails
[02:40:05] sevenseacat: has joined #RubyOnRails
[02:40:07] workmad3: has joined #RubyOnRails
[02:52:37] jstrong: has joined #RubyOnRails
[02:52:47] jstrong: How would you infer that a string is a valid date time or date?
[02:52:57] quazimodo: has joined #RubyOnRails
[02:52:57] jstrong: I know you can DateTime.parse or string.to_date and if invalid it throws an exception
[02:53:13] jstrong: but my understanding is that exception catching is expensive so this isn’t a super viable form of coding just to detect whether a string is a valid date or not
[02:57:26] kn-928: has joined #RubyOnRails
[03:03:48] ephemer0l: has joined #RubyOnRails
[03:09:35] mroutis: jstrong: valid in what sense? you could try a regex, however, I encourage you to use DateTime.parse, do you really can't spend resources on that?
[03:18:45] alfiemax: has joined #RubyOnRails
[03:36:26] alfiemax: has joined #RubyOnRails
[03:41:19] wojnar: has joined #RubyOnRails
[03:44:37] jstrong: has left #RubyOnRails: ()
[03:53:19] alfiemax: has joined #RubyOnRails
[04:06:07] alfiemax: has joined #RubyOnRails
[04:10:06] darkhanb: has joined #RubyOnRails
[04:15:57] fragamus: has joined #RubyOnRails
[04:19:46] alfiemax: has joined #RubyOnRails
[04:25:14] trautwein: has joined #RubyOnRails
[04:31:32] fryguy: has joined #RubyOnRails
[04:40:56] workmad3: has joined #RubyOnRails
[04:52:29] choke: has joined #RubyOnRails
[04:54:12] jackhum: has joined #RubyOnRails
[04:55:47] jnollette: has joined #RubyOnRails
[05:20:35] jackhum: has joined #RubyOnRails
[05:26:47] Vashy: has joined #RubyOnRails
[05:27:52] Vashy: I want to create a helper script to help me set up new rails apps. E.g. check and see if postgres is installed, create proper users in the db, etc; Anyone know how I can check if postgres is installed with ruby?
[05:34:34] ramfjord: has joined #RubyOnRails
[05:47:06] sidx64: has joined #RubyOnRails
[05:50:15] sidx64: has joined #RubyOnRails
[05:51:51] ramfjord: has joined #RubyOnRails
[05:57:17] sidx64: has joined #RubyOnRails
[05:57:18] kies: has joined #RubyOnRails
[05:58:07] ramfjord: has joined #RubyOnRails
[06:01:05] jottr: has joined #RubyOnRails
[06:04:21] ramfjord: has joined #RubyOnRails
[06:07:33] mroutis: has joined #RubyOnRails
[06:10:31] ramfjord: has joined #RubyOnRails
[06:13:44] jottr: has joined #RubyOnRails
[06:15:53] sidx64: has joined #RubyOnRails
[06:16:39] ramfjord: has joined #RubyOnRails
[06:19:46] sidx64: has joined #RubyOnRails
[06:22:57] ramfjord: has joined #RubyOnRails
[06:23:24] sidx64: has joined #RubyOnRails
[06:26:52] jottr: has joined #RubyOnRails
[06:31:17] mtkd: has joined #RubyOnRails
[06:36:00] morfin60: Vashy, i'd suggest to choose special tool for this(like Ansible)
[06:37:14] choke: ^ Agreed, though if you wanted to do it in ruby -- you could maybe use the gem list functionality somehow ie: gem list -i "^gem_name$"
[06:37:35] jottr: has joined #RubyOnRails
[06:37:43] choke: I know that with mysql2 without certain libraries installed, it won't let you install the gem -- so it'd be one way to tell if pg is installed if the gem acts the same way.
[06:38:13] morfin60: recently i had problem with older mysql2 gem and Mariadb
[06:38:44] morfin60: only way to build this was just fixing gem itself and install manually
[06:38:52] ramfjord: has joined #RubyOnRails
[06:39:16] choke: I'm currently having all sorts of problems with it ( not really, it's mostly problems trying to bring a horribly designed php application that's in production to rails, without being able to modify the database up-front to make it rails friendly )
[06:40:08] morfin60: why can't clone database and port(with migrations)?
[06:40:24] morfin60: and then deploy when it's ready(pass tests etc)
[06:40:56] srinidhi: has joined #RubyOnRails
[06:41:10] choke: 'cause, the php application will remain in place -- and the rails app is a json api, that i'll eventually migrate the php side to utilize ( I'm the only ruby dev on the team, everyone else is only php so I can't just bring the entire app to ruby )
[06:41:48] workmad3: has joined #RubyOnRails
[06:43:27] morfin60: and they won't learn Ruby
[06:45:01] ramfjord: has joined #RubyOnRails
[06:46:59] choke: One guy is learning ruby to help me out ( because my task list is about 3 years worth of work )... But the others - not so much. I pick my battle on this one...
[06:47:28] choke: Once the api is done, we're in a position that we can change the look and even the language multiple times a year and the functionality will always be the same.
[06:48:54] choke: Of course, so far - in 3 months of working on this myself, i've got over 3000 tests ( a bunch of pundit spec, and a bunch of request and unit spec )
[06:50:57] jottr: has joined #RubyOnRails
[06:55:55] KeyJoo: has joined #RubyOnRails
[06:59:22] jottr: has joined #RubyOnRails
[07:04:17] sidx64: has joined #RubyOnRails
[07:07:46] sidx64: has joined #RubyOnRails
[07:08:49] mtkd: has joined #RubyOnRails
[07:12:19] jottr: has joined #RubyOnRails
[07:21:34] darkhanb: has joined #RubyOnRails
[07:27:44] jottr: has joined #RubyOnRails
[07:37:00] conta: has joined #RubyOnRails
[07:39:39] dionysus69: has joined #RubyOnRails
[07:41:16] jottr: has joined #RubyOnRails
[07:49:13] jottr: has joined #RubyOnRails
[07:55:12] mtkd: has joined #RubyOnRails
[07:55:23] Qchmqs__: has joined #RubyOnRails
[07:57:30] jottr: has joined #RubyOnRails
[08:10:25] sidx64: has joined #RubyOnRails
[08:10:41] jottr: has joined #RubyOnRails
[08:12:42] morfin60: has joined #RubyOnRails
[08:14:42] hahuang65: has joined #RubyOnRails
[08:16:06] funnel: has joined #RubyOnRails
[08:18:02] dreadnal: has joined #RubyOnRails
[08:18:10] schneider: has joined #RubyOnRails
[08:22:33] Qchmqs: has left #RubyOnRails: ("Konversation terminated!")
[08:24:32] sidx64: has joined #RubyOnRails
[08:25:08] jottr: has joined #RubyOnRails
[08:27:15] sidx64: has joined #RubyOnRails
[08:33:07] sevenseacat: has joined #RubyOnRails
[08:39:56] jottr: has joined #RubyOnRails
[08:42:33] workmad3: has joined #RubyOnRails
[08:45:59] Fusselgesicht: has joined #RubyOnRails
[08:48:51] jottr: has joined #RubyOnRails
[08:49:56] t0adst00l: has joined #RubyOnRails
[08:51:19] ramfjord: has joined #RubyOnRails
[08:56:03] Ergo: has joined #RubyOnRails
[08:57:32] ramfjord: has joined #RubyOnRails
[08:57:34] mtkd: has joined #RubyOnRails
[09:00:00] jottr: has joined #RubyOnRails
[09:00:06] roshanavand: has joined #RubyOnRails
[09:03:42] ramfjord: has joined #RubyOnRails
[09:08:49] jottr: has joined #RubyOnRails
[09:12:10] morfin60: if i have bunch of JSONAPI::Resources and each have relation and i need to count AVG on one field of related models is that better to precalculate?
[09:12:55] defsdoor: has joined #RubyOnRails
[09:13:52] morfin60: seems like doing something like this: @model.blocks.where("pool_elapsed_time IS NOT NULL AND pool_elapsed_time <> 0").average(:pool_elapsed_time) is not pretty good idea since i perform extra query for each resource, also there is getter to count related to pool blocks, so it's +1 query
[09:17:09] sameerynho: has joined #RubyOnRails
[09:17:23] jottr: has joined #RubyOnRails
[09:19:52] dionysus69: has joined #RubyOnRails
[09:20:35] dionysus69: has joined #RubyOnRails
[09:23:43] mikecmpbll: has joined #RubyOnRails
[09:24:34] riotjones: has joined #RubyOnRails
[09:24:36] jottr: has joined #RubyOnRails
[09:30:18] jackhum: has joined #RubyOnRails
[09:31:34] sameerynho: has joined #RubyOnRails
[09:33:45] mtkd: has joined #RubyOnRails
[09:34:31] ramfjord: has joined #RubyOnRails
[09:38:46] jottr: has joined #RubyOnRails
[09:39:10] riotjoe: has joined #RubyOnRails
[09:40:44] ramfjord: has joined #RubyOnRails
[09:46:04] DrYockel: has joined #RubyOnRails
[09:47:06] ramfjord: has joined #RubyOnRails
[09:50:51] sidx64: has joined #RubyOnRails
[09:54:30] jottr: has joined #RubyOnRails
[10:00:07] sidx64: has joined #RubyOnRails
[10:02:28] jottr: has joined #RubyOnRails
[10:04:17] sidx64: has joined #RubyOnRails
[10:04:37] riotjones: has joined #RubyOnRails
[10:05:02] Sylario: has joined #RubyOnRails
[10:07:41] riotjones: has joined #RubyOnRails
[10:09:51] jottr: has joined #RubyOnRails
[10:12:20] noob_on_rails: has joined #RubyOnRails
[10:21:20] jottr: has joined #RubyOnRails
[10:25:21] hahuang65: has joined #RubyOnRails
[10:34:47] jottr: has joined #RubyOnRails
[10:36:08] marr: has joined #RubyOnRails
[10:41:34] jottr: has joined #RubyOnRails
[10:43:22] workmad3: has joined #RubyOnRails
[10:50:52] KeyJoo: has joined #RubyOnRails
[10:52:43] jottr: has joined #RubyOnRails
[10:54:05] gregf_: has joined #RubyOnRails
[11:00:47] jottr: has joined #RubyOnRails
[11:02:31] alfiemax: has joined #RubyOnRails
[11:04:25] sidx64: has joined #RubyOnRails
[11:09:52] jottr: has joined #RubyOnRails
[11:11:39] workmad3: has joined #RubyOnRails
[11:14:27] hmaronon: has joined #RubyOnRails
[11:18:16] hahuang65: has joined #RubyOnRails
[11:19:14] hahuang65: has joined #RubyOnRails
[11:19:40] apeiros: has joined #RubyOnRails
[11:22:40] jottr: has joined #RubyOnRails
[11:28:20] DrYockel1: has joined #RubyOnRails
[11:28:58] Cavallari: has joined #RubyOnRails
[11:30:10] jottr: has joined #RubyOnRails
[11:32:03] arBmind: has joined #RubyOnRails
[11:39:36] jottr: has joined #RubyOnRails
[11:41:05] sidx64: has joined #RubyOnRails
[11:43:02] alfiemax: has joined #RubyOnRails
[11:45:17] ramfjord: has joined #RubyOnRails
[11:52:26] ramfjord: has joined #RubyOnRails
[11:53:28] jottr: has joined #RubyOnRails
[11:58:04] ramfjord: has joined #RubyOnRails
[12:09:23] jottr: has joined #RubyOnRails
[12:12:51] mtkd: has joined #RubyOnRails
[12:19:06] jottr: has joined #RubyOnRails
[12:20:47] Cork: "DEPRECATION WARNING: The behavior of `previous_changes` inside of after callbacks..." is a bit confusing, will it give the changes that where just saved or what will it give?
[12:27:59] apparition: has joined #RubyOnRails
[12:29:51] jottr: has joined #RubyOnRails
[12:34:13] sidx64: has joined #RubyOnRails
[12:35:01] wojnar: has joined #RubyOnRails
[12:37:39] riotjones: has joined #RubyOnRails
[12:45:38] jottr: has joined #RubyOnRails
[12:48:28] roshanavand: has joined #RubyOnRails
[12:58:13] mtkd: has joined #RubyOnRails
[13:01:37] schneider: has joined #RubyOnRails
[13:11:48] workmad3: has joined #RubyOnRails
[13:14:57] alfiemax_: has joined #RubyOnRails
[13:30:28] cstls: has joined #RubyOnRails
[13:38:55] ams__: has joined #RubyOnRails
[13:45:05] jottr_: has joined #RubyOnRails
[13:51:55] ramfjord: has joined #RubyOnRails
[13:57:37] mtkd: has joined #RubyOnRails
[13:58:12] ramfjord: has joined #RubyOnRails
[14:00:17] sonOfRa: has joined #RubyOnRails
[14:00:44] tcopeland: has joined #RubyOnRails
[14:04:27] ramfjord: has joined #RubyOnRails
[14:10:46] ramfjord: has joined #RubyOnRails
[14:16:51] ramfjord: has joined #RubyOnRails
[14:41:53] DrYockel: has joined #RubyOnRails
[14:52:22] hfp_work: has joined #RubyOnRails
[14:55:57] za1b1tsu: has joined #RubyOnRails
[14:57:46] za1b1tsu: Hi, anyway I can make this work: Subject.joins(:ratings).where('ratings.score = 2').having('count(ratings.id) > 2') ?
[14:58:35] za1b1tsu: I need the subjects that have at least 3 ratings with a score of 2
[15:19:25] hfp_work: has joined #RubyOnRails
[15:25:04] beingjohnm_: I have a model with a year column and a month column. How do I order that?
[15:26:21] desperek: has joined #RubyOnRails
[15:27:38] beingjohnm_: both int columns it appears
[15:31:39] beingjohnm_: looks like posgresql 9.4 has a make_date function but I'm in postgres 0.3
[15:35:54] beingjohnm_: might upgrade from ubuntu 14.04 to 16.04
[15:42:37] workmad3: has joined #RubyOnRails
[15:48:46] uksio: has joined #RubyOnRails
[15:49:14] ramfjord: has joined #RubyOnRails
[15:52:38] RougeR: has joined #RubyOnRails
[15:55:31] ramfjord: has joined #RubyOnRails
[16:02:52] mtkd: has joined #RubyOnRails
[16:14:46] helpa-bot: has joined #RubyOnRails
[16:15:03] yonahw_: has joined #RubyOnRails
[16:15:35] sunrunner202: has joined #RubyOnRails
[16:16:47] helpa-bot: has joined #RubyOnRails
[16:18:48] helpa-bot: has joined #RubyOnRails
[16:19:05] ltd_: has joined #RubyOnRails
[16:22:57] helpa-bot: has joined #RubyOnRails
[16:23:12] fl4sh__: has joined #RubyOnRails
[16:24:25] TheMoonMaster_: has joined #RubyOnRails
[16:24:30] TViernion: has joined #RubyOnRails
[16:25:00] helpa: has joined #RubyOnRails
[16:25:43] mikecmpbll: has joined #RubyOnRails
[16:27:01] boxmein: has joined #RubyOnRails
[16:27:15] sunya7a_: has joined #RubyOnRails
[16:28:01] maqr: has joined #RubyOnRails
[16:28:14] apeiros: has joined #RubyOnRails
[16:29:27] rgr: has joined #RubyOnRails
[16:29:42] mr-spoon: has joined #RubyOnRails
[16:29:48] apeiros: has joined #RubyOnRails
[16:31:24] mluts: has joined #RubyOnRails
[16:40:35] cjoshmartin: has joined #RubyOnRails
[16:43:38] beingjohnm: has joined #RubyOnRails
[16:44:41] [Butch]: has joined #RubyOnRails
[16:54:11] conta: has joined #RubyOnRails
[16:54:57] spectra: has joined #RubyOnRails
[16:57:37] mtkd: has joined #RubyOnRails
[17:04:44] choke: has joined #RubyOnRails
[17:08:31] arthurnn: has joined #RubyOnRails
[17:12:01] one_zero: has joined #RubyOnRails
[17:12:10] Saukk: has joined #RubyOnRails
[17:12:51] jcarl43: has joined #RubyOnRails
[17:13:18] Cavallari: has joined #RubyOnRails
[17:18:42] Cavallari: has joined #RubyOnRails
[17:21:50] krawchyk: has joined #RubyOnRails
[17:23:49] dionysus69: has joined #RubyOnRails
[17:25:19] riotjoe: has joined #RubyOnRails
[17:28:27] TvL2386: has joined #RubyOnRails
[17:33:46] darkhanb: has joined #RubyOnRails
[17:41:53] brycesenz: has joined #RubyOnRails
[17:48:20] gs: has joined #RubyOnRails
[17:48:44] Coldblackice: has joined #RubyOnRails
[17:48:45] orbyt_: has joined #RubyOnRails
[17:48:47] newton: has joined #RubyOnRails
[17:49:12] Coldblackice: has joined #RubyOnRails
[17:49:12] ramfjord: has joined #RubyOnRails
[17:51:52] Liothen: has joined #RubyOnRails
[17:52:39] Coldblackice: has joined #RubyOnRails
[17:53:21] Coldblackice: has joined #RubyOnRails
[17:53:41] Coldblackice: has joined #RubyOnRails
[17:54:18] Coldblackice: has joined #RubyOnRails
[17:54:38] brycesenz: Is there a way in Ruby to get the string representation of a REGEXP definition? So, for example, to go from /this.*other/ to 'this.*other'?
[17:55:40] ramfjord: has joined #RubyOnRails
[17:55:55] alexandernst: has left #RubyOnRails: ("Bye bye!")
[17:57:12] Coldblackice: has joined #RubyOnRails
[18:01:47] Dimik: has joined #RubyOnRails
[18:02:02] ramfjord: has joined #RubyOnRails
[18:11:10] ramfjord: has joined #RubyOnRails
[18:13:11] jnollette: has joined #RubyOnRails
[18:14:58] troys: has joined #RubyOnRails
[18:15:28] havenwood: brycesenz: /this.*other/.source #=> "this.*other"
[18:15:49] havenwood: lupine: /this.*other/.to_s #=> "(?-mix:this.*other)"
[18:17:21] ramfjord: has joined #RubyOnRails
[18:18:30] ephemer0l_: has joined #RubyOnRails
[18:18:34] starseed00: has joined #RubyOnRails
[18:19:03] lupine: close enough
[18:19:09] starseed00: Is devise supposed to sign in a user that just registered by default?
[18:22:16] kies: has joined #RubyOnRails
[18:23:02] cstls: has joined #RubyOnRails
[18:23:21] ramfjord: has joined #RubyOnRails
[18:23:31] guacamole: has joined #RubyOnRails
[18:24:31] orbyt_: has joined #RubyOnRails
[18:27:28] hahuang65: has joined #RubyOnRails
[18:29:25] hahuang65: has joined #RubyOnRails
[18:33:18] cjoshmartin: has joined #RubyOnRails
[18:35:40] brycesenz: havenwood: thank you!
[18:46:08] glassresistor: has joined #RubyOnRails
[18:46:37] dviola: has joined #RubyOnRails
[18:48:48] glassresistor: i have a helper that I pull into my controllers which accesses the request and uses the data to do some things. I'd like to test this helper works without testing it behind a controller since Im using it in multiple places. in a helper spec how do I set the value of request.GET?
[18:49:23] glassresistor: i've tried using object_double(request, :GET => { ... }) which didn't work
[18:50:23] fryguy: glassresistor: consider refactoring the helper into something that doesn't require a request and instead pass it exactly what it needs, and then test that
[18:51:16] glassresistor: fryguy: thats currently out of scope but good advice.
[18:53:02] glassresistor: fryguy: when i run helper spec and check the request object it does exist but its unclear how to set it
[18:53:29] workmad3: glassresistor: also, you could consider mixin the helper into a non-controller class where you've set up your own stubbed `request` method
[18:53:37] workmad3: glassresistor: so you test in isolation with more control
[18:53:45] glassresistor: workmad3: thats something i was considering how do i do that?
[18:54:15] glassresistor: workmad3: im new to ruby via 10years of python
[18:54:34] guacamole: can you call .methods on the request object? might be insight there
[18:55:11] ramfjord: has joined #RubyOnRails
[18:55:50] workmad3: glassresistor: https://gist.github.com/workmad3/1bcbc3b98cf87a0613983edb75d54a6e <-- something like that is how I typically do it
[18:55:55] adavia: has joined #RubyOnRails
[18:57:26] workmad3: glassresistor: important thing is to just make sure that your double and your helper class implement all the methods your module expects
[18:59:27] Aherin: has joined #RubyOnRails
[18:59:48] adavia: Using rspec, is there any way i can send raw post data as JSON?, as they are being coerced into a hash in my controller when i try: before { post '/books', params: valid_attributes.to_json, headers: headers }
[19:00:14] glassresistor: workmad3: thanks ill have to do session and current_user but this makes sense
[19:01:01] glassresistor: workmad3: im surprised thate the RSpec helper type doesn't have a way of doing this. its already making a thing called helper that puts a empty request on it
[19:01:23] ramfjord: has joined #RubyOnRails
[19:07:35] ramfjord: has joined #RubyOnRails
[19:12:10] weaksauce: has joined #RubyOnRails
[19:13:13] hfp_work: has joined #RubyOnRails
[19:13:39] ramfjord: has joined #RubyOnRails
[19:21:00] ramfjord: has joined #RubyOnRails
[19:24:50] sameerynho: has joined #RubyOnRails
[19:28:59] mtkd: has joined #RubyOnRails
[19:39:26] AnotherOne: has joined #RubyOnRails
[19:42:33] thither: has joined #RubyOnRails
[19:42:35] thither: What utility does JWT offer over Rails' session store?
[19:44:11] dminuoso: thither: JWT is just a format.
[19:45:04] dminuoso: thither: Generally I'd say there's no real difference. The things you usually use the session store for can be done in JWT.
[19:50:18] srinidhi: has joined #RubyOnRails
[19:53:18] thither: has joined #RubyOnRails
[20:07:54] SteenJobs: has joined #RubyOnRails
[20:08:49] mtkd: has joined #RubyOnRails
[20:14:51] workmad3: has joined #RubyOnRails
[20:29:07] mtkd: has joined #RubyOnRails
[20:29:32] adavia: has joined #RubyOnRails
[20:34:29] beingjohnm: has joined #RubyOnRails
[20:42:25] mtkd: has joined #RubyOnRails
[20:45:58] adavia: is it possible to send parameters as raw JSON when i do post request using rspec?
[20:47:15] guacamole: has joined #RubyOnRails
[20:49:07] molloy: has joined #RubyOnRails
[20:55:22] orbyt_: has joined #RubyOnRails
[21:01:35] brycesenz: has joined #RubyOnRails
[21:03:15] veinofstars: has left #RubyOnRails: ()
[21:12:46] molloy: Why doesn't ActionController::API import AbstractController::Callbacks? Is it because using `before_action` and the like is associated with maintaining a session (useful for calling jwt decoding methods, etc.), and ActionController::API is geared towards session-less APIs?
[21:13:08] molloy: I'm looking at the master branch on github, so this question is for Rails 6.0.0-alpha, but I think also for Rails 5.x
[21:14:36] dminuoso: molloy: According to documentation AbstractController::Callbacks is included by default: http://edgeguides.rubyonrails.org/api_app.html
[21:16:00] orbyt_: has joined #RubyOnRails
[21:16:20] keegnotrub: has joined #RubyOnRails
[21:16:56] dminuoso: molloy: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/api.rb#L128
[21:16:58] molloy: Oh okay, thanks dminuoso - it looks like it is being imported in API, just managed to miss it.
[21:17:06] molloy: Yeah, looking there now :)
[21:17:42] dminuoso: molloy: If its missing, it's possible someone usefd ActionController::API.without_modules
[21:17:47] dminuoso: Welcome to side effects.
[21:19:17] molloy: They didn't, but that's a good suggestion
[21:19:54] Terens: has joined #RubyOnRails
[21:23:52] SteenJobs: has joined #RubyOnRails
[21:26:07] RougeR: has joined #RubyOnRails
[21:30:40] Radar: !botsnack
[21:30:40] helpa: Nom nom. Thanks, Radar!
[21:31:18] Radar: good morning terens
[21:32:06] Radar: Heard last night at the 130+ person Rails meetup that Rails is dead. Confirm / deny?
[21:32:26] FrostCandy: has joined #RubyOnRails
[21:32:36] dviola: has joined #RubyOnRails
[21:33:29] Radar: I guess it's time to close the channel then.
[21:35:37] krawchyk: has joined #RubyOnRails
[21:36:24] glassresistor: workmad3: so that was mostly working but besides request i also need it to have a current_user and session set. so i tried using the same pattern as request so I pass it into the class and set @current_user = some_user but then i get this error "undefined local variable or method `current_user' for #<#<Class:0x0055b6976e74b0>:0x0055b6965a68e0>
[21:36:30] glassresistor: Did you mean? @current_user"
[21:38:13] glassresistor: so for some i can set @request and call it like request in the helper but @current_user doesn't work that way
[21:40:15] Radar: glassresistor: Sorry, could you share the helper's code with us?
[21:40:24] Radar: I'm wondering why you're using request.GET
[21:40:27] Radar: I'd love to see an example.
[21:42:50] rgiscard: has joined #RubyOnRails
[21:42:58] adavia: is it possible to send parameters as raw JSON when i do post request using rspec? By default they are being coerced into a hash
[21:43:23] Radar: adavia: Can you show us what you mean? How are they being coerced into a Hash?
[21:43:31] blackcross: I have a <%= link_to 'RX', new_manifest_path %>, which links to a creating a new Manifest model instance, how would I pass in a parameter via url in the link_to? such as, :name => 'RX' ?
[21:43:46] Radar: new_manifest_path(name: 'RX')
[21:44:45] cjoshmartin: has joined #RubyOnRails
[21:46:22] blackcross: so I see that it directed to http://***:8080/manifests/new?name=RX, how would I go about reading that into the def new controller? sorry for such newbie questions, the tutorial i followed didn't cover this
[21:48:31] blackcross: figured it out
[21:48:50] adavia: Radar: sure, https://gist.github.com/adavia/c0ca1ea77e6e66e12e21e2482f4dbf65
[21:49:30] Radar: adavia: why are you using request.params and not simply params?
[21:50:14] adavia: Radar: i need to format a response being sent from the client
[21:50:25] Radar: adavia: and Rails will automatically convert the JSON body of a request to a hash in order to make it easier for you to work with it in the controller. I believe the first two lines in book_params are not required.
[21:53:06] dviola: has joined #RubyOnRails
[21:54:05] adavia: Radar: removing those lines the response looks like Parameters: {"book"=>"{\"title\":\"My example app\" } } and validation always failed
[21:54:19] Radar: hmmm I will try in a new app here. Give me a moment.
[21:57:11] Radar: adavia: what is "headers"?
[21:59:07] adavia: Radar: { "Authorization" => "token", "Content-Type" => "application/json" }
[21:59:08] Radar: adavia: I was able to make it pass by setting headers to be a hash: { "Content-Type" => "application/json" }
[21:59:21] Radar: Here's the code that I have: https://gist.github.com/radar/2e92d5918c89acffd95fa591aef1f57a
[21:59:49] Radar: I've also just added the logs output to the gist.
[21:59:58] Radar: parameters are coming through as a hash
[22:00:07] Radar: "Processing by BooksController#create as HTML" this part is weird though
[22:02:08] adavia: Radar: im having the problem here JSON.parse(request.params[:book]) as im getting a string in my app but the test ends up sending a hash
[22:02:09] Radar: Update Gist to add routes and updated log output. Needed to specify that the route was supposed to default to the JSON format.
[22:02:31] Radar: adavia: and I'm telling you that you shouldn't need to do that because Rails does that automatically, as I am demonstrating with the code that I have provided in the gist.
[22:02:35] Radar: params[:book] is enough.
[22:02:45] Radar: No need for JSON.parse, no need for the request. prefix.
[22:03:23] lupine: maybe params[:book] is in an application/x-www-urlencoded request as a string that contains json
[22:03:25] lupine: that'd be wild
[22:03:35] Radar: adavia: https://github.com/radar/adavia-books <- here's all the code that I have.
[22:05:46] Radar: And I'm testing it from the CLI by running "rails s" and making requests to it with the httpie package: "http --json POST http://localhost:3000/books title='Learning Elm'"
[22:05:48] Radar: Both the tests and the CLI works.
[22:08:16] adavia: Radar: The params i get from the client Parameters: {"book"=>"{\"title\":\"My example app\"} } Unpermitted parameter: :book, so maybe validation fails cuz of that
[22:08:32] adavia: Will check that out
[22:11:55] hahuang61: has joined #RubyOnRails
[22:14:50] lupine: hah, I called it
[22:15:44] FrostCandy: has joined #RubyOnRails
[22:17:33] FrostCandy: Hi all, I'm wondering in my routes area I have a collection do get "public" end, it works fine for my url like /place/id/action/public but I want to have /place/id/action/public/random_number is there a way I can tell rails to ignore the last slash path part ?
[22:24:57] SteenJobs: has joined #RubyOnRails
[22:27:23] fragamus: has joined #RubyOnRails
[22:30:39] FrostCandy: Ah ha! in routes I just need to add a symbol for it it seems.
[22:31:08] thither: has joined #RubyOnRails
[22:37:41] thither: has joined #RubyOnRails
[22:39:15] orbyt_: has joined #RubyOnRails
[22:44:29] roshanavand: has joined #RubyOnRails
[22:45:12] thither: has joined #RubyOnRails
[22:51:06] krawchyk: has joined #RubyOnRails
[22:52:10] TinkerTyper: has joined #RubyOnRails
[22:56:46] agent_white: has joined #RubyOnRails
[22:58:32] mtkd: has joined #RubyOnRails
[23:01:05] quazimodo: has joined #RubyOnRails
[23:04:40] hndk: has joined #RubyOnRails
[23:15:52] LyndsySimon: has joined #RubyOnRails
[23:16:53] Travis-42: has joined #RubyOnRails
[23:18:59] daxroc: has joined #RubyOnRails
[23:20:20] mostlybadfly: has joined #RubyOnRails
[23:20:26] lxkm: has joined #RubyOnRails
[23:21:22] Nuck: has joined #RubyOnRails
[23:21:49] jxf: has joined #RubyOnRails
[23:21:58] thither: has joined #RubyOnRails
[23:22:42] craysiii: has joined #RubyOnRails
[23:23:16] cardoni: has joined #RubyOnRails
[23:23:37] Fenhl: has joined #RubyOnRails
[23:23:51] jxf: has joined #RubyOnRails
[23:24:00] mostlybadfly: has joined #RubyOnRails
[23:24:03] podman: has joined #RubyOnRails
[23:24:09] fearoffish: has joined #RubyOnRails
[23:24:24] JJonah: has joined #RubyOnRails
[23:24:29] maciuszek: has joined #RubyOnRails
[23:24:37] craysiii: has joined #RubyOnRails
[23:24:47] mostlybadfly: has joined #RubyOnRails
[23:24:53] Nuck: has joined #RubyOnRails
[23:24:56] Fenhl: has joined #RubyOnRails
[23:24:57] arcturiaen: has joined #RubyOnRails
[23:25:02] maciuszek: has joined #RubyOnRails
[23:25:12] jxf: has joined #RubyOnRails
[23:25:12] JJonah: has joined #RubyOnRails
[23:25:27] podman: has joined #RubyOnRails
[23:25:30] mattwc: has joined #RubyOnRails
[23:25:34] tfitts: has joined #RubyOnRails
[23:25:35] maciuszek: has joined #RubyOnRails
[23:25:54] jxf: has joined #RubyOnRails
[23:25:56] JJonah: has joined #RubyOnRails
[23:25:56] Nuck: has joined #RubyOnRails
[23:25:58] Lloyd: has joined #RubyOnRails
[23:25:59] arcturiaen: has joined #RubyOnRails
[23:26:02] ircmaxell: has joined #RubyOnRails
[23:26:04] maciuszek: has joined #RubyOnRails
[23:26:05] Mutsuhito: has joined #RubyOnRails
[23:26:06] mostlybadfly: has joined #RubyOnRails
[23:26:09] tfitts: has joined #RubyOnRails
[23:26:10] craysiii: has joined #RubyOnRails
[23:26:14] mattwc: has joined #RubyOnRails
[23:26:22] Nuck: has joined #RubyOnRails
[23:26:28] arcturiaen: has joined #RubyOnRails
[23:26:28] JJonah: has joined #RubyOnRails
[23:26:33] maciuszek: has joined #RubyOnRails
[23:26:34] jxf: has joined #RubyOnRails
[23:26:39] Fenhl: has joined #RubyOnRails
[23:26:45] Mutsuhito: has joined #RubyOnRails
[23:26:47] tfitts: has joined #RubyOnRails
[23:26:53] arcturiaen: has joined #RubyOnRails
[23:26:55] Nuck: has joined #RubyOnRails
[23:26:56] iamdevnul: has joined #RubyOnRails
[23:27:02] maciuszek: has joined #RubyOnRails
[23:27:04] lipoqil: has joined #RubyOnRails
[23:27:05] jxf: has joined #RubyOnRails
[23:27:19] tfitts: has joined #RubyOnRails
[23:27:22] arcturiaen: has joined #RubyOnRails
[23:27:25] JJonah: has joined #RubyOnRails
[23:27:27] maciuszek: has joined #RubyOnRails
[23:27:36] Nuck: has joined #RubyOnRails
[23:27:38] Mutsuhito: has joined #RubyOnRails
[23:27:42] Fenhl: has joined #RubyOnRails
[23:27:48] manveru: has joined #RubyOnRails
[23:27:49] tycoon177: has joined #RubyOnRails
[23:27:59] jxf: has joined #RubyOnRails
[23:27:59] arcturiaen: has joined #RubyOnRails
[23:28:01] maciuszek: has joined #RubyOnRails
[23:28:17] tfitts: has joined #RubyOnRails
[23:28:17] Nuck: has joined #RubyOnRails
[23:28:34] manveru: has joined #RubyOnRails
[23:28:38] jxf: has joined #RubyOnRails
[23:28:55] doesntbyte: has joined #RubyOnRails
[23:28:55] Nuck: has joined #RubyOnRails
[23:29:08] tfitts: has joined #RubyOnRails
[23:29:41] orbyt_: has joined #RubyOnRails
[23:31:29] hahuang65: has joined #RubyOnRails
[23:34:13] Barrt: has joined #RubyOnRails
[23:39:08] Dimik: has joined #RubyOnRails
[23:42:43] Puffball: has joined #RubyOnRails