« Back to channel list

#RubyOnRails - 17 October 2018

Forward 1 day »
[02:37:20] helpa: has joined #RubyOnRails
[02:37:23] Yzguy: so I've stumbled upon a legacy app doing a lot of as_json overrides in models for API routes
[02:37:46] helpa: Nom nom. Thanks, sevenseacat!
[02:37:56] Yzguy: which is super painful, because the API output is very different than what you would POST/PUT to create/update things
[02:38:29] Radar: Yzguy: sounds like active_model_serialisers is past its best before date.
[02:39:01] Yzguy: I've been reading about serializers, but all the examples I find reference using them in the index/show actions. Which makes sense to me. The question I have is that, would you/could you post back the structure you get from the index/show to an edit action and it would work?
[02:39:12] Radar: depends on the actin
[02:39:54] Yzguy: I'm mostly thinking about how the relations would work
[02:40:20] Yzguy: like if I had a Device, and it has some attributes, but it also has a ports attribute that is an array of port objects
[02:46:33] Yzguy: eh I think I could do a quick small thing to test and make my understanding better
[02:49:16] Yzguy: but yeah, the as_json override is super super painful
[02:58:57] orbyt_: has joined #RubyOnRails
[03:07:25] MrCrackPotBuilde: has joined #RubyOnRails
[03:09:30] braincrash: has joined #RubyOnRails
[03:21:32] MrCrackPotBuilde: Hi im getting a little confused wondering if someone could just confirm my thought process. As i understand devise is just a framework you can use for handling users. Its controllers handle the flow of data between the view and model. When a user registers / sign_up the registration controller is used. When a user logs in the sessions controller is used and so on and so forth for the remaining controllers. Each controller is not needed as
[03:21:32] MrCrackPotBuilde: devise auto configures them for you as is the rails way. However you can create them and override the functions. With an API we dont need sessions insteads tokens. I have been looking at https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-two#toc-authorize-api-request which doesnt use devise but should be very simple to add it. It uses an authorizeAPI class to check all requests going into the application. Checking that
[03:21:33] MrCrackPotBuilde: the headers are correct. This im guessing would remain the same as it isnt really to do with devise as such and more security for the API in general. The authenticateUser isnt a controller its a class with a entry point called call. Which encodes a JSON web token. with devise you would use authenticatable_salt not authenticate. Then you have the authenticatenController this i think would be the devise sessions controller. Should i just
[03:21:38] MrCrackPotBuilde: place that inside sessions or skip the sessions controller as its api and route instead to authenticationcontroller
[03:23:27] MrCrackPotBuilde: looking at rails routes with devise_for :users you can see signup signin etc so that also helps to find the corrisponding controller
[03:27:36] darkhanb: has joined #RubyOnRails
[03:32:14] orbyt_: has joined #RubyOnRails
[03:51:00] Yzguy: has anyone done "sub" models
[03:51:43] Yzguy: eg I'm thinking I want my url to be like /devices/1/ports, and it would give me a list of all the Port objects with the device_id of 1, which I have working. I'm confused on how POST/PUT would work to create/update
[04:04:01] Vashy: has joined #RubyOnRails
[04:04:21] Vashy: anyone have a recommendation for something like Railscast that's up to date?
[04:04:59] Vashy: e.g. I'm trying to create an edit view for a model (Property) that has_many of another model (PropertyDocument) and each of those has_one_attached document
[04:05:35] Vashy: but whenever I go to the edit view of that Property, and hit save, it creates another attachment that's a copy of the existing document
[04:05:54] Vashy: but Railscast doesn't cover any ActiveStorage material
[04:06:15] MrCrackPotBuilde: Yzguy it should be the same just the link in a different order match the route you want. you also need to define it in routes
[04:10:41] samort7: Big night tonight. Finally finished Hartl's Ruby on Rails tutorial. Got a working Twitter clone :-D
[04:11:36] FreshCache: Vashy: gorails
[04:11:45] Vashy: will check it out
[04:11:48] FreshCache: awesome samort7
[04:12:04] samort7: FreshCache, thanks!
[04:12:57] samort7: Now I need to come up with a project idea to build myself so I can get better
[04:13:58] FreshCache: usually i try to build stuff i'll wanna use
[04:15:33] samort7: Yea, I've been trying to come up with something I actually want/need and have blanking out somewhat. What were some of the first things you built when you were learning Rails?
[04:15:59] lxsameer: has joined #RubyOnRails
[04:17:15] FreshCache: stuff that already exists but none are really private like the real thing
[04:17:44] FreshCache: i put some twists in them
[04:17:56] FreshCache: eventually intend to release
[04:18:04] FreshCache: will post here for sure :)
[04:18:15] samort7: haha ok, I'll keep an eye out for them
[04:18:20] sevenseacat: apps to manage things I want to catalog
[04:18:42] FreshCache: sevenseacat: like cats?
[04:19:11] samort7: I was legit discussing with my mother today the possibility of me making a site for her
[04:19:24] samort7: She sells cats and could use some site to catalog and give info about them
[04:19:55] samort7: So a cat-alog would could be a very real thing in my future
[04:20:20] FreshCache: cats on rails
[04:20:47] samort7: Also had an interview today for a Ruby on Rails position
[04:21:05] samort7: didn't get it (but wasn't really anticipating that I would)
[04:21:34] samort7: no biggie. Was an online education company. 100% remote and only has 4 employees
[04:21:47] samort7: I'm thinking I might need a little more structure since I'm still pretty new to software dv
[04:22:36] FreshCache: rails is good for getting an overview of the process
[04:23:11] samort7: yea. I originally was learning Spring, but gave it up after a bit. I feel like I have a waaay better understanding of MVC after the Rails Tutorial than I did in the months I was learning SPring
[04:23:17] FreshCache: documentation has one of the nicest learning curves
[04:23:27] samort7: That too. Rails docs are really nice
[04:29:50] ariedler: has joined #RubyOnRails
[04:32:35] MoritaShinobu: has joined #RubyOnRails
[04:35:57] Yzguy: has joined #RubyOnRails
[04:43:34] tdy: has joined #RubyOnRails
[04:47:27] s2013: has joined #RubyOnRails
[04:59:32] FreshCache: has joined #RubyOnRails
[05:05:46] reber: has joined #RubyOnRails
[05:25:48] MoritaShinobu: has joined #RubyOnRails
[05:39:00] LenPayne: has joined #RubyOnRails
[05:41:40] whysthatso: has joined #RubyOnRails
[06:03:57] roshanavand: has joined #RubyOnRails
[06:11:43] za1b1tsu: has joined #RubyOnRails
[06:21:30] happygilmoregent: has joined #RubyOnRails
[06:21:46] happygilmoregent: I am having issues with connecting angular and rails and need some guidance
[06:23:29] arathald: has joined #RubyOnRails
[06:24:04] happygilmoregent: no errors with webpack compiles successfully but it doesn't convert the angular tag <shine-customer-app> to a router-outlet
[06:27:46] MoritaShinobu: has joined #RubyOnRails
[06:30:33] happygilmoregent: any tips on connecting rails and angularjs?
[06:31:02] ariedler: has joined #RubyOnRails
[06:31:14] srinidhi: has joined #RubyOnRails
[06:34:53] Puffball: has joined #RubyOnRails
[06:49:11] beholders_eye: has joined #RubyOnRails
[06:54:57] syndikate: When sorting with ransack if the field values are all same ransack does not sort the entire table - how does ransack manage to do that?
[06:56:00] syndikate: My assumption was this - even if the specific column values are all same, the table should get sorted desc and ask alternatively. Is it because the SQL query returns the rows without difference?
[07:08:36] lunarkitty7: has joined #RubyOnRails
[07:15:35] whysthatso: has joined #RubyOnRails
[07:18:32] ss942: has joined #RubyOnRails
[07:19:59] ss942: I can't call function from my helper inside partial... I included it in controller, and it works in index.html.erb
[07:20:26] sevenseacat: ss942: can you show us your code?
[07:20:57] ss942: sevenseacat: give me a minute
[07:27:53] ss942: https://github.com/lapinskik/redmine_wktime/blob/master/app/controllers/wkaccount_controller.rb <- controller
[07:27:53] ss942: https://github.com/lapinskik/redmine_wktime/blob/master/app/helpers/wkcustomfields_helper.rb <- this is the helper
[07:27:53] ss942: https://github.com/lapinskik/redmine_wktime/blob/master/app/views/wkaccount/edit.html.erb <- I render partial there
[07:27:53] ss942: https://github.com/lapinskik/redmine_wktime/blob/master/app/views/wkcustomfields/_relations.html.erb <- this is the partial
[07:29:16] gambl0r3: has joined #RubyOnRails
[07:29:31] sevenseacat: so what line is causing the error
[07:30:13] ss942: and method that returns "method or variable not found" is options_for_project_select in 12 line of relations partial
[07:31:46] sevenseacat: can you gist the full error please
[07:32:02] ss942: >ActionView::Template::Error (undefined local variable or method `options_for_projects_select' for #<#<Class:0x00000000067ae0a8>:0x00007f78b581e540>
[07:32:30] sevenseacat: thats projects_select, not project_select
[07:32:52] sevenseacat: thats not what your code uses
[07:32:58] sevenseacat: unless youre looking at other code
[07:34:42] ss942: oh it's copy pasted, from log's before I renamed method
[07:35:13] sevenseacat: can you gist the full error for real, please?
[07:36:21] sevenseacat: including backtrace
[07:36:25] ss942: sevenseacat: https://pastebin.com/h1i4tkX9
[07:36:43] ss942: hmm strange
[07:36:52] sevenseacat: that variable does not exist in that code
[07:37:13] sevenseacat: do you have a caching issue? try restarting your server/spring
[07:37:14] ss942: I hadn't reloaded nginx
[07:37:56] ss942: https://pastebin.com/hjWcKxwk
[07:39:20] tuor: has joined #RubyOnRails
[07:40:20] ss942: I just don't know why I can't access options_for_project_select I included it in wkaccount_controller, but _relations.html.erb dosen't allow me to see it.
[07:40:25] ss942: to use it*
[07:47:00] sevenseacat: you shouldn't need to include the helper, unless redmine does weird things
[07:47:31] sevenseacat: https://stackoverflow.com/questions/17299484/redmine-plugin-development-helper-method-not-found-in-view ?
[07:50:38] armyriad: has joined #RubyOnRails
[07:57:59] GodFather: has joined #RubyOnRails
[08:15:15] lxsameer: has joined #RubyOnRails
[08:17:06] mikecmpbll: has joined #RubyOnRails
[08:19:08] srinidhi: has joined #RubyOnRails
[08:20:48] ss942: sevenseacat: thank you very much
[08:32:00] ariedler: has joined #RubyOnRails
[08:50:55] ReporterMan: has joined #RubyOnRails
[09:16:45] sandstrom: has joined #RubyOnRails
[09:20:22] Reporter_: has joined #RubyOnRails
[09:23:37] Ergo: has joined #RubyOnRails
[09:27:16] ikbenhet: has joined #RubyOnRails
[09:32:15] SanguineAnomaly: has joined #RubyOnRails
[09:42:07] bijan_: has joined #RubyOnRails
[09:51:51] za1b1tsu: has joined #RubyOnRails
[09:55:42] andywww: has joined #RubyOnRails
[10:19:04] lxsameer: has joined #RubyOnRails
[10:26:25] za1b1tsu: has joined #RubyOnRails
[10:32:11] apeiros_: has joined #RubyOnRails
[10:32:48] ariedler: has joined #RubyOnRails
[10:37:58] lxsameer: has joined #RubyOnRails
[10:46:41] apeiros_: has joined #RubyOnRails
[10:47:24] apparition: has joined #RubyOnRails
[10:49:35] lankanmon: has joined #RubyOnRails
[10:52:13] kurko_: has joined #RubyOnRails
[10:55:08] ariedler: has joined #RubyOnRails
[10:56:00] apeiros: has joined #RubyOnRails
[11:15:06] lxsameer: has joined #RubyOnRails
[11:15:54] DTZUZO_: has joined #RubyOnRails
[11:19:38] ikbenhet: has joined #RubyOnRails
[11:45:16] lxsameer: has joined #RubyOnRails
[11:52:41] crankharder: has joined #RubyOnRails
[12:00:14] za1b1tsu: has joined #RubyOnRails
[12:03:21] nertzy: has joined #RubyOnRails
[12:07:08] Pupeno_: has joined #RubyOnRails
[12:07:39] crankharder: has joined #RubyOnRails
[12:12:20] kapil____: has joined #RubyOnRails
[12:13:13] Pupeno_: I'm building an application that will have many complex evolving email workflows. Are there any tools out there that can host and/or help build those emails?
[12:33:06] lxsameer: has joined #RubyOnRails
[12:55:44] GodFather: has joined #RubyOnRails
[12:56:14] nertzy: has joined #RubyOnRails
[12:57:53] apeiros_: has joined #RubyOnRails
[13:02:07] whysthatso: has left #RubyOnRails: ()
[13:07:07] whysthatso: has joined #RubyOnRails
[13:07:39] knight33: has joined #RubyOnRails
[13:08:02] crankharder: has joined #RubyOnRails
[13:08:30] IanMalcolm: has joined #RubyOnRails
[13:09:10] whysthatso: has joined #RubyOnRails
[13:10:07] deathwishdave: has joined #RubyOnRails
[13:10:46] ikbenhet: has joined #RubyOnRails
[13:19:40] apeiros_: has joined #RubyOnRails
[13:36:42] lxsameer: has joined #RubyOnRails
[13:37:43] crankhar1er: has joined #RubyOnRails
[13:42:39] Xiti: has joined #RubyOnRails
[13:46:55] bothari: has joined #RubyOnRails
[13:49:10] bothari: Hello. I'm learning rails, I'm curious about editing and forms. I have an event object that has many tasks. When creating or editing the event, I want to be able to add/remove/edit the tasks, too.
[13:49:55] bothari: I've heard about partials, and I think that's the right approach, but I'm looking for a good tutorial. Any ideas?
[13:51:13] Xiti: has joined #RubyOnRails
[13:57:54] tbuehlmann: bothari: you can read up on accepts_nested_attributes and fields_for, that's for creating/updating a record and its children using one form. dynamically adding/removing tasks using js is not really supported in rails itself, but there's the cocoon library, which will help doing exactly that
[13:58:27] bothari: Ah! Maybe thats the piece I'm missing.
[13:58:53] bothari: I'll check out accepts_nested. Thanks for the tip!
[13:59:11] IanMalcolm: has joined #RubyOnRails
[14:21:17] knight33: has joined #RubyOnRails
[14:22:18] devops__: has joined #RubyOnRails
[14:22:38] lexileo: has joined #RubyOnRails
[14:22:42] Dbugger: has joined #RubyOnRails
[14:25:56] sandstrom: has joined #RubyOnRails
[14:26:24] IanMalcolm: has joined #RubyOnRails
[14:29:41] MoritaShinobu: has joined #RubyOnRails
[14:32:07] dbugger_: has joined #RubyOnRails
[14:34:24] crankharder: has joined #RubyOnRails
[14:34:26] kurko__: has joined #RubyOnRails
[14:39:06] srinidhi: has joined #RubyOnRails
[14:39:51] planigan_: has joined #RubyOnRails
[14:46:49] sandstrom: has joined #RubyOnRails
[14:48:04] kurko_: has joined #RubyOnRails