« Back to channel list

#RubyOnRails - 03 September 2017

« Back 1 day Forward 1 day »
[00:00:38] Rodya_: has joined #RubyOnRails
[00:01:38] jhfisc: has joined #RubyOnRails
[00:07:31] jhfisc: has joined #RubyOnRails
[00:17:37] orbyt_: has joined #RubyOnRails
[00:25:35] jhfisc: has joined #RubyOnRails
[00:27:50] machuga: has joined #RubyOnRails
[00:32:04] Rodya_: has joined #RubyOnRails
[00:41:41] jhfisc: has joined #RubyOnRails
[00:44:00] wethu: has joined #RubyOnRails
[00:47:51] jhfisc: has joined #RubyOnRails
[00:48:55] DTZUZO: has joined #RubyOnRails
[00:53:18] Rodya_: has joined #RubyOnRails
[01:00:49] bronson: has joined #RubyOnRails
[01:03:21] dtcristo: has joined #RubyOnRails
[01:10:02] mtkd: has joined #RubyOnRails
[01:19:10] jhfisc: has joined #RubyOnRails
[01:22:34] jhfisc: has joined #RubyOnRails
[01:23:48] pvl1: has joined #RubyOnRails
[01:24:32] pvl1: hi everyone. im rather new. so, changes to databases should be done exclusively through migrations right? is it safe to delete migrations that I have undone?
[01:38:14] irishfromua: has joined #RubyOnRails
[01:48:17] jmay: has joined #RubyOnRails
[01:54:55] pvl1: yay i did a thing
[01:55:07] pvl1: except it took several migrations to get it right
[01:55:31] pvl1: should i leave migrations? how do i know which revision im at, and whih ones were undone etc
[01:56:25] elomatreb: A database remembers where it is with a magic table for activerecord, and the schema.rb contains the authoritative schema for recreating the db from scratch
[01:56:49] elomatreb: So yes, you should keep migrations and the schema.rb file
[01:57:16] jhfisc: has joined #RubyOnRails
[01:58:26] Rodya_: has joined #RubyOnRails
[02:05:00] Jameser: has joined #RubyOnRails
[02:09:21] maryo: has joined #RubyOnRails
[02:11:06] jhfisc: has joined #RubyOnRails
[02:12:24] mars777: has joined #RubyOnRails
[02:17:10] jhfisc: has joined #RubyOnRails
[02:29:32] Jameser: has joined #RubyOnRails
[02:35:32] jmay: has joined #RubyOnRails
[02:42:38] lessless: has joined #RubyOnRails
[02:43:12] funkytwig: Hi, when I get an error in rails server (browser), i.e. >> comes up, what comands can I use. can I shee what varables exist?
[02:44:11] maxvaillancourt1: has joined #RubyOnRails
[02:44:40] elomatreb: funkytwig: IIRC it's based on pry. If it is, `ls` can give an overview of vars and certain methods
[02:45:10] jhfisc: has joined #RubyOnRails
[02:46:08] elomatreb: Otherwise, you can use the regular debugging methods, e.g. `local_variables`
[02:51:10] jhfisc: has joined #RubyOnRails
[02:56:03] jhfisc: has joined #RubyOnRails
[03:02:04] bronson: has joined #RubyOnRails
[03:04:36] funkytwig: elomatreb, I thought ls listed local varbles in pry bt it dont seem t work;{
[03:05:18] elomatreb: Maybe try the other method I mentioned? That's from core Ruby, should work
[03:25:01] apparition47: has joined #RubyOnRails
[03:33:23] one_zero: has joined #RubyOnRails
[03:59:54] amincd: has joined #RubyOnRails
[04:02:37] amincd: hi, I have a resource Users, and a singular resource under it called Account. I want to have two different routes to the #index endpoint of Reviews, one directly under Users (e.g. /users/2/reviews), and one under Users/Account (e.g. /users/2/account/reviews). Is there any way for ReviewsController to distinguish which route was used?
[04:04:38] amincd: I tried to assign a value to a flag key in the params hash in config/routes.rb, but that didn't work
[04:08:00] amincd: I have to log off, if anyone sees my question and has an answer, please respond and I'll check the channel logs later
[04:25:11] bob14: has joined #RubyOnRails
[04:29:56] segy: has joined #RubyOnRails
[04:49:59] bob14: has joined #RubyOnRails
[04:53:37] jhfisc: has joined #RubyOnRails
[04:54:02] lessless: has joined #RubyOnRails
[04:59:17] bob14: has left #RubyOnRails: ()
[05:03:16] bronson: has joined #RubyOnRails
[05:04:10] jhfisc: has joined #RubyOnRails
[05:08:00] sevenseacat: has joined #RubyOnRails
[05:35:49] segy_: has joined #RubyOnRails
[05:47:31] srinidhi: has joined #RubyOnRails
[05:55:11] jhfisc: has joined #RubyOnRails
[06:07:01] jhfisc: has joined #RubyOnRails
[06:12:09] jhfisc: has joined #RubyOnRails
[06:19:52] jhfisc: has joined #RubyOnRails
[06:20:06] bitsmart: has joined #RubyOnRails
[06:25:52] jhfisc: has joined #RubyOnRails
[06:35:56] bitsmart: has joined #RubyOnRails
[06:38:07] jhfisc: has joined #RubyOnRails
[06:38:23] apparition47: has joined #RubyOnRails
[06:40:58] jhfisc: has joined #RubyOnRails
[06:47:14] jhfisc: has joined #RubyOnRails
[07:01:24] jhfisc: has joined #RubyOnRails
[07:03:53] bronson: has joined #RubyOnRails
[07:21:34] ur5us: has joined #RubyOnRails
[07:29:13] jhfisc: has joined #RubyOnRails
[07:35:58] jhfisc: has joined #RubyOnRails
[07:41:40] lxsameer: has joined #RubyOnRails
[07:41:49] jhfisc: has joined #RubyOnRails
[07:57:38] conta: has joined #RubyOnRails
[08:05:35] amincd: has joined #RubyOnRails
[08:06:43] amincd: Ok I decided to create a separate controller for each route. I read that this is a better design pattern than having one controller handle two behaviors for the same endpoint based on a param value
[08:18:42] crst: has joined #RubyOnRails
[08:21:41] crst: Oh man, when I go to "/users/sign_out" I get the error "Couldn't find User with 'id'=sign_out" using devise. What am I doing wrong? I've already been a couple of times through the entire related google results.
[08:28:16] marr: has joined #RubyOnRails
[08:29:47] sevenseacat: youre not making it a delete request, likely
[08:32:06] crst: sevenseacat: This is the model: https://pastebin.com/3pTHpbcT
[08:32:26] sevenseacat: not related to the error
[08:32:54] sevenseacat: you also pasted a controller, not a model
[08:33:38] sevenseacat: https://github.com/plataformatec/devise/wiki/How-To:-Add-sign_in,-sign_out,-and-sign_up-links-to-your-layout-template
[08:37:17] crst: sevenseacat: THANKS!!! I needed "method: :delete"
[08:43:52] crst: lol, I have no idea how to visually present an object in Show. Objects look great in Edit and New with the form, but Show... No idea :D
[08:44:05] apparition47: has joined #RubyOnRails
[08:56:45] dionysus69: has joined #RubyOnRails
[09:05:12] bronson: has joined #RubyOnRails
[09:05:28] AzaToth: has joined #RubyOnRails
[09:29:28] machuga: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[09:45:59] NoGodDamnIdea: has joined #RubyOnRails
[09:48:11] hammer065: has joined #RubyOnRails
[09:52:55] fcser_: has joined #RubyOnRails
[10:03:31] arBmind: has joined #RubyOnRails
[10:06:22] conta: has joined #RubyOnRails
[10:25:04] roshanavand: has joined #RubyOnRails
[10:35:40] marr: has joined #RubyOnRails
[10:47:56] mtkd: has joined #RubyOnRails
[10:52:59] mikecmpbll: has joined #RubyOnRails
[10:59:49] crst: I'm using a css framework where fields with errors should be classified as input class="input is-success" or input class="input is-danger". How would you make it that the class is added to the <input> when there's an error?
[11:02:46] crst: Is there a rails way or do I need to write js?
[11:06:07] bronson: has joined #RubyOnRails
[11:16:22] pLaTo0n: has joined #RubyOnRails
[11:19:22] maryo: has joined #RubyOnRails
[11:33:05] Jameser: has joined #RubyOnRails
[11:38:30] snickers: has joined #RubyOnRails
[11:48:08] crst: This does it: https://stackoverflow.com/a/8380400
[11:49:01] shilon: has joined #RubyOnRails
[11:59:09] jtdowney: has joined #RubyOnRails
[12:01:52] dionysus69: has joined #RubyOnRails
[12:17:13] Jameser: has joined #RubyOnRails
[12:37:22] drale2k_: has joined #RubyOnRails
[12:42:47] jhfisc: has joined #RubyOnRails
[12:48:51] jhfisc: has joined #RubyOnRails
[12:53:16] moei: has joined #RubyOnRails
[13:00:11] netzfisch: has joined #RubyOnRails
[13:00:51] jhfisc: has joined #RubyOnRails
[13:07:13] bronson: has joined #RubyOnRails
[13:08:04] jhfisc: has joined #RubyOnRails
[13:08:08] netzfisch: has joined #RubyOnRails
[13:10:48] dyyylan: has joined #RubyOnRails
[13:12:02] DTZUZO: has joined #RubyOnRails
[13:14:55] jhfisc: has joined #RubyOnRails
[13:19:02] moei: has joined #RubyOnRails
[13:23:01] netzfisch: has joined #RubyOnRails
[13:26:27] robnester: has joined #RubyOnRails
[13:26:33] s2013: has joined #RubyOnRails
[13:30:19] jhfisc: has joined #RubyOnRails
[13:38:04] jhfisc: has joined #RubyOnRails
[13:43:44] tanuki: has joined #RubyOnRails
[13:50:56] jhfisc: has joined #RubyOnRails
[13:55:13] epistrephein: has joined #RubyOnRails
[14:03:17] dviola: has joined #RubyOnRails
[14:16:58] alusad: has joined #RubyOnRails
[14:19:00] brent__: has joined #RubyOnRails
[14:19:23] jhfisc: has joined #RubyOnRails
[14:20:47] unreal: has joined #RubyOnRails
[14:23:16] segy: has joined #RubyOnRails
[14:25:41] jhfisc: has joined #RubyOnRails
[14:37:34] jhfisc: has joined #RubyOnRails
[14:43:11] jhfisc: has joined #RubyOnRails
[14:44:58] lxsameer: has joined #RubyOnRails
[14:49:11] jhfisc: has joined #RubyOnRails
[14:56:59] jhfisc: has joined #RubyOnRails
[14:58:58] NoGodDamnIdea: has joined #RubyOnRails
[15:02:26] jhfisc: has joined #RubyOnRails
[15:08:49] bronson: has joined #RubyOnRails
[15:08:57] jhfisc: has joined #RubyOnRails
[15:12:02] drale2k_: has joined #RubyOnRails
[15:12:24] ndr0s: has joined #RubyOnRails
[15:16:27] DrYockel: has joined #RubyOnRails
[15:18:21] workmad3: has joined #RubyOnRails
[15:20:50] drale2k_: has joined #RubyOnRails
[15:21:15] jhfisc: has joined #RubyOnRails
[15:26:40] jhfisc: has joined #RubyOnRails
[15:28:55] ndr0s: has joined #RubyOnRails
[15:29:26] KeyJoo: has joined #RubyOnRails
[15:35:35] Papierkorb: has left #RubyOnRails: ("Konversation terminated!")
[15:45:59] brent__: has joined #RubyOnRails
[15:52:00] jhfisc: has joined #RubyOnRails
[16:03:35] jmay: has joined #RubyOnRails
[16:05:42] orbyt_: has joined #RubyOnRails
[16:07:27] netzfisch: has joined #RubyOnRails
[16:09:59] irishfromua: has joined #RubyOnRails
[16:11:22] conta: has joined #RubyOnRails
[16:16:04] newcoder: has joined #RubyOnRails
[16:16:46] newcoder: I have ruby-2.4 on linux system(fedora-26)
[16:16:59] newcoder: Can I use/install latest rails now?
[16:17:30] dminuoso: !tias newcoder
[16:17:30] helpa: Try It And See.
[16:20:15] newcoder: Is there any webpage about ruby requirement for rails-5.1.3?
[16:20:44] dminuoso: newcoder, the gem infrastructure will manage any such version requirements.
[16:21:27] newcoder: has left #RubyOnRails: ()
[16:21:29] dminuoso: newcoder, https://rubygems.org/gems/rails/versions/5.1.3 => to the right side you can see the ruby version requirement.
[16:21:39] dminuoso: (as well as runtime requirements to the left)
[16:21:59] dminuoso: Both bundler and gem will ensure that the requirements are met.
[16:31:30] netzfisch: has joined #RubyOnRails
[16:43:22] jhfisc: has joined #RubyOnRails
[16:51:04] lessless: has joined #RubyOnRails
[16:54:53] netzfisch: has joined #RubyOnRails
[16:56:42] s2013: has joined #RubyOnRails
[17:02:23] drale2k_: has joined #RubyOnRails
[17:05:33] jhfisc: has joined #RubyOnRails
[17:07:54] netzfisch: has joined #RubyOnRails
[17:08:13] jhfisc: has joined #RubyOnRails
[17:09:39] bronson: has joined #RubyOnRails
[17:13:28] crst: Can you declare a variable a view can define inside a controller like @c = T.find_by_sql("SELECT * FROM table WHERE id=#{viewvar}" or must I put the query inside the view for this to work?
[17:16:50] dminuoso: crst, queries belong inside the controller/model
[17:17:03] dminuoso: crst, so not only can you do it, you should.
[17:20:13] ^mtkd: has joined #RubyOnRails
[17:24:06] crst: dminuoso: When I try so I get undefined local variable or method `viewvar'
[17:24:07] jmay: has joined #RubyOnRails
[17:24:26] fryguy: crst: did you forget the '@'
[17:24:27] dminuoso: Is this going to be some sort of trick question?
[17:26:21] dminuoso: fryguy, days like this make me wish we had an adequate view system.
[17:26:59] jhfisc: has joined #RubyOnRails
[17:27:38] crst: This is in my view: viewvar = t.id and c = @c fryguy: which @'s are you talking about, there are 4 vars in total?
[17:28:23] Chernobuk: has joined #RubyOnRails
[17:29:07] crst: 2 in the controller and the corresponding 2 in view
[17:29:12] fryguy: show some code then
[17:29:26] segy: has joined #RubyOnRails
[17:31:35] dminuoso: crst, if you define a variable in your view, then no your controller cant use it.
[17:32:00] dminuoso: crst, your Controller#action essentially calls render at some point (if you dont do it explicitly, rails will do it for you), which basically "calls the view"
[17:33:21] crst: dminuoso: allright that's what I wanted to know. Then how can this problem be treated when I should have the query inside the controller?
[17:33:47] fryguy: crst show some code
[17:36:03] crst: fryguy: you want to see static view and controller parts of my working code?
[17:36:44] fryguy: i want you to show us enough code such that you can then ask an intelligent question with context that we can answer
[17:36:48] dminuoso: crst, how about the buggy code you are having problems with.
[17:37:08] dminuoso: ACTION grabs the popcorn
[17:37:09] dminuoso: fryguy, all yours
[17:37:39] netzfisch: has joined #RubyOnRails
[17:38:33] jhfisc: has joined #RubyOnRails
[17:41:04] crst: :( I thought my initial question was pretty good, containing all necessary info. Well I'm going to prepare something, I hope that helps.
[17:46:35] netzfisch: has joined #RubyOnRails
[17:47:13] funkytwig: has joined #RubyOnRails
[17:47:34] crst: Is that good enough? https://pastebin.com/rqmvyuYr
[17:47:52] crst: That's my buggy code btw
[17:47:53] jhfisc: has joined #RubyOnRails
[17:49:11] funkytwig: In the geting started with rails guide, http://guides.rubyonrails.org/getting_started.html, controllers are both generated as plural and singular.
[17:50:29] funkytwig: Is it the case that if you are generating the for a table they must be plural but if not the can be singular.
[17:52:18] bijan_: has joined #RubyOnRails
[17:53:12] jhfisc: has joined #RubyOnRails
[17:55:50] fryguy: ok crst and what is wrong with this
[17:57:22] bijan_: has joined #RubyOnRails
[17:59:06] crst: Well, according to dminuoso the view can't tell the controller to use var in the sql query
[18:00:06] crst: you see the WHERE clause inside the sql query? I'd like to have a where for each car.id
[18:00:29] crst: no idea how I can do that without having the query inside the view
[18:00:49] fryguy: you have a few options
[18:00:49] dminuoso: crst, please put this into the model.
[18:01:06] jhfisc: has joined #RubyOnRails
[18:01:34] fryguy: i'd argue it should be in a separate query object, but let's not get into architectural foundations here :)
[18:01:45] fryguy: there's plenty wrong with this code such that that decision (model versus query object) isn't going to matter
[18:04:05] dminuoso: Also you are doing to hit N+1 with that.
[18:04:14] crst: fryguy: I'm perfectly willing to restructure everything. Can you tell me what's all wrong?
[18:04:20] dminuoso: So even SQL wise you ought to be shot.
[18:05:36] dminuoso: crst, and next up: this will produce errors or no results at all.
[18:05:48] dminuoso: find_by_sql does not do what you think it does.
[18:06:03] crst: dminuoso: I don't know what you're talking about but the sql works perfectly fine.
[18:06:26] crst: zero errors
[18:06:30] maryo: has joined #RubyOnRails
[18:06:47] crst: at least as far as I can see imho
[18:08:09] dminuoso: crst, oh. I actually missed that asterix in the first line
[18:08:43] dminuoso: crst, either way, you are producing N+1 queries.
[18:10:02] crst: dminuoso: here's a fiddle upon which this is based: http://www.sqlfiddle.com/#!17/ea4f3/7
[18:10:43] dminuoso: TIL. sqlfiddles are a thing.
[18:11:22] crst: dminuoso: https://fiddles.io :D
[18:11:41] crst: unfortunately no rails fiddles
[18:11:48] dminuoso: crst, why is there no lambda calculus fiddle?
[18:11:52] dionysus69: has joined #RubyOnRails
[18:12:12] dminuoso: How am I going share my latest combinator discoveries without such a gloriful site?
[18:13:02] jhfisc: has joined #RubyOnRails
[18:14:07] crst: dminuoso: I don't know if you're being sarcastic...
[18:14:18] mtkd: has joined #RubyOnRails
[18:15:28] dminuoso: crst, (λx.λy.(y(xxy)))(λx.λy.(y(xxy))) just doesn't convey enough its speciality.
[18:16:22] crst: dminuoso: are you an alien being?
[18:19:11] jhfisc: has joined #RubyOnRails
[18:22:11] crst: sorry about that stupid joke :)
[18:22:32] crst: Lambda calculus is super cool
[18:25:29] ^mtkd: has joined #RubyOnRails
[18:28:33] jmay: has joined #RubyOnRails
[18:29:28] jhfisc: has joined #RubyOnRails
[18:34:58] jhfisc: has joined #RubyOnRails
[18:41:12] jhfisc: has joined #RubyOnRails
[18:43:40] mtkd: has joined #RubyOnRails
[18:47:13] jhfisc: has joined #RubyOnRails
[18:49:51] netzfisch: has joined #RubyOnRails
[18:55:41] defsdoor: has joined #RubyOnRails
[19:05:55] KeyJoo: has joined #RubyOnRails
[19:05:58] srinidhi: has joined #RubyOnRails
[19:10:40] bronson: has joined #RubyOnRails
[19:13:13] funkytwig: has joined #RubyOnRails
[19:19:47] jhfisc: has joined #RubyOnRails
[19:21:13] sagax: has joined #RubyOnRails
[19:26:12] jhfisc: has joined #RubyOnRails
[19:29:10] jhfisc: has joined #RubyOnRails
[19:32:29] Or1on: has joined #RubyOnRails
[19:34:07] jhfisc: has joined #RubyOnRails
[19:35:41] brent__: has joined #RubyOnRails
[19:38:38] shilon: has joined #RubyOnRails
[19:41:11] jhfisc: has joined #RubyOnRails
[19:43:23] jmay: has joined #RubyOnRails
[19:49:47] ayonkhan: has joined #RubyOnRails
[19:50:21] FrostCandy: has joined #RubyOnRails
[19:53:35] FrostCandy: My custom route adds an uneccesary id, is there a way to get rid of it? /controller/id/method I just want /controller/my_method, controller/my_method gives the error The action 'show' could not be found for CrmsController
[19:54:00] FrostCandy: because controller/method routes to the show action I'd guess, but I don't use show for this controller
[19:54:57] ayonkhan: has joined #RubyOnRails
[19:55:25] tamouse__: has joined #RubyOnRails
[19:55:44] dminuoso: FrostCandy, use a collection route, not a member route.
[19:56:58] FrostCandy: dminuoso: oh ok
[19:58:09] jhfisc: has joined #RubyOnRails
[19:58:26] ayonkhan: has joined #RubyOnRails
[20:03:55] netzfisch: has joined #RubyOnRails
[20:04:09] jhfisc: has joined #RubyOnRails
[20:19:47] timdotrb: has joined #RubyOnRails
[20:21:34] timdotrb: Afternoon, all
[20:23:47] roshanavand: has joined #RubyOnRails
[20:26:55] high_fiver: has joined #RubyOnRails
[20:27:38] timdotrb: I’m having an issue with solr. I have a rake task that imports data, and it keeps failing due to a solr error: RSolr::Error::Http - 400 Bad Request. The rake task will work for a couple days, and then it randomly starts producing this error. Any ideas why this happens? https://gist.github.com/willc0de4food/d1735fa2c025e42d4c642700e510c4cb
[20:37:06] jhfisc: has joined #RubyOnRails
[20:39:25] shilon: has joined #RubyOnRails
[20:42:40] SteenJobs_: has joined #RubyOnRails
[20:49:20] jmay: has joined #RubyOnRails
[20:49:54] bijan_: has joined #RubyOnRails
[20:50:42] bijan_: Wouldn't it make sense to include this active link functionality in core rails? https://github.com/comfy/active_link_to
[20:54:58] ur5us: has joined #RubyOnRails
[21:06:37] jhfisc: has joined #RubyOnRails
[21:11:54] bronson: has joined #RubyOnRails
[21:18:30] jmay: has joined #RubyOnRails
[21:21:06] jhfisc: has joined #RubyOnRails
[21:31:07] ahrs: has joined #RubyOnRails
[21:31:21] jhfisc: has joined #RubyOnRails
[21:32:19] marr: has joined #RubyOnRails
[21:36:56] jhfisc: has joined #RubyOnRails
[21:37:46] someuser: has joined #RubyOnRails
[21:42:05] jhfisc: has joined #RubyOnRails
[21:42:55] timdotrb_: has joined #RubyOnRails
[21:47:47] jhfisc: has joined #RubyOnRails
[21:52:37] SteenJobs_: has joined #RubyOnRails
[21:57:34] SteenJobs_: has joined #RubyOnRails
[22:15:37] karmayogi23: has joined #RubyOnRails
[22:20:07] Radar: GOOD MORNING
[22:40:34] jhfisc: has joined #RubyOnRails
[23:05:36] jhfisc: has joined #RubyOnRails
[23:07:10] wethu: has joined #RubyOnRails
[23:13:03] bronson: has joined #RubyOnRails
[23:30:53] SteenJobs_: has joined #RubyOnRails
[23:36:08] brent__: has joined #RubyOnRails
[23:37:10] jhfisc: has joined #RubyOnRails
[23:42:46] mostlybadfly: has joined #RubyOnRails
[23:43:10] jhfisc: has joined #RubyOnRails
[23:45:55] jhfisc: has joined #RubyOnRails
[23:47:00] ayonkhan: has joined #RubyOnRails
[23:57:04] jhfisc: has joined #RubyOnRails