« Back to channel list

#RubyOnRails - 11 March 2016

« Back 1 day Forward 1 day »
[00:02:09] moses: whats up with the syntax used here: //= require sub/something
[00:02:35] weaksauce: moses it should be setup by default to add everything inside the assets/stylesheets/ folder. you can change it later when you know what you are doing.
[00:02:50] Radar: moses: Please read the guide thoroughly.
[00:03:12] Radar: moses: If you need someone to stop you from asking questions in the channel so that you can dedicate time to reading the guide, I can help with that :)
[00:04:33] moses: Radar: the guide is aids
[00:04:46] Radar: +q moses!*@*
[00:04:52] Radar: 1 day quiet. See you tomorrow.
[00:05:35] weaksauce: jesus... it's a well written document moses
[00:06:17] uglybandersnatch: has joined #RubyOnRails
[00:06:20] SteenJobs: it probs feels like that if you’re not terribly used to reading docs, vs having someone show/teach/explain to you how to do something
[00:06:21] hahuang65: has joined #RubyOnRails
[00:06:58] Alejandro15: has joined #RubyOnRails
[00:07:32] Alejandro15: has left #RubyOnRails: ()
[00:07:57] weaksauce: one thing that irked me was how the devs didn't list all the guides in the menu at the top... only the ones that they thought were "complete" even though they pretty much never get there because rails gets updated all the time and the guides get a little bit outdated
[00:09:09] Radar: When you get referred to a specific section of the guide, you should read that.
[00:09:11] helpa: Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
[00:09:27] B1n4r10: has joined #RubyOnRails
[00:09:54] ss_much: has joined #RubyOnRails
[00:10:29] news_bruin: I have a question. I would take any reference help that you got. I have tried to Google. But I may not know the correct way to ask the question
[00:11:05] Radar: news_bruin: ask it and we'll direct you in it :)
[00:14:23] news_bruin: I am using the PostsController Class to def an index method for my posts. I would like to generate a specific link on the fly based on data stored in the Post model but for every Post that is rendered. I can do this with the 'show' method for /posts/1 by passing the :id parameter but I don't know how to do this for each one without just inserting the code into the 'view'... and I don't really want to do that if I don't have to because it gets mes
[00:15:39] SteenJobs: what’s the nature of this specific link
[00:17:51] news_bruin: I want to pull a link to an image from an external site for a preview. a la reddit. 'show' method, that looks like. @post = Post.find(params[:id]) ... @url = Domainatrix.parse(@post.title) ... @object = LinkTumbnailer.generate(@url.url).favicon
[00:20:40] imerx: has joined #RubyOnRails
[00:20:47] barajasfab: has joined #RubyOnRails
[00:20:49] wolfravenous: Radar: Thanks again for the R4IA, just wondering if you might glance at my logic here and see if you think this will work in the models, I put it together using the railsguides.org site. http://pastie.org/10755067
[00:21:10] joshkovach: has joined #RubyOnRails
[00:21:30] DLSteve: has joined #RubyOnRails
[00:22:30] Trynemjoel: has joined #RubyOnRails
[00:23:25] baweaver: http://www.codeproject.com/Articles/359654/important-database-designing-rules-which-I-fo - that helps with some DB design
[00:23:49] tdlm: has joined #RubyOnRails
[00:23:56] SteenJobs: has joined #RubyOnRails
[00:24:10] baweaver: https://www.ntu.edu.sg/home/ehchua/programming/sql/Relational_Database_Design.html - and that's a pretty good quick one
[00:24:26] baweaver: One thing I've learned with databases is to spend as much time as needed to get it right the first time
[00:24:38] baweaver: because refactoring a database after it's created is painful.
[00:25:59] wolfravenous: baweaver: Thanks for the links… this is one of my concerns is getting everything relating correctly, because if that foundation isn’t correct the whole thing falls apart.
[00:26:33] one_zero: has joined #RubyOnRails
[00:27:17] uglybandersnatch: has joined #RubyOnRails
[00:27:21] wolfravenous: baweaver: I have worked through rails tutorials in the past to build simple apps, but haven’t built an app in a couple of years.
[00:28:00] gr1m_: has joined #RubyOnRails
[00:28:43] wolfravenous: baweaver: even then the data I was realating was usually just a couple of things like products and categories… trying to do a schedule app for school and now I got students, teachers, class topics, and time blocks to all relate so it is quite the challenge for me, heehe :)
[00:29:47] baweaver: The biggest challenge, and often the seemingly easiest, is getting your database ready to handle things
[00:30:04] baweaver: most tend to make the DB first and shoehorn concerns later, which makes a massive code mess
[00:30:32] IFrank00: has joined #RubyOnRails
[00:31:31] Ropeney: baweaver, are you saying a hammer isn't the best tool?
[00:31:44] baweaver: depends on the hammer
[00:32:13] baweaver: If nothing else, a good hammer can help you with people who ask questions about hammers to be clever }:)
[00:32:13] sterling: has joined #RubyOnRails
[00:32:43] ebbflowgo: has joined #RubyOnRails
[00:33:14] wolfravenous: I am used to using scaffold to build the database as I build the mvc files for the app.
[00:33:45] baweaver: make sure you understand what scaffolds do for you
[00:33:48] Ropeney: drawing out class diagrams := winning
[00:34:01] Arcaire: lmao hammers
[00:34:06] baweaver: Someone's been using Go
[00:34:10] Arcaire: try katanas
[00:34:16] Arcaire: I train with my Katana every day, this superior weapon can cut clean through steel because it is folded over a thousand times, and is vastly superior to any other weapon on earth.
[00:34:32] Ropeney: Arcaire, except for the bullet
[00:34:34] baweaver: and someone else has been watching too much anime
[00:34:41] Ropeney: bedouin, Go uses := ?
[00:34:55] baweaver: miss, try again :P
[00:35:07] baweaver: type inference, it does.
[00:35:15] baweaver: I think Smalltalk did too, I'd have to look.
[00:35:34] bedouin: Ropeney: just doing research on various languages... not quite a user
[00:35:48] Ropeney: baweaver, Go uses := ? :P
[00:35:49] Arcaire: lmao just watching anime
[00:35:57] Arcaire: I draw Anime and Manga on my tablet, and spend my days perfecting my art and playing superior Japanese games tbh.
[00:36:17] wolfravenous: Ropeney: I did draw it all out on paper first… but we gotta be all 21st century now and put it online :)
[00:37:04] mwcmitchell: has joined #RubyOnRails
[00:39:02] lemur: has joined #RubyOnRails
[00:40:37] dalbuschat: has joined #RubyOnRails
[00:41:17] maxdoubt: has joined #RubyOnRails
[00:43:41] YourManCJ: has joined #RubyOnRails
[00:43:47] YourManCJ: hey, how can I use link_to to link to a specific <section> on a page?
[00:44:12] pawnbox: has joined #RubyOnRails
[00:44:16] Ropeney: YourManCJ <%= link_to 'click me', '#id-of-section' %>
[00:44:35] smathy: YourManCJ, google "fragment identifiers"
[00:44:37] YourManCJ: sorry should have specified, how can I do it between different pages?
[00:45:04] Devalo: has joined #RubyOnRails
[00:45:11] smathy: YourManCJ, same diff.
[00:45:31] Ropeney: <%= link_to 'click me', something_path(@somehting, anchor: 'theidanchor') %>
[00:45:53] YourManCJ: ok got it, thanks guys
[00:48:38] B1n4r10: has joined #RubyOnRails
[00:49:51] chouhoulis: has joined #RubyOnRails
[00:53:56] Maletor: has joined #RubyOnRails
[00:55:00] PedramT: has joined #RubyOnRails
[00:56:27] Uber|Dragon: has joined #RubyOnRails
[00:57:03] ur5us: has joined #RubyOnRails
[00:57:38] dopie: has joined #RubyOnRails
[00:57:49] uglybandersnatch: has joined #RubyOnRails
[00:59:15] jstransky: has joined #RubyOnRails
[01:00:12] flashpoint9: has joined #RubyOnRails
[01:05:17] quazimodo: has joined #RubyOnRails
[01:05:27] hnanon: has joined #RubyOnRails
[01:05:44] hnanon: I'm having some problems with Pundit.
[01:05:59] hnanon: I have a Job model. It's not nested under User.
[01:06:31] hnanon: For the users show action, for example, I have: @user == @record or @user.role == "admin"
[01:06:37] crdpink2: has joined #RubyOnRails
[01:06:51] hnanon: However, I'm not sure what the rule should be for the jobs show action.
[01:11:07] crdpink: has joined #RubyOnRails
[01:17:49] chipotle: has joined #RubyOnRails
[01:18:44] baweaver: has joined #RubyOnRails
[01:21:09] echobasecamp: has joined #RubyOnRails
[01:22:53] pwnd_nsfw: has joined #RubyOnRails
[01:24:04] pawnbox: has joined #RubyOnRails
[01:24:15] duderono_: has joined #RubyOnRails
[01:26:06] maxdoubt: has joined #RubyOnRails
[01:26:59] hnanon: I figured it out. In the show action I needed authorize @job.user instead of authorize @job.
[01:27:18] Rubie: has joined #RubyOnRails
[01:28:14] SeanLazer: does anyone know if there's a way to get a backtrace in sprockets of where a file is being imported or required? i have an error in a CSS file but as far as I know i've removed the @import call for that file
[01:28:34] SeanLazer: i'm wondering if it's being imported or required somewhere else, possibly out of order, causing the error in the first place
[01:30:25] jottr_: has joined #RubyOnRails
[01:30:42] DmitryBochkarev: has joined #RubyOnRails
[01:31:18] maxdoubt: has joined #RubyOnRails
[01:31:32] SeanLazer: never mind, someone created an initializer and threw this in: Rails.application.config.assets.precompile += [/.*\.js/,/.*\.css/]
[01:32:26] gbgdev: has joined #RubyOnRails
[01:34:19] ebbflowgo: has joined #RubyOnRails
[01:37:33] uglybandersnatch: has joined #RubyOnRails
[01:38:23] korzybski: has joined #RubyOnRails
[01:38:39] baweaver: has joined #RubyOnRails
[01:38:55] korzybski: Brand new Rails 4.2 app, I’ve set the secret_key_base in my secrets.yml, and I’m getting “Incomplete response received from application” — ideas?
[01:40:17] ebbflowgo: has joined #RubyOnRails
[01:41:32] Miron: has joined #RubyOnRails
[01:41:33] DEA7TH: has joined #RubyOnRails
[01:42:25] RegulationD: has joined #RubyOnRails
[01:43:34] YourManCJ: has joined #RubyOnRails
[01:44:10] jenrzzz: has joined #RubyOnRails
[01:45:56] Contigi: has joined #RubyOnRails
[01:46:40] Devalo: has joined #RubyOnRails
[01:47:20] uglybandersnatch: has joined #RubyOnRails
[01:48:37] IFrank00: has joined #RubyOnRails
[01:57:39] duderono_: has joined #RubyOnRails
[02:04:16] pawnbox: has joined #RubyOnRails
[02:06:34] mines999: has joined #RubyOnRails
[02:08:22] YourManCJ: has joined #RubyOnRails
[02:09:26] stardiviner: has joined #RubyOnRails
[02:09:27] superlou: has joined #RubyOnRails
[02:09:46] braincra-: has joined #RubyOnRails
[02:10:31] sevenseacat: has joined #RubyOnRails
[02:12:56] bricker: has joined #RubyOnRails
[02:13:08] mwlang: has joined #RubyOnRails
[02:14:49] Rinalds: has joined #RubyOnRails
[02:14:57] DLSteve: has joined #RubyOnRails
[02:15:19] kdough: has joined #RubyOnRails
[02:17:39] ebbflowgo: has joined #RubyOnRails
[02:18:14] workmad3: has joined #RubyOnRails
[02:23:10] tjbiddle: has joined #RubyOnRails
[02:24:41] tjbiddle: Hey all - Looking into Pundit and CanCanCan; both seem to use after_filters for checking authorization (Which Pundit mentions is an issue on mutable controller actions) - CanCanCan has an option to load and authorize a resource prior, but seems odd how they do it as it's all 'magic'. What am I missing here? They seem so popular but these seem like big flaws.
[02:26:49] Arcaire: So what's your actual issue?
[02:28:20] delgiudices: has joined #RubyOnRails
[02:29:55] delgiudi_: has joined #RubyOnRails
[02:31:18] jstransky: has joined #RubyOnRails
[02:32:41] B1n4r10: has joined #RubyOnRails
[02:32:47] tjbiddle: Arcaire: I guess the main issue was the load_resource - Thought that was too much magic; but I see ways to override it when necessary. So never mind - looks like a good solution
[02:33:01] spyd3r: has joined #RubyOnRails
[02:33:34] makerop: has joined #RubyOnRails
[02:34:11] dubalubdub: has joined #RubyOnRails
[02:39:09] jottr: has joined #RubyOnRails
[02:39:55] baweaver: has joined #RubyOnRails
[02:40:44] flashpoint9: has joined #RubyOnRails
[02:41:17] norc_: has joined #RubyOnRails
[02:42:52] spyd3r: has joined #RubyOnRails
[02:43:34] merida: has joined #RubyOnRails
[02:47:25] spyd3r: has joined #RubyOnRails
[02:49:27] KensoDev: has joined #RubyOnRails
[02:51:35] k1t: has joined #RubyOnRails
[02:53:07] blackmesa: has joined #RubyOnRails
[02:56:48] TheNet: has joined #RubyOnRails
[02:57:00] PedramT: has joined #RubyOnRails
[02:57:38] CBX: has joined #RubyOnRails
[03:00:31] chagel: has joined #RubyOnRails
[03:05:23] mwlang: for Rails 4.1, if a user has_many :roles, through: :role_assignments, does Rails not automatically assign params[:user][:role_ids] where that role_ids is [“1”, “2”] ?
[03:06:52] mwlang: oh, wait, I’m seeing unpermitted parameter: role_ids
[03:07:22] zave: has joined #RubyOnRails
[03:09:06] mwlang: had to change [:first_name, :last_name, :email, :role_ids] to [:first_name, :last_name, :email, {role_ids: []}]
[03:09:35] mag42c: has joined #RubyOnRails
[03:11:34] chagel: has joined #RubyOnRails
[03:14:13] DoctorMonocular: has joined #RubyOnRails
[03:14:33] AnoHito: has joined #RubyOnRails
[03:15:24] maxdoubt: has joined #RubyOnRails
[03:16:34] chagel: has joined #RubyOnRails
[03:21:34] chagel: has joined #RubyOnRails
[03:21:34] cpruitt: has joined #RubyOnRails
[03:23:16] greenhat-: has joined #RubyOnRails
[03:23:36] nullwarp_: has joined #RubyOnRails
[03:24:17] crankhar1er: has joined #RubyOnRails
[03:25:44] Sanguine1nomaly: has joined #RubyOnRails
[03:27:08] uglybandersnatch: has joined #RubyOnRails
[03:27:20] B1n4r10: has joined #RubyOnRails
[03:27:58] SteenJobs: has joined #RubyOnRails
[03:30:31] gr1m_: has joined #RubyOnRails
[03:31:43] roshanavand: has joined #RubyOnRails
[03:31:52] chagel: has joined #RubyOnRails
[03:34:06] weaksauce: tjbiddle i prefer pundit fwiw
[03:34:10] pawnbox: has joined #RubyOnRails
[03:34:18] weaksauce: less magic and it does what it does well
[03:34:45] tjbiddle: weaksauce: Any comment on how it only checks authorization after an action is run though?
[03:35:14] tjbiddle: That's my main concern. I don't want someone to update an object they're not allowed to; and while it renders "unauthorized" it's done in an after_filter and the object is already modified
[03:36:19] weaksauce: pundit does what you tell it to... you can change when you call the auth
[03:37:18] weaksauce: tjbiddle where do you see the aftercheck?
[03:37:54] tjbiddle: weaksauce: https://github.com/elabs/pundit#what-is-this-not
[03:38:19] prgmmr: has joined #RubyOnRails
[03:38:28] sevenseacat: "Assuming the update action for the UsersController is not authorized"
[03:38:40] sevenseacat: hey authorize your shit and authorization will occur!
[03:38:56] roshanavand: has joined #RubyOnRails
[03:39:14] weaksauce: those are just the post sanity checks though
[03:39:43] mag42c: has joined #RubyOnRails
[03:40:03] weaksauce: tjbiddle that's just a sanity check that you didn't fuck up in calling pundit before the controller action was completed
[03:40:43] weaksauce: tjbiddle you still need to call authorize first
[03:41:16] tjbiddle: I'll play with it
[03:41:59] weaksauce: tjbiddle it's request -> controller action -> authorize the action unless you tell it that it's ok not to -> post action checks that you didn't forget to auth it
[03:42:40] tjbiddle: Strange having that then. It's like having a test in live code
[03:43:13] weaksauce: you don't need it as it's optional but it's nice to have
[03:43:41] tjbiddle: Hm; still - I'll play with it
[03:43:45] tjbiddle: Thanks for the feedback!
[03:43:48] weaksauce: no magic. just a method call
[03:43:53] SeanLazer: has joined #RubyOnRails
[03:44:10] weaksauce: you can not use that feature if you don't want it because it's just an after filter
[03:46:18] weaksauce: tjbiddle both are ok though... just different philosophies
[03:47:12] delgiudices: How can i find a radio button with capybara by value
[03:48:11] Devalo: has joined #RubyOnRails
[03:48:54] djbkd: has joined #RubyOnRails
[03:49:51] hahuang61: has joined #RubyOnRails
[03:50:11] newircuser: has joined #RubyOnRails
[03:52:37] chagel: has joined #RubyOnRails
[03:53:03] Rubie: has joined #RubyOnRails
[03:57:09] blackmesa: has joined #RubyOnRails
[03:57:28] chagel: has joined #RubyOnRails
[03:58:34] Radar: delgiudices: choose "button"
[03:59:16] delgiudices: Radar i actually had a really weird bug because i forgot to login_as :/
[03:59:24] delgiudices: So i was not in the correct place
[03:59:34] Ropeney: has joined #RubyOnRails
[04:00:41] uglybandersnatch: has joined #RubyOnRails
[04:03:58] SteenJobs: has joined #RubyOnRails
[04:04:00] paradisaeidae_: has joined #RubyOnRails
[04:04:15] pawnbox: has joined #RubyOnRails
[04:10:48] chagel: has joined #RubyOnRails
[04:14:06] chipotle: has joined #RubyOnRails
[04:15:48] chagel: has joined #RubyOnRails
[04:15:50] gonglexin: has joined #RubyOnRails
[04:16:01] uglybandersnatch: has joined #RubyOnRails
[04:17:20] fedexo: has joined #RubyOnRails
[04:17:45] braincrash: has joined #RubyOnRails
[04:20:48] chagel: has joined #RubyOnRails
[04:21:11] pawnbox: has joined #RubyOnRails
[04:22:51] rogue_koder: has joined #RubyOnRails
[04:23:21] pawnbox_: has joined #RubyOnRails
[04:25:49] chagel: has joined #RubyOnRails
[04:27:08] k1t: has joined #RubyOnRails
[04:27:13] AntiSpamMeta: has joined #RubyOnRails
[04:31:22] k1t_: has joined #RubyOnRails
[04:31:41] mines999: has joined #RubyOnRails
[04:33:18] chagel: has joined #RubyOnRails
[04:35:31] gonglexin: has joined #RubyOnRails
[04:35:39] treaki_: has joined #RubyOnRails
[04:37:53] krz: has joined #RubyOnRails
[04:38:40] Rubie: has joined #RubyOnRails
[04:39:37] IrishGringo: has joined #RubyOnRails
[04:39:47] Arcaire: please clap
[04:39:59] Arcaire: jesus christ i need to find a better irc client than this
[04:40:52] Ropeney: textual is good, and hexchat
[04:41:04] Arcaire: yeah but then i need to host a bouncer again
[04:41:10] Arcaire: and then i need to pay for ddos protection
[04:43:17] Ropeney: you get ddos'd through your IRC?
[04:43:55] Arcaire: When you're in my field of work you have to hang out with people with botnets.
[04:43:59] Arcaire: They like to test sometimes.
[04:44:11] Arcaire: Also I use the term 'hang out' incredibly loosely.
[04:45:06] Arcaire: Not hugely, hardly the greatest part of the job.
[04:45:24] Ropeney: and whats the job, if u may tell.
[04:45:45] Arcaire: Instagram food blogger.
[04:46:07] Trynemjoel: has joined #RubyOnRails
[04:46:32] uglybandersnatch: has joined #RubyOnRails
[04:46:44] Ropeney: must be very competitive :D
[04:47:30] Arcaire: As much as that is *actually* a thing, I am not seriously one. I actually work in information security.
[04:47:40] Arcaire: Some in here may also refer to my job title as "professional shitposter".
[04:51:09] stardiviner: has joined #RubyOnRails
[04:53:27] Trynemjoel: has joined #RubyOnRails
[04:58:32] blackmesa: has joined #RubyOnRails
[04:58:46] hahuang61: has joined #RubyOnRails
[04:59:27] krz: Where is a good place to put code that is commonly used across service objects? Was thinking app/mixins ?
[04:59:46] sevenseacat: has joined #RubyOnRails
[04:59:58] PedramT: has joined #RubyOnRails
[05:00:49] roshanavand: has joined #RubyOnRails
[05:01:02] hinbody: has joined #RubyOnRails
[05:01:11] KensoDev: has joined #RubyOnRails
[05:03:49] tjbiddle_: has joined #RubyOnRails
[05:03:50] czerasz: has joined #RubyOnRails
[05:05:24] SteenJobs: has joined #RubyOnRails
[05:05:52] gonglexin: has joined #RubyOnRails
[05:06:59] KensoDev: has joined #RubyOnRails
[05:09:26] baweaver: has joined #RubyOnRails
[05:10:53] Pazician: has joined #RubyOnRails
[05:13:08] djbkd: has joined #RubyOnRails
[05:14:28] chagel: has joined #RubyOnRails
[05:17:15] roshanavand: has joined #RubyOnRails
[05:19:48] sp1rs: has joined #RubyOnRails
[05:20:48] SteenJobs: has joined #RubyOnRails
[05:22:39] quazimodo: has joined #RubyOnRails
[05:26:46] djbkd: has joined #RubyOnRails
[05:27:53] Trynemjoel: has joined #RubyOnRails
[05:32:16] qhp: has joined #RubyOnRails
[05:33:13] ashishsingh173: has joined #RubyOnRails
[05:36:17] gonglexin: has joined #RubyOnRails
[05:37:19] chagel: has joined #RubyOnRails
[05:39:22] merida: has joined #RubyOnRails
[05:39:30] rvanlieshout: has joined #RubyOnRails
[05:40:34] jenrzzz: has joined #RubyOnRails
[05:41:04] borodin: has joined #RubyOnRails
[05:41:39] roshanavand: has joined #RubyOnRails
[05:42:17] Chagel_: has joined #RubyOnRails
[05:43:57] RegulationD: has joined #RubyOnRails
[05:46:16] bronson: has joined #RubyOnRails
[05:47:53] tjbiddle: has joined #RubyOnRails
[05:47:54] Trynemjoel: has joined #RubyOnRails
[05:49:42] Devalo: has joined #RubyOnRails
[05:51:56] crankharder: has joined #RubyOnRails
[05:52:26] sp1rs: has joined #RubyOnRails
[05:52:51] statelesscode: has joined #RubyOnRails
[05:53:58] gonglexin: has joined #RubyOnRails
[05:55:15] ereslibre: has joined #RubyOnRails
[05:55:15] ereslibre: has joined #RubyOnRails
[05:58:11] cheeti: has joined #RubyOnRails
[05:58:24] arup_r: has joined #RubyOnRails
[05:59:32] duncannz: has joined #RubyOnRails
[05:59:56] blackmesa: has joined #RubyOnRails
[06:02:50] crankharder: has joined #RubyOnRails
[06:02:50] hinbody: has joined #RubyOnRails
[06:02:50] sevenseacat: has joined #RubyOnRails
[06:02:50] one_zero: has joined #RubyOnRails
[06:02:50] d0nn1e: has joined #RubyOnRails
[06:02:50] sdn90: has joined #RubyOnRails
[06:02:50] nyandoge: has joined #RubyOnRails
[06:02:50] RubyNewbey_____: has joined #RubyOnRails
[06:02:50] pfg: has joined #RubyOnRails
[06:02:50] jxf: has joined #RubyOnRails
[06:02:50] czetter: has joined #RubyOnRails
[06:02:50] mcr-credil: has joined #RubyOnRails
[06:02:50] podman_: has joined #RubyOnRails
[06:02:50] kies: has joined #RubyOnRails
[06:02:50] atrius_: has joined #RubyOnRails
[06:03:14] cheeti: Hi i am trying to parse "http://web.abc.com/%3E%22'%3E%3Cmy_tag_f4d8ba6507b37dbc07b182b323461a17/%3E" into mysql database but its giving syntax error if i decode or encode that string also giving same error how to solve this?
[06:03:58] rvanlieshout: parse as what?
[06:04:05] duderono_: has joined #RubyOnRails
[06:05:05] cheeti: rvanlieshout i am storing "http://web.abc.com/%3E%22'%3E%3Cmy_tag_f4d8ba6507b37dbc07b182b323461a17/%3E" string in mysql column
[06:06:01] baweaver: cheeti: don't cross post
[06:06:18] Trynemjoel: has joined #RubyOnRails
[06:06:58] rvanlieshout: cheeti: and how is that a problem?
[06:08:13] baweaver: cheeti: let's just use this channel then.
[06:08:33] baweaver: What's the code you're using to post it?
[06:09:34] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[06:10:46] baweaver: <cheeti> @con.query("INSERT INTO issue (bugurl) VALUES ('http://web.abc.com/%3E%22'%3E%3Cmy_tag_f4d8ba6507b37dbc07b182b323461a17/%3E')
[06:10:56] baweaver: <cheeti> baweaver is that righr query i defined @con as db connection all simple columns are parsing onle this column is giving error because or special characters
[06:11:00] rvanlieshout: cheeti: don't ever ever ever do that
[06:11:10] Dreamer3_: has joined #RubyOnRails
[06:11:25] cheeti: rvanlieshout Y?
[06:11:30] rvanlieshout: it's giving error cause you're allowing SQL injection
[06:11:32] baweaver: SQL injection
[06:11:33] arup_r: yes that probably due to `'`
[06:11:40] rvanlieshout: why on earth are you wrinting that insert query yourself?
[06:12:24] baweaver: https://www.owasp.org/index.php/SQL_Injection
[06:12:39] rvanlieshout: cheeti: if you're using Rails, use it
[06:12:46] rvanlieshout: in rails you don't write SQL queries yourself
[06:12:48] rvanlieshout: for good reasons
[06:12:50] Dreamer3: has joined #RubyOnRails
[06:12:56] rvanlieshout: SQL injection just being one of them
[06:14:01] cheeti: rvanlieshout but i have to do i want to insert json data into database
[06:14:20] rvanlieshout: cheeti: Issue.create(bugurl: 'foobar')
[06:14:22] cheeti: rvanlieshout this is client requirment
[06:14:30] baweaver: cheeti: Are you using Ruby on Rails?
[06:14:41] rvanlieshout: the client didn't tell you to use an unsafe method, now did he/she?
[06:14:42] cheeti: baweaver s
[06:15:01] cheeti: rvanlieshout i am using api
[06:15:04] baweaver: Is that a yes or no?
[06:15:08] rvanlieshout: cheeti: !debug
[06:15:08] helpa: cheeti: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[06:15:11] rvanlieshout: cheeti: !code
[06:15:11] helpa: cheeti: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[06:15:25] baweaver: and if so, what version?
[06:15:28] cheeti: i am sending data from my site to api thats why i am using that query
[06:16:09] Devalo: has joined #RubyOnRails
[06:17:06] rvanlieshout: cheeti: you know better then this
[06:17:44] cheeti: https://gist.github.com/anonymous/45e454fc6b9d733924a8
[06:18:02] rvanlieshout: that is some massive ugly code (no offense)
[06:18:43] rvanlieshout: cheeti: include activerecord and use http://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html
[06:19:36] cheeti: rvanlieshout Y?
[06:19:44] rvanlieshout: because you don't want to be escaping strings yourself
[06:20:03] cheeti: rvanlieshout i am using rb file to insert json data into DB is that not ok?
[06:20:03] rvanlieshout: the effect of SQL injection is way to big and the risc of it is way to high
[06:20:14] rvanlieshout: don't underestimate the danger of it
[06:21:49] cheeti: rvanlieshout i have to run scan using system() after completing scan it will create json file i have to parse that json file data into DB this is my requirment
[06:21:58] rvanlieshout: i understand that
[06:22:15] rvanlieshout: but that doesn't mean you can use a safe way of inserting it in the d
[06:23:07] cheeti: rvanlieshout so iam added this code in ruby file after after completing scan i will call this rubu file by passing json file name and it will insert data into db
[06:23:29] rvanlieshout: i don't say you have to change a lot
[06:23:35] rvanlieshout: just sanitize your query
[06:23:45] rvanlieshout: using methods either from mysql2 gem or from activerecord
[06:24:10] cheeti: if i add this code in api controller before scan completion this code is calling thats why not working
[06:24:22] rvanlieshout: i don't say you have to place this code in the controller
[06:24:40] kirillzh: has joined #RubyOnRails
[06:24:54] guideX: has joined #RubyOnRails
[06:24:58] rvanlieshout: http://www.rubydoc.info/github/brianmario/mysql2/Mysql2/Client#escape-class_method
[06:25:01] cheeti: rvanlieshout ok i will try
[06:25:16] guideX: after rails installs, I have this key in my clipboard
[06:25:19] guideX: what do I do with it
[06:25:43] guideX: I put it in a text document for now
[06:25:47] rvanlieshout: guideX: what key?
[06:26:10] guideX: it said at the end of install "Your public ssh key (id_rsa.pub) has been automatically generated and copied to your clipboard."
[06:26:23] rvanlieshout: guideX: cat ~/.ssh/id_rsa.pub
[06:27:15] guideX: i'm in windows, there's no C:\.ssh
[06:27:27] arup_r: ah, rails do create that too for us.. awesome. I didn't know
[06:27:41] rvanlieshout: guideX: ah.. you might want to switch to developing in a VM
[06:27:55] rvanlieshout: linux or anything posix
[06:27:57] guideX: oh a linux vm eh?
[06:28:10] rvanlieshout: you're bound to run into several issues when developing on windows
[06:28:18] rvanlieshout: might even have a look at vagrantup.com
[06:28:20] Ikri: has joined #RubyOnRails
[06:28:30] rvanlieshout: it allows you to edit in windows (or any os) and have the rails application booted in a vm
[06:28:34] guideX: hrm, but my target vps is also windows
[06:28:34] rvanlieshout: using your local files
[06:28:41] guideX: so shouldn't use windows for it then or
[06:28:43] rvanlieshout: don't run rails in production on windows
[06:29:07] rvanlieshout: you can have IIS use a reverse proxy to an other host
[06:29:12] rvanlieshout: so your main web server could still be windows
[06:29:21] rvanlieshout: using a rails application running somewhere else
[06:29:33] guideX: so iis won't cut it for rails?
[06:29:43] rvanlieshout: i expect one could get it working
[06:29:57] rvanlieshout: but (almost) nobody uses windows for development in this community
[06:30:01] rvanlieshout: so you're on your own for that one
[06:30:09] rvanlieshout: even for installing gems that require things you don't have on windows
[06:30:35] xardion: has joined #RubyOnRails
[06:30:38] guideX: hrm ok, I suppose I have a fedora vm
[06:30:56] rvanlieshout: and if you prefer, use vagrant to edit using your favorite editor in windows
[06:33:17] gr1m_: has joined #RubyOnRails
[06:35:22] PrideCoding: has joined #RubyOnRails
[06:36:50] guideX: vagrant eh
[06:36:56] guideX: ok let me get that next...
[06:37:12] guideX: I'm basically trying to get a discourse blog going
[06:40:38] EvilEpoch: has joined #RubyOnRails
[06:40:45] norc: has joined #RubyOnRails
[06:41:14] rvanlieshout: we use vagrant here just because i don't want to install dependencies for all proejcts
[06:41:24] norc: Hi. Interrupting rspec while running seems to exit cleanly with a sensible report: https://gist.github.com/anonymous/16c180773a3d0c9968d4
[06:41:31] norc: Is this behaviour to be expected?
[06:41:44] norc: ACTION was expecting some kind of error message with a stack trace 
[06:42:31] Rubie: has joined #RubyOnRails
[06:42:47] arathald: evening, gents and gentettes
[06:42:49] norc: Doh, looking at the message again it just hit me. Nevermind that was a silly question.
[06:43:34] Spami: has joined #RubyOnRails
[06:47:47] jstransky: has joined #RubyOnRails
[06:48:02] rvanlieshout: morning, arathald
[06:48:20] tjbiddle: I want to remove items from a an ActiveRecord::Relation, but want my final object to still be a relation. Can I do this? #reject returns an array
[06:48:22] Coldblackice_: has joined #RubyOnRails
[06:48:34] rvanlieshout: tjbiddle: add conditions
[06:48:39] rvanlieshout: .where.not(id: [1,2,3])
[06:49:28] Spami: has joined #RubyOnRails
[06:50:47] chagel: has joined #RubyOnRails
[06:52:01] tjbiddle: rvanlieshout: That's not my end goal. I have a polymorphic model that accepts 3 types. When gathering information, I want to take ModelA if it exists, ModelB if it doesn't, ModelC at last resort. When I look it up for ModelB, it should look to see if ModelB exists, and fall back on ModelC otherwise
[06:52:21] helpa: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[06:52:35] rvanlieshout: and you want to know that in what context?
[06:52:55] tjbiddle: I'm using fake values because my schema gets a bit confusing due to polymorphic assocations
[06:53:12] solars: has joined #RubyOnRails
[06:53:29] rvanlieshout: context = when gathering what kind of information? what do you want to know?
[06:53:47] jstransky: has joined #RubyOnRails
[06:54:36] mine: has joined #RubyOnRails
[06:54:50] tjbiddle: I have "details" that are set - These details include a price and duration. I may have a price and duration set for a specific "Pet". If none is set, it falls back on it's "Breed", if none is set it falls back on it's "Species" if none is set, it falls back on the default for the end model.
[06:55:06] jjturner: has joined #RubyOnRails
[06:55:07] rvanlieshout: it falls back for what?
[06:55:45] mine: has joined #RubyOnRails
[06:55:47] tjbiddle: When details aren't set at whatever level is currently being looked at. If I have details set specifically for that "Pet". Then it uses those. If none have been set - it goes up the ladder until it finds some. When - Whenever I'm looking for them
[06:55:57] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[06:57:17] tjbiddle: rvanlieshout: https://gist.github.com/thomasbiddle/a5a916e13c521b6873e2
[06:57:33] tjbiddle: That's what I'm doing currently. I just want the end result to be a relation, not an array.
[06:58:00] tjbiddle: Did those messages just send out of order? 😂
[06:58:16] tjbiddle: Or is my IRC client just jacked, ha
[06:58:20] tjbiddle: Resending in case: https://gist.github.com/thomasbiddle/a5a916e13c521b6873e2
[06:58:20] rvanlieshout: Service::Detail.where(id: [own_details, ancestor_details])
[06:58:23] rvanlieshout: could you try that?
[06:58:30] rvanlieshout: i know it works for 1, but not sure for an array
[06:58:38] rvanlieshout: oh wait. that's not going to work
[06:58:52] rvanlieshout: leave out the ancestor_details = services.reject
[06:59:00] rvanlieshout: then use that statement
[06:59:09] rvanlieshout: you can use where(id: relation) to have it use a subquery
[06:59:10] tjbiddle: If I can have some sort of ActiveRecord magic that lets me say "Get these details - and don't return ones if you find one of classes going in this order"
[06:59:42] rvanlieshout: is this postgres?
[06:59:49] rvanlieshout: it supports tree queries
[07:00:26] rvanlieshout: http://truongtx.me/2014/02/28/tree-structure-query-with-postgresql/
[07:01:18] blackmesa: has joined #RubyOnRails
[07:01:29] tjbiddle: Sec - will check if that reject is hurting me
[07:01:33] rvanlieshout: and you want your own details + the details of the last service_ancestor
[07:02:20] tjbiddle: If I don't reject, then I have both the ancestor + the current
[07:02:27] rvanlieshout: and they overlap
[07:02:27] tjbiddle: When if the current exists, I don't want the ancestor
[07:02:39] tjbiddle: Yes - they'll have a service_id that is the same
[07:03:19] rvanlieshout: let me think about that for a min
[07:03:35] duncannz: a lot of people, plus the default behaviour of rails, seem to recommend that you use SQLite in development and a production database e.g. MySQL or PostgreSQL in production. My experience has been that you should use the same db in development and production or a bug will creep in somewhere in the few lines of code you do have to write raw SQL queries in your code. why is it recommended then to use a different db in dev and
[07:03:35] duncannz: production?
[07:03:52] tjbiddle: Ah, think I may have something
[07:04:07] tjbiddle: If I get the child details, then look for details that are *not* in the child details
[07:04:11] rvanlieshout: tjbiddle: you could use a .where(owner: [self, last_service_ancestor])
[07:04:21] rvanlieshout: then order it by CASE when owner_id == self 1 else 0 end
[07:04:32] rvanlieshout: cancel the order
[07:04:32] norc: How can I subclass ActiveRecord::Base to create a new abstract base class without having a matching table?
[07:04:36] rvanlieshout: group by what you need
[07:04:49] rvanlieshout: having case when owner_id .. = max case when ..
[07:04:58] tjbiddle: You lost me
[07:05:09] rvanlieshout: norc: use a poro class and include whatever you need from activerecord
[07:05:11] rvanlieshout: don't extend base
[07:05:18] rvanlieshout: tjbiddle: let me try something in mysql db
[07:06:01] rvanlieshout: case Service::Detail.where(owner: [self, last_service_ancestor].compact) wil include multiple details for one service_id, right?
[07:06:46] norc: rvanlieshout: Oh I did not realize that ActiveRecord::Base was just some wrapper class without any method definitions itself. :)
[07:06:55] norc: rvanlieshout: Thanks, that works for me.
[07:10:05] smathy: duncannz, it's not recommended, just that sqlite3 is a zero-setup DB so is the default for new projects because it's so simple.
[07:11:37] smathy: norc, self.abstract_class = true
[07:13:07] norc: smathy: that seems even more elegant. Beautiful.
[07:13:16] rvanlieshout: tjbiddle: didn't found i nice solution yet
[07:13:21] htmldrum: has joined #RubyOnRails
[07:13:50] marcdel: has joined #RubyOnRails
[07:13:56] rvanlieshout: back to drawing bord
[07:13:58] tjbiddle: rvanlieshout: I think I did! I grab my own_details; then for ancestor_details, I grab them all and where.not what I ahve
[07:14:14] tjbiddle: Tested in rails console - just need to reorganize some things to make it work. Thanks!
[07:14:17] rvanlieshout: i thought you could join them twice, select either first or present
[07:14:31] norc: rvanlieshout: Just out of curiosity, did you not know about abstract_class, or do you have a reason you would prefer a custom PORO class?
[07:14:53] norc: Mind sharing that reason?
[07:14:56] rvanlieshout: becuse if you're not going to use a table you do not want all stuff included
[07:15:55] marcdel_: has joined #RubyOnRails
[07:16:26] norc: Sounds reasonable, though in my case its just for a group of tables that are exposed as views and thus need some special handling, so its less about features I do not want.
[07:16:41] PedramT: has joined #RubyOnRails
[07:16:44] Guest34101: has joined #RubyOnRails
[07:17:03] rvanlieshout: a view can be used as a normal table
[07:17:08] rvanlieshout: so then just include base and make them readonly
[07:17:13] norc: rvanlieshout: Tell that to Oracle.
[07:17:16] norc: Its a writable view.
[07:17:23] rvanlieshout: then it's a normal model?
[07:17:45] norc: Well it still needs special treatment because it cannot deduce things like primary keys, sequences, etc.
[07:18:15] rvanlieshout: so you don't really want to write in it?
[07:18:23] norc: Sure I do.
[07:18:29] norc: Well. I dont - but I have to.
[07:18:47] darutoko: has joined #RubyOnRails
[07:20:34] norc: Also there is that nasty bit that I cannot even use sequences for that particular group of tables, so I have to lock the table in share row exclusive during before_create to set the id based on a select max(id). :-S
[07:21:04] rafaelfranca: has joined #RubyOnRails
[07:21:12] norc: It is far from pretty, but luckily there is no serious concurrency considerations here.
[07:21:16] rvanlieshout: why do you need to write to it?
[07:21:34] jstransky: has joined #RubyOnRails
[07:21:34] PrideCoding: has joined #RubyOnRails
[07:21:34] crankharder: has joined #RubyOnRails
[07:21:34] hinbody: has joined #RubyOnRails
[07:21:34] sevenseacat: has joined #RubyOnRails
[07:21:34] one_zero: has joined #RubyOnRails
[07:21:34] d0nn1e: has joined #RubyOnRails
[07:21:34] sdn90: has joined #RubyOnRails
[07:21:35] nyandoge: has joined #RubyOnRails
[07:21:35] RubyNewbey_____: has joined #RubyOnRails
[07:21:35] pfg: has joined #RubyOnRails
[07:21:35] jxf: has joined #RubyOnRails
[07:21:35] czetter: has joined #RubyOnRails
[07:21:35] mcr-credil: has joined #RubyOnRails
[07:21:35] podman_: has joined #RubyOnRails
[07:21:35] kies: has joined #RubyOnRails
[07:21:35] atrius_: has joined #RubyOnRails
[07:21:35] PrideCoding: has joined #RubyOnRails
[07:21:45] nerium: has joined #RubyOnRails
[07:22:25] scepticulous: has joined #RubyOnRails
[07:22:25] norc: rvanlieshout: We have some proprietary software that does not provide an external API. Since we have the need to do custom things with some of the data, we have no choice but to peek directly into its database.
[07:22:50] rvanlieshout: and that's not a problem
[07:22:58] rvanlieshout: but you could use the view for reading and use several other models for updating
[07:25:35] Pazician: has joined #RubyOnRails
[07:25:54] norc: Maybe I could just use an abstract_class for my updatable views (since they basically behave like tables, they just need some additional hooks and attributes set), and then provide a new base class for the readonly views
[07:26:01] norc: Cherry picking only the parts that I really need.
[07:26:51] Palsson: has joined #RubyOnRails
[07:27:04] norc: Looking at the modules included in AR::Base it looks I want the bulk of it for the former case anyhow.
[07:27:38] bricker: has joined #RubyOnRails
[07:28:20] bronson: has joined #RubyOnRails
[07:29:34] norc: Thank you for your thoughts and suggestions.
[07:29:43] rvanlieshout: you're welcome
[07:34:23] tetraktys: has joined #RubyOnRails
[07:34:37] chagel: has joined #RubyOnRails
[07:35:30] User458764: has joined #RubyOnRails
[07:37:14] armyriad: has joined #RubyOnRails
[07:37:52] tvw: has joined #RubyOnRails
[07:38:21] xhoy: hi there :)
[07:38:32] JohnBat26: has joined #RubyOnRails
[07:39:36] chagel: has joined #RubyOnRails
[07:40:19] vedu_: has left #RubyOnRails: ()
[07:40:50] vedu: has joined #RubyOnRails
[07:41:03] xhoy: i am looking at some 'easy' markup for some "textfield", trix is a bit to "smiple", something with tables, headers, and lists. So i looked at textile, but redcloth seems unmaintained any toughts?
[07:42:05] rvanlieshout: https://www.ruby-toolbox.com/categories/markup_processors
[07:42:22] rvanlieshout: and unmaintained could also mean it just works
[07:42:37] xhoy: well there is cve :0
[07:42:57] rvanlieshout: redcarpet seems most popular
[07:42:59] rvanlieshout: cve for that one?
[07:43:18] xhoy: https://github.com/jgarber/redcloth/pull/21
[07:43:37] rvanlieshout: then that's why redcarpet might be better :)
[07:43:49] xhoy: jet another project that broke dune "rewrite" thing :P
[07:43:59] xhoy: once a project starts rewriting it always breaks :P
[07:46:03] uglybandersnatch: has joined #RubyOnRails
[07:48:44] xhoy: rvanlieshout: i did missed that categorie...
[07:50:05] d0nn1e: has joined #RubyOnRails
[07:52:06] chagel: has joined #RubyOnRails
[07:54:48] jstransky: has joined #RubyOnRails
[07:54:48] PrideCoding: has joined #RubyOnRails
[07:54:48] crankharder: has joined #RubyOnRails
[07:54:48] hinbody: has joined #RubyOnRails
[07:54:48] sevenseacat: has joined #RubyOnRails
[07:54:48] one_zero: has joined #RubyOnRails
[07:54:48] sdn90: has joined #RubyOnRails
[07:54:48] nyandoge: has joined #RubyOnRails
[07:54:48] RubyNewbey_____: has joined #RubyOnRails
[07:54:48] pfg: has joined #RubyOnRails
[07:54:48] jxf: has joined #RubyOnRails
[07:54:48] czetter: has joined #RubyOnRails
[07:54:48] mcr-credil: has joined #RubyOnRails
[07:54:48] podman_: has joined #RubyOnRails
[07:54:48] kies: has joined #RubyOnRails
[07:54:48] atrius_: has joined #RubyOnRails
[07:55:37] jas02: has joined #RubyOnRails
[07:56:04] aganov: has joined #RubyOnRails
[07:56:35] comrad: has joined #RubyOnRails
[07:56:43] merida: has joined #RubyOnRails
[07:57:08] chagel: has joined #RubyOnRails
[08:01:24] krz: has joined #RubyOnRails
[08:02:31] chagel: has joined #RubyOnRails
[08:02:48] blackmesa: has joined #RubyOnRails
[08:05:45] 21WAAEWI4: has joined #RubyOnRails
[08:07:06] chagel: has joined #RubyOnRails
[08:07:33] tjbiddle: rvanlieshout: This seems to do the trick!
[08:07:34] tjbiddle: https://gist.github.com/thomasbiddle/0b81c7b90bd3791964ab
[08:07:42] tjbiddle: Not sure how efficient it is; but it works for now.
[08:08:21] rvanlieshout: tjbiddle: cool
[08:08:27] rvanlieshout: it might be a bit faster if you use select over map
[08:08:47] rvanlieshout: select, cause it'll trigger a subquery
[08:08:58] rvanlieshout: but i don't know if you can use a where(id: [a, b]) then
[08:09:12] rvanlieshout: 2) pluck returns an array. it doesn't create full blown objects where you only need the id
[08:10:45] defsdoor: has joined #RubyOnRails
[08:11:50] agoldboi: has joined #RubyOnRails
[08:11:54] tjbiddle: rvanlieshout: so `own_details = GroomingService::Detail.where(owner: self).pluck(:id, :service_id)` and wherever I'm mapping, call the array index instead?
[08:12:40] rvanlieshout: try: ancestor_details.where.not(service_id: own_details.select(:service_id))
[08:12:46] rvanlieshout: else: ancestor_details.where.not(service_id: own_details.pluck(:service_id))
[08:12:51] rvanlieshout: same for line 12
[08:16:40] pfg: has joined #RubyOnRails
[08:16:46] one_zero: has joined #RubyOnRails
[08:17:11] jxf: has joined #RubyOnRails
[08:17:17] nyandoge: has joined #RubyOnRails
[08:17:54] tjbiddle: 0.090000 0.010000 0.100000 ( 0.122268) (Using map) -------- 0.090000 0.030000 0.120000 ( 0.135444) (Using select) ----- 0.090000 0.010000 0.100000 ( 0.130215) (Pluck)
[08:17:56] tjbiddle: rvanlieshout:
[08:18:00] mytrile: has joined #RubyOnRails
[08:18:21] rvanlieshout: you'll need a bigger sample to test this properly
[08:18:32] mytrile: Hey guys, is there a way to use ActionController::HttpAuthentication::Basic::ControllerMethods in rails metal controller ?
[08:18:33] rvanlieshout: map consumes most memory and is slowest :)
[08:18:38] Spami_: has joined #RubyOnRails
[08:18:52] rvanlieshout: but i'm curious to see that with a larger sample
[08:19:02] mytrile: I want to use authenticate_or_request_with_http_basic inside rails metal controller
[08:19:26] rvanlieshout: mytrile: include it?
[08:19:31] scepticulous: has joined #RubyOnRails
[08:19:51] mytrile: rvanlieshout: there are some things that mess the routing if I include it directly
[08:20:23] pawnbox: has joined #RubyOnRails
[08:20:28] tjbiddle: rvanlieshout: Heh :) I'll take your word on it. I just kind of want to get back to work now that it's solved haha. If I get bored one day I'll ping ya though ;)
[08:20:50] tjbiddle: Thanks for your help!
[08:20:56] rvanlieshout: you're welcome
[08:24:46] chagel: has joined #RubyOnRails
[08:27:01] ayoros: has joined #RubyOnRails
[08:29:20] jenrzzz: has joined #RubyOnRails
[08:29:29] PedramT: has joined #RubyOnRails
[08:29:44] chagel: has joined #RubyOnRails
[08:31:30] PedramT: has joined #RubyOnRails
[08:31:44] alaing: has joined #RubyOnRails
[08:35:04] PedramT: has joined #RubyOnRails
[08:36:09] scepticulous: has joined #RubyOnRails
[08:36:20] PedramT: has joined #RubyOnRails
[08:36:34] PedramT: has joined #RubyOnRails
[08:37:27] jenrzzz: has joined #RubyOnRails
[08:38:28] alaing: Hi, I've found an element and I would like to check if it has a class.
[08:38:29] alaing: visibleElement = find_by_id("#{id}", :visible => false).has_css?("#{className}") ? "should" : "should not"
[08:38:29] alaing: it seems like has_css is waiting a while for the class is there a way to stop it from waiting and to fail quickly?
[08:39:06] mark2: has joined #RubyOnRails
[08:39:33] Radar: find_by_id("#{id}", :visible => false)["class"] not good enough for you?
[08:40:09] FooMunki: has joined #RubyOnRails
[08:40:26] apotry: has joined #RubyOnRails
[08:41:29] htmldrum: has joined #RubyOnRails
[08:42:41] snowy: has joined #RubyOnRails
[08:43:06] alaing: Radar: I'll try that :-)
[08:43:20] adaedra: GOOD MORNING
[08:44:44] errakeshpd: has joined #RubyOnRails
[08:49:22] alaing: Radar: like this visibleElement = find_by_id("#{id}", :visible => false)["js-test-visible"] ? "should" : "should not"
[08:50:21] DoubleMalt: has joined #RubyOnRails
[08:55:24] adac: has joined #RubyOnRails
[08:55:28] chagel: has joined #RubyOnRails
[08:59:05] jenrzzz: has joined #RubyOnRails
[09:00:44] AimlessRAven: has joined #RubyOnRails
[09:00:57] AimlessRAven: hi all, i have %a.card_price{:href=> "", "data-selected" => false, "data-pid" => product.id} = humanized_money_with_symbol product.price_min, no_cents_if_whole: true
[09:01:19] AimlessRAven: w8 i create gist, sorry
[09:01:32] rrrepsaj: has joined #RubyOnRails
[09:01:39] AimlessRAven: https://gist.github.com/anonymous/16c1acbe170dd529403e
[09:01:52] AimlessRAven: how to create first generate link to be active - mark- selected
[09:02:02] nicnilov: has joined #RubyOnRails
[09:04:03] blackmesa: has joined #RubyOnRails
[09:04:36] drptbl: has joined #RubyOnRails
[09:09:45] jsrn: has joined #RubyOnRails
[09:11:58] arup_r: has joined #RubyOnRails
[09:12:13] baweaver: has joined #RubyOnRails
[09:12:46] Ergo: has joined #RubyOnRails
[09:14:54] chagel: has joined #RubyOnRails
[09:15:33] finnnnnnnnnnn: has joined #RubyOnRails
[09:16:22] kirillzh: has joined #RubyOnRails
[09:18:44] quazimodo: has joined #RubyOnRails
[09:19:55] errakeshpd: has left #RubyOnRails: ("Leaving")
[09:19:55] chagel: has joined #RubyOnRails
[09:21:14] AimlessRAven: https://gist.github.com/anonymous/16c1acbe170dd529403e
[09:21:21] AimlessRAven: how to set first link to be selected as default
[09:24:41] roshanavand: has joined #RubyOnRails
[09:25:08] arBmind: has joined #RubyOnRails
[09:26:00] quazimodo: - brand.available_products.order('price_min_cents ASC').each do |product|
[09:26:01] quazimodo: %a.card_price{:href=> "", "data-selected" => false, "data-pid" => product.id}
[09:26:16] quazimodo: https://gist.github.com/anonymous/16c1acbe170dd529403e
[09:26:18] quazimodo: i left a comment
[09:27:19] chridal: Every 15 minutes we delete a lot of items from our database. Right now we're using Model.where(x: y).destroy_all
[09:27:40] chridal: But in the source it seems like this is just implemented as an each looping over all the items and then destroying them one by one
[09:27:59] chridal: We need the after_hooks to be called, so a simple execute("DELETE FROM...") sadly won't suffice
[09:28:25] chridal: My question: how is the "query planner" implemented in Rails; is it actually calling 1000 DELETE queries if I am deleting 1000 messages?
[09:30:42] chridal: It seems apidock had answered that exact question. For other people wondering; it will create *at least* one query per row
[09:32:10] uglybandersnatch: has joined #RubyOnRails
[09:34:16] chagel: has joined #RubyOnRails
[09:35:45] gr1m_: has joined #RubyOnRails
[09:38:24] gr1m-_: has joined #RubyOnRails
[09:40:09] mfaeh: has joined #RubyOnRails
[09:42:48] chagel: has joined #RubyOnRails
[09:44:46] arBmind: has joined #RubyOnRails
[09:45:47] Dbugger: has joined #RubyOnRails
[09:45:50] Dbugger: Hi everyone
[09:47:48] chagel: has joined #RubyOnRails
[09:49:51] Dbugger: Maybe this is easier than I'm imagining it but... Lets say I have models "Wife" and "Husband", with their respective associations. I also have a scope in "Husband" called "war_veteran". How could I build now a scope on "Wife" to get all the wives that have husbands that were war veterans?
[09:50:14] ayoros: has joined #RubyOnRails
[09:52:01] User458764: has joined #RubyOnRails
[09:52:48] chagel: has joined #RubyOnRails
[09:54:09] ql6wlld: has joined #RubyOnRails
[09:54:22] scepticulous: has joined #RubyOnRails
[09:55:31] marr: has joined #RubyOnRails
[09:58:09] chagel: has joined #RubyOnRails
[09:58:50] timmyBsd: has joined #RubyOnRails
[09:59:36] bronson: dbugger: so does wife belong_to husband, or does husband belong_to wife?
[09:59:59] Dbugger: "wife belongs_to husband" (sorry for how that sounds)
[10:00:07] htmldrum: has joined #RubyOnRails
[10:01:07] bronson: might be something like wife.joins(:husband).where(husband: { war_veteran: true})
[10:01:27] sp1rs: has joined #RubyOnRails
[10:01:35] Dbugger: let me try
[10:02:15] Dbugger: you mean something like? scope :war_veteran, -> { joins(:husband).where(husband: { war_veteran: true}) }
[10:03:23] Dbugger: That does not work... remember that "war_veteran" is not a field, but a scope
[10:03:36] Dbugger: in both Wife and Husband
[10:04:26] srinidhi: has joined #RubyOnRails
[10:05:26] blackmesa: has joined #RubyOnRails
[10:06:14] DarkStar: has joined #RubyOnRails
[10:08:39] nicnilov: dbugger: are you sure you want separate models for Wife and Husband? Both are persons and that's just a role
[10:09:21] chridal: Anyone using graph databases with Ruby? In that case; which?
[10:10:04] Dbugger: nicnilov, Im just making an example to explain the problem. The real models I have are much more complex
[10:10:18] chridal: dbugger: Never give contrived examples
[10:10:26] chridal: Although I know that's hard
[10:10:30] chridal: It makes it harder to help
[10:10:46] Dbugger: chridal, I thought this example was rather simple...
[10:11:00] Dbugger: Basically it is all about making scopes, that use the scopes of its associations
[10:11:07] chridal: That's not the issue. In order to give you a solution we'll have to understand the underlying problem in an intuitive way
[10:11:32] Dbugger: Well, that is basically it... I want to make a scope, that uses the scopes of its associations
[10:11:37] Dbugger: That is the underlying problem
[10:12:22] chridal: All I am saying is; there might be another way of solving your problem, but without knowing the actual problem.. see where I am going?
[10:12:55] scepticulous: has joined #RubyOnRails
[10:13:05] tamole: has joined #RubyOnRails
[10:13:08] Dbugger: Yes, and I already have ideas for other solutions. But what Im after here is not the solution to my problem. What I am after is finding out if I can use association's scopes in my scopes
[10:15:33] chagel: has joined #RubyOnRails
[10:18:27] sergey_makagon: has joined #RubyOnRails
[10:18:51] ayoros: has joined #RubyOnRails
[10:20:34] chagel: has joined #RubyOnRails
[10:21:44] blackmesa: has joined #RubyOnRails
[10:23:22] worknick: has joined #RubyOnRails
[10:24:01] matthias_: has joined #RubyOnRails
[10:25:41] fox_mulder_cp: wow. r5 release planned to 16 march?
[10:26:43] scepticulous: has joined #RubyOnRails
[10:26:49] arup_r: has joined #RubyOnRails
[10:26:59] htmldrum: has joined #RubyOnRails
[10:31:04] gbgdev: has joined #RubyOnRails
[10:33:52] deur-: so it would seem
[10:33:52] cheeti: hi i am creating sub domain for every user when signup with my main site we can pass this user detatis to there subdomain that they can login in there subdomain?
[10:33:55] chagel: has joined #RubyOnRails
[10:34:09] deur-: and i'm still trying to migrate a project from 3 to 4
[10:34:51] universa1: cheeti: same database? then i don't see why not.
[10:35:26] scope: has joined #RubyOnRails
[10:35:31] cheeti: universa1 same not every sub domain have there own database.
[10:36:00] universa1: cheeti: can you please try to rephrase that, i don't understand what you're trying to say.
[10:36:02] cheeti: universa1 main site DB will have all the users details
[10:36:05] sergey_makagon: cheeti, i used subdomain-fu plugin couple years ago do solve this subdomain problem
[10:36:18] rvanlieshout: redirect them to that subdomain with some token in the url, then use that token to create a session, cheeti
[10:36:31] cheeti: universa1 ok i will explain
[10:37:35] norc: So Im beginning to wonder something. Is referring to elements by ID in JavaScript/CSS sensible, when the id is autogenerated (say by form helpers)? Somehow Im wondering whether the asset pipeline could help here.
[10:37:57] cheeti: rvanlieshout with that we can store user details in devise table
[10:38:47] rvanlieshout: you can do anything with that
[10:39:37] worknick: how can i set a form attribute value depending upon a radio button selection?
[10:39:42] cheeti: universa1 when user registered in abc.com with name A then i have to create subdomain with A.abc.com with superate DB and i have to pass that user detaile to this DB to be able to login
[10:40:00] rvanlieshout: cheeti: exactly, use the redirect method
[10:40:37] universa1: cheeti: or look for single-sign-on stuff (oauth, etc, might be overkill though)
[10:42:16] worknick: i tried to set name attribute of radio button using <%= pacm.radio_button :user_id, cp.id, :html => {:name=>"commentrad"}%> and do not set it correctly
[10:43:27] rogue_koder: has joined #RubyOnRails
[10:44:49] universa1: worknick: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-radio_button
[10:45:06] universa1: worknick: or actually: http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-radio_button
[10:50:44] nfk|laptop: has joined #RubyOnRails
[10:50:46] worknick: universa1: that does not say how to set custome name. that thing automatically creates itn own name using two attributes
[10:50:55] worknick: model[column] which i dont want.
[10:51:14] workmad3: has joined #RubyOnRails
[10:51:18] worknick: universa1: actually i have to use one radio button set for two different colums. hence its giving issues.
[10:52:39] universa1: worknick: !code
[10:52:39] helpa: worknick: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[10:53:33] chouhoulis: has joined #RubyOnRails
[10:54:55] cabotto: has joined #RubyOnRails
[10:54:59] worknick: universa1: this is my current new comment form. this is half baked because i am in process of setting it correct https://gist.github.com/wrknck/07a7fd67ad8ffa0841cd i have user_id and pet_id columns in my comment model. i want user to either select user_id radio button or (one of the) pet_id radio button
[10:56:44] ruler_: has joined #RubyOnRails
[10:56:50] universa1: worknick: so you have user_id 1 and pet_id 1, how do you differentiate?
[10:57:19] universa1: worknick: and setting the name is just: f.radio_button :foo, :bar, {name: "muhkuh"}
[10:58:00] Fernando-Basso: has joined #RubyOnRails
[10:58:11] jamey-uk: has joined #RubyOnRails
[10:58:51] jamey-uk: I'm trying to override the hostname used to generate URLs in my Rails app but setting "default_url_options" doesn't work after restarting the server. What am I doing wrong?
[10:58:56] worknick: universa1: can i set value of another attruebit inside radio_button so if this particuler radio button is set that attribute wil also set, otherwise not?
[10:59:11] krz: has joined #RubyOnRails
[10:59:14] universa1: worknick: with js you can do many things.
[10:59:59] universa1: worknick: but i'd probably think about another way to develop your form...
[11:00:29] qhp: has joined #RubyOnRails
[11:00:39] universa1: jamey-uk: hmm, not wearing a pink sweater? ;) show code + what is not working, what you'd expect, why you'd expect that...
[11:00:49] worknick: universa1: which one?
[11:01:07] bricker: has joined #RubyOnRails
[11:01:09] universa1: worknick: i don't know, something else.
[11:01:16] jamey-uk: universa1: Sorry, yes this the line I've tried in my development.rb config file:
[11:01:17] jamey-uk: config.action_controller.default_url_options = { host: 'anotherdomain.com', port: 3000 }
[11:02:59] universa1: jamey-uk: ok. which link is not working?
[11:03:07] rodfersou: has joined #RubyOnRails
[11:06:49] jamey-uk1: has joined #RubyOnRails
[11:07:09] trinaldi: has joined #RubyOnRails
[11:09:55] chagel: has joined #RubyOnRails
[11:11:44] AntiSpamMeta: has joined #RubyOnRails
[11:13:26] baweaver: has joined #RubyOnRails
[11:14:40] ebbflowgo: has joined #RubyOnRails
[11:21:28] quazimodo: has joined #RubyOnRails
[11:22:38] nobitanobi: has joined #RubyOnRails
[11:22:44] Quintasan: Anyone using devise_token_auth with LinkedIn?
[11:22:55] nobitanobi: Hello! Where is the code for the task that gets run when you do `rake db:seed` ?
[11:23:24] banister: has joined #RubyOnRails
[11:24:08] fox_mulder_cp: nobitanobi: db/seed.rb
[11:24:23] nobitanobi: fox_mulder_cp: what I mean is, the task that actually calls that file
[11:24:48] nobitanobi: when you do rake db:seed some .task must be calling seed.rb
[11:30:56] krz: has joined #RubyOnRails
[11:31:00] agoldboi: has joined #RubyOnRails
[11:31:26] adlerdias: has joined #RubyOnRails
[11:31:31] dgncn: has joined #RubyOnRails
[11:31:34] nfk|laptop: has joined #RubyOnRails
[11:32:58] Ergo^: has joined #RubyOnRails
[11:35:14] mdw: has joined #RubyOnRails
[11:37:15] finnnnnnnnnnn: anyone able to help with a cucumber/capybara problem?
[11:37:22] finnnnnnnnnnn: when I visit a page that uses a `model_path` helper it throws an error
[11:38:20] finnnnnnnnnnn: ActionController::UrlGenerationError Exception
[11:38:37] finnnnnnnnnnn: I think it's something to do with this
[11:38:38] finnnnnnnnnnn: https://blog.pivotal.io/labs/labs/writing-rails-engine-rspec-controller-tests
[11:38:38] finnnnnnnnnnn: but no idea how to fix in cucumber rather than rspec
[11:38:45] mdw7: has joined #RubyOnRails
[11:40:57] nettoweb: has joined #RubyOnRails
[11:41:31] nicnilov: has joined #RubyOnRails
[11:43:10] Detch: has joined #RubyOnRails
[11:46:15] RegulationD: has joined #RubyOnRails
[11:50:26] qejk: has joined #RubyOnRails
[11:51:06] hashtd: has joined #RubyOnRails
[11:52:28] flashpoint9: has joined #RubyOnRails
[11:52:59] jottr: has joined #RubyOnRails
[11:54:07] chouhoulis: has joined #RubyOnRails
[11:56:04] flashpoint9: has joined #RubyOnRails
[11:56:15] bronson: has joined #RubyOnRails
[12:01:23] jottr: has joined #RubyOnRails
[12:01:46] IrishGringo: has joined #RubyOnRails
[12:02:14] cac: has joined #RubyOnRails
[12:05:42] pawnbox: has joined #RubyOnRails
[12:05:51] ldnunes: has joined #RubyOnRails
[12:08:07] PedramT: has joined #RubyOnRails
[12:11:38] banister: has joined #RubyOnRails
[12:12:47] jsrn: has joined #RubyOnRails
[12:14:13] ayoros: has joined #RubyOnRails
[12:14:43] sonOfRa: has joined #RubyOnRails
[12:14:56] blackmesa: has joined #RubyOnRails
[12:17:42] ebbflowgo: has joined #RubyOnRails
[12:19:00] timmyBsd: has joined #RubyOnRails
[12:19:21] flashpoint9: has joined #RubyOnRails
[12:19:54] sp1rs: has joined #RubyOnRails
[12:21:34] finnnnnnnnnnn: has left #RubyOnRails: ()
[12:28:03] chagel: has joined #RubyOnRails
[12:31:17] j3r0: has joined #RubyOnRails
[12:31:45] johnflux: has joined #RubyOnRails
[12:32:40] ayoros: has joined #RubyOnRails
[12:36:07] AntiSpamMeta: has joined #RubyOnRails
[12:36:48] YourManCJ: has joined #RubyOnRails
[12:40:15] delgiudices: has joined #RubyOnRails
[12:40:43] gr1m_: has joined #RubyOnRails
[12:41:05] sp1rs: has joined #RubyOnRails
[12:42:45] Xentil: has joined #RubyOnRails
[12:49:08] sohel: has joined #RubyOnRails
[12:50:07] mfaeh: has joined #RubyOnRails
[12:50:13] ebbflowgo: has joined #RubyOnRails
[12:54:55] chouhoulis: has joined #RubyOnRails
[12:55:35] moeabdol3: has joined #RubyOnRails
[12:57:24] moxie: has joined #RubyOnRails
[12:58:35] bronson: has joined #RubyOnRails
[12:59:39] dionysus69: has joined #RubyOnRails
[12:59:48] moxie: has left #RubyOnRails: ()
[13:05:44] ebbflowgo: has joined #RubyOnRails
[13:07:49] ebbflowgo: has joined #RubyOnRails
[13:08:03] ziyadb: has joined #RubyOnRails
[13:10:34] arup_r1: has joined #RubyOnRails
[13:10:51] arup_r1: nobitanobi https://github.com/rails/rails/blob/83d2c39d5eb8d82ba124b6725d08c8e90760c764/activerecord/lib/active_record/railties/databases.rake#L193
[13:11:01] bbrowning_away: has joined #RubyOnRails
[13:11:49] arup_r: has joined #RubyOnRails
[13:11:50] uglybandersnatch: has joined #RubyOnRails
[13:13:18] jjturner: has joined #RubyOnRails
[13:14:07] baweaver: has joined #RubyOnRails
[13:14:09] Sigfrid: has joined #RubyOnRails
[13:16:18] roshanavand: has joined #RubyOnRails
[13:18:02] durexlw: has joined #RubyOnRails
[13:18:20] durexlw: afternoon all
[13:19:15] durexlw: I made you coffee but t's cold by now :)
[13:20:07] IrishGringo: has joined #RubyOnRails
[13:21:28] unl0ckd: has joined #RubyOnRails
[13:21:52] brandthdl: has joined #RubyOnRails
[13:23:10] durexlw: I'd want to go from "[[1, "010000"], [1, "0110"], [2, "010000"], [2, "0110"]]" to "{1 => ["010000", "0110"], 2 => ["010000", "0110"]}". Anyone know how I would go about that? So in essence: group on the first element of an array
[13:23:19] flashpoint9: has joined #RubyOnRails
[13:24:53] pawnbox: has joined #RubyOnRails
[13:27:51] drbayer: has joined #RubyOnRails
[13:27:52] EdwardIII: hey is there something built in to get the friendly name for an I18n language choice? like I18n.locale.text ?
[13:29:23] durexlw: EdwardIII: I worked too little with I18n. I don't know if "humanize" does something for you?
[13:30:46] flashpoint9: has joined #RubyOnRails
[13:31:23] EdwardIII: durexlw: hrm interesting idea, i did try googling 'rails humanize name current locale' but no luck
[13:31:32] EdwardIII: i just wanna show a field with the current language in it
[13:31:45] pwnd_nsfw: durexlw, idk if there's a function for that, but your issue is pretty trivial
[13:31:51] durexlw: EdwardIII: yeah, I fugured hat was the insight
[13:32:41] durexlw: pwnd_nsfw: you mean that you are confident that I'm capable of finding it myself?
[13:32:59] Miron: has joined #RubyOnRails
[13:34:22] mfaeh: has joined #RubyOnRails
[13:35:08] pwnd_nsfw: I mean, I am confident that you can find it out how to do that yourself :P
[13:35:12] pwnd_nsfw: however, I can help if you need it
[13:36:14] drbayer_: has joined #RubyOnRails
[13:37:30] durexlw: pwnd_nsfw: I appreciate both the trust and your offer. I'll keep looking for a while. Somehow the whole iterators aren't as clear to me. I always seem to struggle looking through them
[13:37:34] pwnd_nsfw: iterate over the array, storing each second element into a hash, with the key being the first element
[13:37:48] durexlw: pwnd_nsfw: I see. Thanks
[13:38:17] pwnd_nsfw: You may even be able to do it with map, but if you're not understanding iterators too clearly, each will suffice until you get comfy with more complex iterators
[13:38:37] roshanavand: has joined #RubyOnRails
[13:38:39] AlexJakeGreen: has joined #RubyOnRails
[13:38:40] pwnd_nsfw: durexlw, are the arrays a fixed size?
[13:38:44] pwnd_nsfw: like, only ever two elements?
[13:40:07] durexlw: pwnd_nsfw: yeah, it's a pluck from a db
[13:40:18] durexlw: always contains a fixed number of elements
[13:42:08] drbayer: has joined #RubyOnRails
[13:43:19] Ropeney: has joined #RubyOnRails
[13:43:39] drptbl: has joined #RubyOnRails
[13:43:43] pwnd_nsfw: durexlw, it's ugly, but may work https://gist.github.com/SirUncleCid/9f8f3714aa7d9b6c5c00
[13:43:50] pwnd_nsfw: don't have ruby interpreter installed on desktop heh
[13:44:57] pwnd_nsfw: durexlw, how are you getting this info from the db because there may be an even simpler way to do it via the orm
[13:45:41] jottr: has joined #RubyOnRails
[13:46:45] sp1rs: has joined #RubyOnRails
[13:47:39] durexlw: pwnd_nsfw: scope :sickdays_per_month_per_bi, -> { select("month_counter, service, SUM(total_of_sickdays) as sickdays").group(:month_counter, :service).pluck(:month_counter, :service) }
[13:47:40] mary5030: has joined #RubyOnRails
[13:48:46] durexlw: pwnd_nsfw: oeps: scope :sickdays_per_month_per_bi, -> { select("month_counter, service, SUM(total_of_sickdays) as sickdays").group(:month_counter, :service).pluck(:month_counter, :sickdays) }
[13:48:49] durexlw: so in essence: I group based on month and count all sickdays in that month, then I pluck the month and sickdays
[13:53:07] armyriad: has joined #RubyOnRails
[13:53:18] SeanLazer: has joined #RubyOnRails
[13:54:13] adac: has joined #RubyOnRails
[13:54:26] blackmesa: has joined #RubyOnRails
[13:55:36] chouhoulis: has joined #RubyOnRails
[13:55:43] maxdoubt: has joined #RubyOnRails
[13:57:33] CanTonic: has joined #RubyOnRails
[13:58:38] mary5030: has joined #RubyOnRails
[13:58:51] arup_r: has joined #RubyOnRails
[13:59:23] delgiudices: has joined #RubyOnRails
[14:01:53] joshkovach: has joined #RubyOnRails
[14:02:06] qnsi: has joined #RubyOnRails
[14:02:49] PedramT: has joined #RubyOnRails
[14:02:56] qnsi: Hey guys, all help apreciated :) http://stackoverflow.com/questions/35942147/how-to-make-factory-girl-transient-work-with-association
[14:03:55] aegis3121: has joined #RubyOnRails
[14:07:14] pawnbox: has joined #RubyOnRails
[14:08:02] a1fa: with nested routes, do you guys validate parent before processing child?
[14:08:08] User458764: has joined #RubyOnRails
[14:08:29] Uber|Dragon: has joined #RubyOnRails
[14:09:55] IrishGringo: has joined #RubyOnRails
[14:10:10] arup_r: a1fa: yes. but I think with accept_nested_atrributes_for it is automatic.
[14:12:22] joshkovach: has joined #RubyOnRails
[14:12:32] a1fa: arup_r: i was thinking more about controller
[14:13:22] arup_r: we validate data of models, right? So what do you mean by "thinking more about controller" ?
[14:13:40] JoshL: has joined #RubyOnRails
[14:13:40] a1fa: well, books/5/author/100
[14:13:41] snowy: has joined #RubyOnRails
[14:13:41] arup_r: ok, so what you want to validate?
[14:13:45] ramortegui: has joined #RubyOnRails
[14:14:00] a1fa: i dont want books/10/author/100 to show author 100 unless he belongs to book 10
[14:14:30] a1fa: so with nested resources, in order to work on author, do you use books model in author?
[14:14:50] Rubie: has joined #RubyOnRails
[14:15:07] scope: has joined #RubyOnRails
[14:15:15] a1fa: it just seems very easy to abuse nested resources
[14:15:44] a1fa: but also "if"-ing two models sounds inefficient
[14:17:54] a1fa: well technically one, but still sounds a bit silly .. so should i be adding this in my controller if author.book.id == params[:book_id]
[14:18:03] arup_r: qnsi: what code you ran with your new factory that lead to the error?
[14:18:48] adaedra: a1fa just do a scoped search for the child resource
[14:19:02] arup_r: a1fa: ok. so thing, inside the controller action you need to run a find like Book.find(params[:book_id] .. and if id not exist, rails will throw error and you will be in 404 page
[14:19:12] PedramT: has joined #RubyOnRails
[14:19:22] arup_r: so you don't need the check..
[14:19:42] arup_r: so why do you feel unsafe, I am trying to understand
[14:20:23] a1fa: because if no check is done, arbitrary links could be opened with some undesired results
[14:20:23] gremly: has joined #RubyOnRails
[14:20:24] wolfravenous: has joined #RubyOnRails
[14:20:38] arup_r: so any one passing any no existed if from browser, they will see 404 page
[14:20:41] arup_r: what is wrong
[14:21:13] a1fa: maybe i am just overthinking this
[14:21:20] arup_r: hm.. seems so
[14:21:25] a1fa: but it book 6 doesnt belong to author 10
[14:21:50] arup_r: ok.. that you will handle.. by code
[14:21:53] a1fa: and people are able to craft links books/34234324324/authors/10
[14:22:06] a1fa: adaedra: is that a common practice?
[14:22:25] a1fa: i am just looking for best practice in handling nested resources in the controller
[14:23:27] matthias_: has joined #RubyOnRails
[14:24:49] a1fa: adaedra: so would you recommend .find_by_id (params[:authors_id]).where('book_id == ?', params[:books_id])
[14:25:03] qnsi: arup_r: same as the first time - sorry didnt see you mentioning me here
[14:25:24] DmitryBochkarev: has joined #RubyOnRails
[14:25:45] HalcyonicStorm: has joined #RubyOnRails
[14:27:24] adaedra: a1fa something like that, or going through the Book object
[14:29:07] a1fa: cool. thank you
[14:29:53] quazimodo: has joined #RubyOnRails
[14:32:28] djbkd: has joined #RubyOnRails
[14:33:17] CodaBrink: has joined #RubyOnRails
[14:37:13] workmad3: a1fa: you can't chain a `.where` on the end of a `.find_by` method
[14:37:17] bricker: has joined #RubyOnRails
[14:37:41] m15k: has joined #RubyOnRails
[14:38:07] workmad3: a1fa: you could very easily do `Author.where(book_id: params[:books_id], id: params[:authors_id]).first` though
[14:38:20] AntiSpamMeta: has joined #RubyOnRails
[14:39:18] m15k: Hi - "RAILS_ENV=production rake db:migrate" fails to use the productive environment. Any ideas why this happens? (https://gist.github.com/asbachb/3098887defc149e52032)
[14:40:03] sp1rs: has joined #RubyOnRails
[14:40:13] pwnd_nsfw: has joined #RubyOnRails
[14:41:01] arup_r: m15k: fails means error.. can you add that to the gist?
[14:41:31] arup_r: qnsi: need little debugging.. I commented there.. report me back :)
[14:41:37] griffindy: has joined #RubyOnRails
[14:41:46] dionysus69: has joined #RubyOnRails
[14:41:51] m15k: arup_r, I see that rake use the DEV user nor the PROD one.
[14:44:19] brandthdl: has joined #RubyOnRails
[14:45:18] m15k: arup_r It seems that I need to set RACK_ENV...
[14:46:02] dionysus69: has joined #RubyOnRails
[14:46:21] sankaber: has joined #RubyOnRails
[14:48:42] Guest34101: has joined #RubyOnRails
[14:48:50] adavia: has joined #RubyOnRails
[14:49:39] delgiudices: has joined #RubyOnRails
[14:49:50] jamey-uk: has joined #RubyOnRails
[14:51:05] jamey-uk: I've set "config.action_controller.asset_host = '//www.newdomain.com'" which overrides the URLs to assets. I then set "config.action_controller.default_url_options = { host: 'www.newdomain.com' }" so the URL helpers change too, but it doesn't take any effect. Does anyone know the correct way to override the URL helpers host/domain?
[14:51:27] krz: has joined #RubyOnRails
[14:52:05] gbgdev: has joined #RubyOnRails
[14:52:25] Dbugger: Does anyone know how does it called that technique, where you type inside a search field, and the results update themselves automatically everytime you type, without having to press "SEARCH"?
[14:52:26] Travis-42: has joined #RubyOnRails
[14:53:07] delgiudices: submitting on change? dbugger
[14:53:21] jamey-uk: dbugger: autocomplete
[14:54:05] axl_: has joined #RubyOnRails
[14:54:07] Dbugger: I think it had a technical term, something like "lazy search"... but I cant remember..
[14:54:07] Travis-42: Does anyone know what needs to be done in Rails 4.2 to make mailer previews accessible on a staging server? I’ve tried setting show_previews = true, making MailersController think it’s a local_request, but I still get a 404
[14:54:11] maxdoubt: has joined #RubyOnRails
[14:54:43] Dbugger: jamey-uk, it is not autocomplete. It is for instance, I have a list of words, and if I type "leo" all the results that do not contain that substring disappear
[14:55:12] Dbugger: delgiudices, Yeah, that is how it works, but I was wondering how was the name of the technique, in case I can find a plugin that does that for me automatically
[14:55:27] jamey-uk: dbugger: Well that's just autocomplete with fuzzy matching.
[14:55:36] Dbugger: That was the word
[14:55:41] Dbugger: Fuzzy search
[14:55:51] arup_r: has joined #RubyOnRails
[14:55:57] Dbugger: Thanks mate!
[14:56:25] jamey-uk: Can anyone help me with my problem now? I want to know the correct way to override the URL helpers domain name in use. I've tried this but it doesn't work: config.action_controller.default_url_options = { host: 'http://www.newdomain.com/' }
[14:56:48] delgiudices: Oh you learn something new everything
[14:57:19] Fernando-Basso: has joined #RubyOnRails
[14:57:42] bronson: has joined #RubyOnRails
[14:57:48] arBmind: has joined #RubyOnRails
[14:58:40] arup_r: jamey-uk: after changing, I hope restarted the server too?
[14:58:45] mary5030: has joined #RubyOnRails
[14:58:56] jamey-uk: arup_r: Yes restarting my local Rails server each time, nothing.
[14:59:22] KensoDev: has joined #RubyOnRails
[14:59:41] arup_r: jamey-uk: ok, the code you have inside which file ?
[15:00:02] jamey-uk: arup_r: it's at the bottom of the config/environments/development.rb file.
[15:00:18] jamey-uk: inside the main Rails.application.configure do/end block, right at the bottom.
[15:00:19] sankaber: has joined #RubyOnRails
[15:00:52] djbkd: has joined #RubyOnRails
[15:01:31] flashpoint9: has joined #RubyOnRails
[15:01:33] arup_r: jamey-uk: give it a try: https://www.ruby-forum.com/topic/1524042#993512
[15:02:23] jamey-uk: arup_r: thank you, but which file do I put that "Rails.application.routes.default_url_options[:host]" line into?
[15:02:26] RegulationD: has joined #RubyOnRails
[15:03:09] arup_r: config.action_controller.default_url_options[:host] = 'http://www.newdomain.com/'
[15:03:25] jamey-uk: arup_r: that's the exact thing that's *not* currently working...
[15:03:47] arup_r: I know that is exact, but try it once what I said..
[15:04:05] durexlw: Contract.select("SUM(totaal_van_de_ziektedagen) as sickdays").group(:month).order(:sickdays) This throws the following error "SELECT SUM(totaal_van_de_ziektedagen) as sickdays FROM "contracts" GROUP BY "month" ORDER BY "contracts"."sickdays" ASC SQLite3::SQLException: no such column: contracts.sickdays: SELECT SUM(totaal_van_de_ziektedagen) as sickdays FROM "contracts" GROUP BY "month" ORDER BY "contracts"."sickdays" ASC"
[15:04:12] jamey-uk: arup_r: no, I mean the page you linked to specifies a new way of doing it but you're suggesting now the same thing I've already tried!
[15:04:13] workmad3: jamey-uk: it would help if you produced a gist of the code that's producing incorrect results
[15:04:26] durexlw: how do I order on a sum of a group_by?
[15:04:39] workmad3: jamey-uk: and let us know the environment(s) and context(s) of what's producing incorrect paths :)
[15:04:47] jamey-uk: workmad3: sure, it's just that the topic arup_r linked describes the problem *exactly* as I've been experiencing it, step-by-step, here: https://www.ruby-forum.com/topic/1524042#993455
[15:04:47] arup_r: ok.. now tell what action you did, which producing the url you are not expecting..
[15:05:02] workmad3: jamey-uk: that topic is also 5 years old
[15:05:29] workmad3: jamey-uk: which is several major versions out of date... and it still doesn't help with diagnosing your issue without the extra context I just requested :)
[15:05:45] chagel: has joined #RubyOnRails
[15:06:05] arup_r: ok, most recent answer http://stackoverflow.com/a/23090455/2767755 ..
[15:06:36] jamey-uk: workmad3: OK – I'm having the same problem in that following the officials guide here takes no effect: http://edgeguides.rubyonrails.org/action_controller_overview.html#default-url-options. As in, specifying default_url_options as suggested in the manual and restarting my local server doesn't actually change the default_url_options.
[15:06:37] workmad3: arup_r: how about waiting for more context on the exact issue before digging out more random links? :P
[15:06:48] workmad3: jamey-uk: I'm still not seeing *your* code
[15:07:00] jamey-uk: workmad3: sure, one moment
[15:08:00] jayp: has joined #RubyOnRails
[15:08:27] jamey-uk: workmad3: https://gist.github.com/omobono/81c2d49a33b19ae54f57
[15:08:38] jamey-uk: line 7 of that file, as per the docs here: http://edgeguides.rubyonrails.org/action_controller_overview.html#default-url-options
[15:08:40] jamey-uk: it takes no effect
[15:09:31] workmad3: jamey-uk: and where is a url generation that's not getting the value you want?
[15:10:25] arup_r: yes, exactly what I asked.. that willl be good to know
[15:10:27] jamey-uk: https://gist.github.com/omobono/c0a8df2d3516c0af7ebe
[15:10:34] jamey-uk: there you go :) thank you
[15:10:36] B1n4r10: has joined #RubyOnRails
[15:11:07] jamey-uk: so it's the URL helper methods I believe that aren't paying attention to the setting
[15:11:36] workmad3: jamey-uk: you can update gists rather than producing new ones :) and could you quickly add the controller that's been invoked for rendering that view too, please? :)
[15:12:52] jamey-uk: workmad3: thanks, here's the controller and line in that same gist: https://gist.github.com/omobono/c0a8df2d3516c0af7ebe#file-site_controller-rb-L18
[15:14:56] Abhijit: has joined #RubyOnRails
[15:15:24] Abhijit: when i do for_for (blogpost,blogpost.comments.build does that modify blogpost or something?
[15:15:32] Abhijit: just printing the form i mean.
[15:16:12] workmad3: Abhijit: it'll add an unsaved comment to `blogpost.comments`
[15:16:12] dopamean_: has joined #RubyOnRails
[15:16:22] Abhijit: not the comment.
[15:16:30] Abhijit: the blogpost itself. does it somehow get modified.
[15:16:38] workmad3: Abhijit: it shouldn't be
[15:17:23] Abhijit: so what is happending is i am printisg all commentns of that post. "then" i am printing this form. it works. but if i first printed the form and then <% if post.comments.count > 0> print the commens that printing comments gets empty blogpost
[15:17:30] pwnd_nsfw: I would like to put two login forms for two different models on one page. Trying to use devise to accomplish this, but I'm not sure how I would go about separating devise mappings
[15:17:32] jamey-uk: workmad3: Sorry, this is my colleague's project and I'm just trying to override the domain name for the purposes of our CDN. It turns out there were two view files, and the one in use is using "request.original_url" instead of a URL helper.
[15:17:34] Abhijit: what can be the reason?+
[15:18:00] jamey-uk: workmad3: So I guess we shouldn't use original_url since I want to override the domain name in use.
[15:18:40] workmad3: jamey-uk: that would be reasonable :)
[15:18:52] workmad3: jamey-uk: and that would certainly explain the weirdness being observed
[15:19:13] jamey-uk: workmad3: Thanks :) what would be a good way of having a "global variable" that I could store in the environment config file and reuse throughout the views like this?
[15:19:47] workmad3: jamey-uk: you should be able to do `config.application_controller.default_url_options = { host: "whatever" }` in the appropriate file under config/environments
[15:20:08] jamey-uk: workmad3: but that's exactly what hasn't worked and has put me in this situation!
[15:20:16] pwnd_nsfw: Googling is only turning up two models in a single form, but I want each model to have it's own form on the page
[15:20:29] workmad3: jamey-uk: except you just said the view file in question was explicitly overriding with `request.original_url` ;)
[15:20:43] jamey-uk: ah, so what should we be using instead of request_url to get the current page's URL?
[15:20:50] jamey-uk: workmad3: sorry, forgot to put your name
[15:21:08] jamey-uk: workmad3: root_url, or something like that?
[15:21:14] voidsta: has left #RubyOnRails: ()
[15:21:39] workmad3: jamey-uk: if you don't want to override the host, I'd suggest using `_path` instead of `_url` helpers for those links
[15:22:01] workmad3: jamey-uk: _path will produce path-only links without the domain in it, so will take that info from the current page config
[15:22:13] jamey-uk: workmad3: I do want to override the host. So if I overrode the host, what could I use to properly get the current page's URL?
[15:22:49] workmad3: jamey-uk: that's a more difficult question to answer, because of the existence of things like reverse proxies
[15:22:59] jamey-uk: Well I'm technically using a reverse proxy!
[15:23:11] yellow5: has joined #RubyOnRails
[15:23:23] jamey-uk: So that's my issue :) I thought Rails would have the answer and I was just bad at reading documentation.
[15:23:52] workmad3: jamey-uk: if the reverse proxy is set up to forward the expected headers, rails will pick that up automatically when using `_url` helpers :)
[15:24:56] workmad3: jamey-uk: so it's under the assumption that this isn't happening that I'm saying "That's more difficult", because that means some information isn't being forwarded to your app :)
[15:24:58] jamey-uk: workmad3: well the CDN is accessing the site at originalurl.com but we're serving the site at actualurl.com. But we need the Rails app to "understand" that even though it's being accessed via originalurl.com it should generate URLs beginning with actualurl.com.
[15:25:11] PedramT: has joined #RubyOnRails
[15:25:14] jamey-uk: workmad3: But what information would that be? What headers? I do understand HTTP.
[15:25:23] pawnbox: has joined #RubyOnRails
[15:25:45] a1fa: "Yes" ? something == something : "No"
[15:25:48] a1fa: is this legit
[15:26:59] a1fa: i foobared it ;)
[15:27:39] workmad3: jamey-uk: ok, so the host: default value is normally taken from `request.host`, which comes from rack here: http://www.rubydoc.info/gems/rack/Rack/Request#host_with_port-instance_method
[15:27:52] tjohnson: has joined #RubyOnRails
[15:28:10] jamey-uk: workmad3: amazing, I love you
[15:28:16] arup_r: jamey-uk: I may not help you.. but still. can you open rails console and run helper.url_options and tell what you see?
[15:28:17] workmad3: jamey-uk: if you look at the code there, you can see it's normally populated by the HTTP_HOST header if it exists, or X-FORWARDED-FOR, both of which are fairly normal headers for a reverse proxy to be populating
[15:28:33] moeabdol3: has joined #RubyOnRails
[15:29:10] jjturner: has joined #RubyOnRails
[15:29:11] jamey-uk: workmad3: So if I set an HTTP_HOST environment variable in Heroku it'll override the host for the whole application :)
[15:29:11] workmad3: jamey-uk: if those are being set correctly by the CDN, then all your normal `_url` helpers that aren't explicitly overriding `host:` should 'just work'
[15:29:37] jamey-uk: well the thing is the CDN doesn't seem to have an override setting, i.e. "access the site at this domain but with this hostname".
[15:29:47] workmad3: jamey-uk: no, these are values from the request env, not the ENV hash
[15:30:05] jamey-uk: workmad3: oh :(
[15:30:06] sergey_makagon: has joined #RubyOnRails
[15:30:08] baweaver: has joined #RubyOnRails
[15:30:19] workmad3: jamey-uk: the request env is things like the headers and other information added by the app server specific to a request
[15:30:48] jamey-uk: workmad3: so there's no low level way for me to override the hostname then?
[15:31:03] workmad3: jamey-uk: annoyingly too, as you're dealing with heroku, that needs a HOST header to be set for the original app (because otherwise you break their router)
[15:31:18] mag42c: has joined #RubyOnRails
[15:31:56] workmad3: jamey-uk: you can override it with `default_url_options` so that it's a static string (either in ApplicationController or in the appropriate config/environments file) but then you'll need to audit the entire app to make sure all your url generation is happening correctly and not overriding `host:`
[15:32:32] zave: has joined #RubyOnRails
[15:32:38] workmad3: jamey-uk: with the majority of urls, I'd expect them to be using `_path` and for none of this to affect it btw :)
[15:32:41] jamey-uk: workmad3: I think I'm not communicating well, when you see "to make sure all your url generation is happening correctly"… what would you put on this line instead? https://gist.github.com/omobono/c0a8df2d3516c0af7ebe#file-_social_share_inline-html-erb-L3
[15:32:53] korzybski: has joined #RubyOnRails
[15:33:00] jamey-uk: workmad3: So is it better practise to go with "_path" helpers all the time instead? To avoid this issue in the future.
[15:33:19] workmad3: jamey-uk: that line looks correct... but you said the bad URL was being generated by something different?
[15:33:58] workmad3: jamey-uk: use `_path` where possible, yes... but if you need a link to be sent externally (like that specific example), you obviously need a full url
[15:34:10] jamey-uk: workmad3: oh damn it, I'm sorry! I'm really getting myself confused. It looks like if I fix his duplicate view issue and switch to the one using the article_url(…) helpers it'll work fine?
[15:34:18] workmad3: jamey-uk: it should do, yes :)
[15:34:25] jamey-uk: workmad3: that's where I was getting confused, thank you :)
[15:34:32] pawnbox: has joined #RubyOnRails
[15:34:37] jamey-uk: workmad3: I do get your general point about using relative URLs wherever possible though, fully on board with that concept.
[15:34:48] workmad3: jamey-uk: no worries... it's friday afternoon, a time perfect for getting in a muddle :D
[15:35:03] jamey-uk: yeah, and I get to leave early today so I was trying my best to do it (too) quickly :D
[15:35:26] jamey-uk: workmad3: I don't seem to be able to remember to type your name first though haha :)
[15:35:41] workmad3: no worries... it's pretty easy to pick up from context here most of the time too ;)
[15:35:49] havenwood: yeah, let's all bump to Rails 5.0.0.beta3 and deploy to production!
[15:36:17] jamey-uk: http://i.imgur.com/PpzChR2.jpg
[15:36:18] workmad3: havenwood: I'm sensing sarcasm... does that mean I should abort this push?
[15:36:46] workmad3: https://i.ytimg.com/vi/6AnAhdN9nDg/maxresdefault.jpg
[15:37:38] nerium: has joined #RubyOnRails
[15:37:59] jamey-uk: haha, if shia says you should do it, you should it
[15:38:10] jamey-uk: oops I a word
[15:38:53] felltir: has joined #RubyOnRails
[15:40:32] fedexo: has joined #RubyOnRails
[15:41:11] merida: has joined #RubyOnRails
[15:41:13] kies: has joined #RubyOnRails
[15:43:06] gr1m_: has joined #RubyOnRails
[15:43:38] merida: has joined #RubyOnRails
[15:44:03] blackmesa: has joined #RubyOnRails
[15:44:19] merida: has joined #RubyOnRails
[15:44:34] chouhoulis: has joined #RubyOnRails
[15:45:22] m15k: has left #RubyOnRails: ()
[15:45:45] gr1m-_: has joined #RubyOnRails
[15:45:47] KensoDev: has joined #RubyOnRails
[15:46:21] chouhoulis: has joined #RubyOnRails
[15:48:36] jottr_: has joined #RubyOnRails
[15:48:46] Devalo: has joined #RubyOnRails
[15:51:04] Jon30: Does anybody have experience with google_drive gem? I had to switch from key.p12 authentication cause suddenly it stopped working. So I switched to another method: I used client_id and client_secret to generate a refresh token (manually via user interaction). Now I added client_id, client_secret and the refresh token into my app which writes into a spreadsheet several times per day and
[15:51:04] Jon30: before each write it gets a new access token. So my question is, is there going to be a time when the refresh token would expire and I'd need to generate a new one?
[15:51:48] flashpoint9: has joined #RubyOnRails
[15:51:48] maxx88: has joined #RubyOnRails
[15:51:53] PedramT: has joined #RubyOnRails
[15:52:00] smathy: has joined #RubyOnRails
[15:53:13] jamey-uk: Jon30: I don't have experience but have you seen this section in their docs? https://developers.google.com/identity/protocols/OAuth2#expiration
[15:54:15] ql6wlld: has joined #RubyOnRails
[15:54:31] Mia: has joined #RubyOnRails
[15:54:38] smathy: Jon30, https://developers.google.com/drive/v2/web/practices#handling_errors_revoked_or_invalid_tokens suggests yes (too).
[15:54:54] smathy: ACTION has no experience though, that was just a "third time you're asking this question"-motivated google
[15:57:34] jamey-uk: workmad3: So now I've got my head around that problem, there's an og:url value in the <head> which I'm not sure what to replace with. How could I get the current URL without using request.original_url?
[15:57:43] merida: has joined #RubyOnRails
[15:58:57] gr1m_: has joined #RubyOnRails
[15:59:19] dionysus69: has joined #RubyOnRails
[15:59:19] bricker: has joined #RubyOnRails
[16:00:31] msyvich: has joined #RubyOnRails
[16:00:39] msyvich: what does rails db:environment:set actually do?
[16:00:51] msyvich: is it setting something in the database? if so, what exactly?
[16:00:59] msyvich: digging around, haven't identified just what it does yet....
[16:01:38] MrHall: has joined #RubyOnRails
[16:02:12] xploshioon: has joined #RubyOnRails
[16:04:41] augcesar: has joined #RubyOnRails
[16:05:37] shanemcd_: has joined #RubyOnRails
[16:06:33] smathy: msyvich, you beta testing Rails5 here? I'm not seeing that in 4.2
[16:06:51] msyvich: wasn't even mandatory in beta1
[16:06:59] msyvich: we had to upgrade cause of bug in beta1
[16:07:06] msyvich: now i'm being forced to run this command
[16:07:12] msyvich: but we share a database with another app unfortunately
[16:07:30] msyvich: trying to figure out exactly what happens under the hood, but i don't see any changes in my test db
[16:07:31] matthias_: has joined #RubyOnRails
[16:09:16] merida_: has joined #RubyOnRails
[16:09:18] gbgdev: has joined #RubyOnRails
[16:09:38] MrHall: has left #RubyOnRails: ()
[16:10:20] jottr_: has joined #RubyOnRails
[16:11:03] smathy: msyvich, do you know about the -W option for rake?
[16:11:16] smathy: rake -W db:environment:set
[16:11:21] smathy: It'll show you where it's defined.
[16:12:01] AzaToth: has joined #RubyOnRails
[16:12:59] fernandomm: has joined #RubyOnRails
[16:16:34] Pulp: has joined #RubyOnRails
[16:20:40] VeryBewitching: has joined #RubyOnRails
[16:22:06] herpless: has joined #RubyOnRails
[16:25:05] andywww: has joined #RubyOnRails
[16:25:42] diegoviola: has joined #RubyOnRails
[16:26:20] krz: has joined #RubyOnRails
[16:26:55] baweaver: has joined #RubyOnRails
[16:27:50] HalcyonicStorm: has joined #RubyOnRails
[16:28:03] disgrntld: has joined #RubyOnRails
[16:28:13] jottr_: has joined #RubyOnRails
[16:32:08] arup_r: has joined #RubyOnRails
[16:32:23] pwnd_nsfw: http://stackoverflow.com/questions/35944039/rails-devise-two-models-have-their-own-login-form-on-the-same-page
[16:33:21] jottr: has joined #RubyOnRails
[16:33:41] Abhijit: has joined #RubyOnRails
[16:33:45] mikecmpbll: has joined #RubyOnRails
[16:35:06] Abhijit: i want to add a custom method to users controller. if sets route as /users/:id/method I want to avoid that :id
[16:35:09] Abhijit: how can I do that?
[16:35:55] norc_: Abhijit, I recommend you take a look at: http://guides.rubyonrails.org/routing.html
[16:35:56] nettoweb: has joined #RubyOnRails
[16:39:33] Denarii: has joined #RubyOnRails
[16:40:10] PedramT: has joined #RubyOnRails
[16:40:35] CodaBrink: has joined #RubyOnRails
[16:43:36] edwinvdgraaf: has joined #RubyOnRails
[16:43:43] flashpoi_: has joined #RubyOnRails
[16:44:08] dionysus69: has joined #RubyOnRails
[16:45:11] darkxploit: has joined #RubyOnRails
[16:45:34] dgncn: has joined #RubyOnRails
[16:46:18] flashpoint9: has joined #RubyOnRails
[16:46:37] User458764: has joined #RubyOnRails
[16:46:39] DEA7TH: has joined #RubyOnRails
[16:47:42] EdwardIII: i run rake db:test:prepare, then when i try to do `rake test` it says "Migrations are pending", so i run `bin/rake db:migrate RAILS_ENV=test`, run rake test again but then it says "ActiveRecord::StatementInvalid: Could not find table 'stay_requests'"?
[16:48:16] EdwardIII: i don't think i should have a table called stay_requests, i have stay_detail. looks like an old typo or something, but not sure where it's coming from
[16:49:45] flashpoi_: has joined #RubyOnRails
[16:50:45] EdwardIII: the normal app starts up and runs just fine
[16:52:25] codepete: has joined #RubyOnRails
[16:53:09] flashpoint9: has joined #RubyOnRails
[16:53:28] wolfravenous: has joined #RubyOnRails
[16:54:58] B1n4r10: has joined #RubyOnRails
[16:55:24] EdwardIII: hrm i did have an old empty model, StayRequest. i deleted it, added a migration to delete the table, ran test migrations, now it works heh
[16:55:39] Abhijit: i am trying to check username availability and devise comes in between saying login first. how can i make devise not ask this for this particular function?
[16:58:41] andywww: has joined #RubyOnRails
[16:59:00] flashpoint9: has joined #RubyOnRails
[16:59:15] humbledaisy: has joined #RubyOnRails
[16:59:41] bronson: has joined #RubyOnRails
[17:00:19] andywww: i have a quota system in place where a model hands out new associated models but only if the model is not over quota. if it is over quota, it should return a nil, if it is not, it returns a new associated model for population in a form
[17:01:54] norc_: Abhijit, dont authorize the action?
[17:02:01] yxejamir: has joined #RubyOnRails
[17:02:01] yxejamir: has joined #RubyOnRails
[17:02:02] [Butch]: has joined #RubyOnRails
[17:02:14] andywww: would it be better practice to do this check in the controller (if model.is_over_quota @what=nil else @what = What.new) or would it be better to have this in the model entirely and call the model method to return the object?
[17:02:15] norc_: Abhijit, of course you might want to think about the implications of doing that, as it allows a potential attacker to bruteforce to obtain a list of valid usernames.
[17:03:02] norc_: andywww, I would move such things into a seperate service class.
[17:03:08] norc_: Or module rather.
[17:04:23] korzybski: has joined #RubyOnRails
[17:04:45] DonOtreply: has joined #RubyOnRails
[17:05:59] Abhijit: norc_, i already dont have devise before filter for authientication. but as per your suggestion if there is risk of attack, then how does gmail etc does it?
[17:06:15] bronson: has joined #RubyOnRails
[17:06:41] andywww: thanks norc, i’ll look into it
[17:06:52] andywww: just watched a video on that too actually
[17:06:54] norc_: Abhijit, google analyzes patterns all day long. Its what they are good at. ;-)
[17:07:26] smathy: andywww, seems pretty model-specific to me actually. Whether you use a service object or not, it'd all be in the model for me.
[17:07:30] Abhijit: norc_, so not having it at registration form and then having it inside user edit page is good idea?
[17:07:41] adlerdias: has joined #RubyOnRails
[17:07:43] roshanavand: has joined #RubyOnRails
[17:07:52] norc_: Abhijit, though your description is not exact. If you want help, gist your controller and the rails server log from the request.
[17:08:28] arup_r: has joined #RubyOnRails
[17:08:36] Abhijit: norc_, description is just that i want to check if given username is available to take or not. this username is different from email. only email will be used to login not username.
[17:09:41] norc_: Abhijit, you said "I tried X and I get some error". I prefer a "Here is my code xxx, and in the log you can see the request made and the error reasons. Who can explain to me why?"
[17:11:58] achamian: has joined #RubyOnRails
[17:13:54] edwinvdgraaf: has joined #RubyOnRails
[17:14:14] Abhijit: norc_, this is my custom method https://gist.github.com/abhijitnavale/511311604611c139b624 if the slug already exists it should give status 409 which should alert ERROR. but in both case - slug exist and dont exst - both cases give alert no error
[17:15:06] norc_: Abhijit, include your server log and the full controller please.
[17:15:19] twilling: has joined #RubyOnRails
[17:16:10] twilling: Quick survey: If you’re using delgators/decorators in your Rails app, where do you store them? e.g. app/models or app/decorators ?
[17:16:29] drbayer: has joined #RubyOnRails
[17:16:41] andywww: has joined #RubyOnRails
[17:16:44] andywww: has left #RubyOnRails: ()
[17:17:05] norc_: twilling, app/decorators
[17:17:21] bronson: has joined #RubyOnRails
[17:17:24] norc_: twilling, but you can use whatever name you want really. they are all in your autoloading path.
[17:17:43] mrgreenfur: has joined #RubyOnRails
[17:18:52] twilling: norc_: I know I just wanted to see what other people are doing in the real world. Is that a place where you’ve seen people put them before or is that a convention you’ve laid out for yourself?
[17:19:31] norc_: twilling, both.
[17:20:18] digitalcakes: has joined #RubyOnRails
[17:20:22] Abhijit: norc_, updated please check. it seems by default its calling signup . i dont know why.
[17:20:29] shanemcd_: has joined #RubyOnRails
[17:20:32] y2mq37: has joined #RubyOnRails
[17:20:58] DoctorMonocular: has joined #RubyOnRails
[17:21:10] ldnunes: has joined #RubyOnRails
[17:21:10] norc_: Abhijit, include the request for /welcomes/checkusername please
[17:21:14] Maletor: has joined #RubyOnRails
[17:21:28] norc_: Abhijit, and also include your ApplicationController please.
[17:21:31] norc_: That should be enough then.
[17:21:44] uglybandersnatch: has joined #RubyOnRails
[17:21:55] Abhijit: norc_, request for welcome from where?
[17:22:04] PedramT: has joined #RubyOnRails
[17:22:32] norc_: Abhijit, well you are trying to check the username, the request for that is still missing and I would like to see it in the log at least.
[17:22:44] norc_: The ajax request.
[17:23:06] durexlw: laterz all
[17:23:22] Abhijit: norc_, ajax Param has just two lines as follows: url /welcomes/checkusername user abh
[17:23:38] Abhijit: norc_, do you wean headers and response?
[17:23:46] norc_: Abhijit, I want to see the rails server log entry for that request.
[17:24:26] Abhijit: norc_, i am running in devs mode using rails s, and whetever is there on the terminal i gave in gist.
[17:24:37] Abhijit: that Startet GET line
[17:25:11] Abhijit: norc_, the same is in developement.log
[17:25:43] Abhijit: thats what i initially told you that its calling signup and instead of checkusername.
[17:25:58] norc_: Abhijit, oh I see what you mean now. Sorry I misunderstood.
[17:26:07] norc_: Abhijit, I recommend you look at https://api.jquery.com/jquery.get/
[17:26:16] norc_: Especially what arguments it accepts, and what you pass instead.
[17:27:06] htmldrum: has joined #RubyOnRails
[17:29:45] zave: has joined #RubyOnRails
[17:29:52] msyvich: has joined #RubyOnRails
[17:30:39] User458764: has joined #RubyOnRails
[17:32:19] Abhijit: norc_, that works now. how can i check in my js which status code is returned?
[17:33:08] B1n4r10: has joined #RubyOnRails
[17:33:24] mrgreenfur: is there any quick way to generate a link using a named route but have it be https?
[17:33:37] Abhijit: norc_, nvm. got it.
[17:33:43] mrgreenfur: oh wait, config.force_ssl = false
[17:33:51] RegulationD: has joined #RubyOnRails
[17:33:58] flashpoint9: has joined #RubyOnRails
[17:34:00] lawton: has joined #RubyOnRails
[17:34:51] mrgreenfur: nevermind, that dosn’t do it
[17:36:09] B4daBing73: has joined #RubyOnRails
[17:38:50] norc_: Abhijit, write a test for it.
[17:39:04] norc_: Abhijit, and Im dead serious - dont use your server log or browser dev tools - write a test for it instead.
[17:39:42] norc_: If you dont know what that is, this is the perfect day to start with the reason why Ruby is so great. :)
[17:40:08] drbayer: has joined #RubyOnRails
[17:40:23] matthewd: mrgreenfur: foo_url(protocol: 'https'), maybe?
[17:40:43] Abhijit: norc_, :-)
[17:40:54] sneakerhax: has joined #RubyOnRails
[17:43:26] mrgreenfur: @matthewd : that was it! Thanks! Man, I tried a bunch of _path(options) and was into setting dfeault path preferences,e tc, etc.
[17:43:30] sp1rs: has joined #RubyOnRails
[17:44:13] edwinvdgraaf: has joined #RubyOnRails
[17:44:24] scope: has joined #RubyOnRails
[17:45:20] slash_nick: mrgreenfur: _path helpers will specify a path only... <a href="/foo">LINK</a>, e.g... note the relative url (so no place for a protocol)
[17:45:43] baweaver: has joined #RubyOnRails
[17:46:04] mrgreenfur: slash_nick: oh right, that makes a lot of sense
[17:47:52] rogue_koder: has joined #RubyOnRails
[17:48:08] The_Phoenix: has joined #RubyOnRails
[17:48:45] korzybski: has joined #RubyOnRails
[17:48:57] kirillzh: has joined #RubyOnRails
[17:48:59] jenrzzz: has joined #RubyOnRails
[17:49:58] arup_r: matthewd: can't we set the protocol globally? like cofig.ssl = true. Just asking for my understand.
[17:50:28] Pazician: has joined #RubyOnRails
[17:50:30] arup_r: in production.rb etc
[17:50:52] null__: ehh what's wrong with this DATABASE_URL? URI::InvalidURIError: bad URI(is not URI?): postgresql://app_name:Az^abCgbp1OqZ13J%Fm9@localhost/app_name_production
[17:51:02] matthewd: arup_r: default_url_options maybe?
[17:51:21] adaedra: null__ : is % part of your password?
[17:51:23] arup_r: hmm.. that will do
[17:51:27] null__: is that not allowed?
[17:51:29] adaedra: you need to escape it
[17:51:34] matthewd: null__: Need to %-encode invalid URL characters
[17:51:34] adaedra: as it is the escape char
[17:51:46] matthewd: ^ too, I would think
[17:52:24] null__: well that was the actual password so I'll need to generate a new one now, anyway. thanks all
[17:52:37] tycoon177: has joined #RubyOnRails
[17:52:38] smathy: arup_r, yes, http://devdocs.io/rails/rails/application/configuration#attribute-i-force_ssl /cc matthewd
[17:52:47] null__: it hasn't actually been used for anything, yet
[17:53:44] smathy: arup_r, better/simpler/safer to just redirect in your httpd.
[17:54:15] arup_r: smathy: umm.. can you brief me what you meant by `safer` ?
[17:54:32] scope: remember that problem i was having with heroku
[17:54:36] scope: it was there fault hahahah
[17:54:54] intrigueD: has joined #RubyOnRails
[17:55:03] adac: has joined #RubyOnRails
[17:55:28] smathy: arup_r, well for a start it'll SSL static requests as well, but basically because your httpd is actually what's terminating an SSL connection, your Rails app is just being talked to via non-SSL Rack.
[17:55:57] smathy: scope, I don't remember, but cool.
[17:56:18] tycoon177: hi, i am super new to ruby and to rails. i was wondering if someone could help me with an issue in my code. here is my repo https://github.com/BenMcH/pto-calendar
[17:56:32] PedramT: has joined #RubyOnRails
[17:56:57] Abhijit: tycoon177, what is the error? and where?
[17:57:05] tycoon177: the issue that I am having is that in the tutorial i am following (http://www.tutorialspoint.com/ruby-on-rails/rails-views.htm) it talks about list.html.erb and my error is No route matches {:action=>"new", :controller=>"time_off_request"}
[17:57:29] tycoon177: sorry Abhijit i didnt wanna send a giant message and it took me a minute to type up the second one :p
[17:57:45] wolfravenous: has joined #RubyOnRails
[17:58:34] tycoon177: i am not copying the code, i am typing it and making something different so that i can actually learn instead of just copy
[17:59:01] Abhijit: tycoon177, when do you get that error?
[17:59:31] tycoon177: Abhijit: when i go to localhost:3000 in my browser.
[18:00:09] arup_r: thanks smathy
[18:00:12] arup_r: and matthewd
[18:02:49] sleungcy: has joined #RubyOnRails
[18:02:51] jenrzzz_: has joined #RubyOnRails
[18:04:18] tycoon177: Abhijit: i guess what's confusing to me is that i specifically have a route for time_off_requests/new so i am unsure of what is wrong in my code. like i said, i'm really new to ruby and to rails, so i am probably just doing something simple wrong
[18:04:19] smathy: tycoon177, your routes are plural, your controller is singular.
[18:04:41] tycoon177: smathy: so my route should be singular?
[18:04:58] Abhijit: similar to your controller
[18:04:59] smathy: tycoon177, or your controllers plural, they need to match.
[18:05:04] Surt_Q: has joined #RubyOnRails
[18:05:08] smathy: The Rails convention is for plural.
[18:05:13] bronson: has joined #RubyOnRails
[18:05:46] ayoros: has joined #RubyOnRails
[18:05:51] tycoon177: smathy: my controllers are singular. I used rails generate. Is that the wrong way to do it?
[18:06:06] Abhijit: tycoon177, model : User controller users
[18:06:09] tycoon177: it worked to change the route. I had it wrong
[18:07:14] dadleyy: has joined #RubyOnRails
[18:07:27] smathy: tycoon177, your generator will generate whatever you tell it to, neither is strictly right or wrong, just that plural controllers is the Rails convention.
[18:07:57] smathy: It's a smaller job to make the routes singular than the controllers/views/tests plural.
[18:08:54] tycoon177: smathy: alrighty. Thank you for that! I must have just accidentally generated singular controllers. i think i rushed through that part of the tutorial
[18:09:47] stannard_: has joined #RubyOnRails
[18:09:52] silverdust: has joined #RubyOnRails
[18:11:00] smathy: tycoon177, also the tutorial might have been wrong :)
[18:11:57] peterppp: has joined #RubyOnRails
[18:12:07] smathy: (a quick check in the "Controllers" chapter suggests the tutorial advised singular controller names :)
[18:12:46] User458764: has joined #RubyOnRails
[18:13:03] smathy: Heh, AND plural routes :)
[18:13:04] DoctorMonocular: has joined #RubyOnRails
[18:13:16] tycoon177: Ohh alright smathy :P glad it wasn't just me being bad at directions. i'll remember that for the future though!
[18:13:20] smathy: OMG, AND their example in controllers has a singular filename with a plural class name, that's definitely a lie,.
[18:14:08] IFrank00: has joined #RubyOnRails
[18:14:12] tycoon177: this is for work so i've been learning ruby to help with our rails apps. my boss was telling me about the plural vs singular stuff but i thought that was just database stuff
[18:14:22] smathy: Heh, shows BookController in the first two examples, and BooksController in the final example.
[18:14:52] arBmind: has joined #RubyOnRails
[18:14:53] smathy: tycoon177, buy Agile Web Development with Rails or Rails 4 in Action. Neither have these sorts of stupid errors in them.
[18:14:54] nerium: has joined #RubyOnRails
[18:15:45] tycoon177: smathy: which would you suggest to a non beginner programmer (Just new to ruby) and i'll have my boss order it for me
[18:16:48] baweaver: has joined #RubyOnRails
[18:17:00] PedramT: has joined #RubyOnRails
[18:18:21] Prira: has joined #RubyOnRails
[18:18:54] IrishGringo: has joined #RubyOnRails
[18:19:10] aegis3121: has joined #RubyOnRails
[18:19:18] peterppp: is there a way to remove extraneous whitespace from the HTML before it's sent to the browser?
[18:20:03] smathy: tycoon177, I have no personal experience with R4iA, but it was written by someone I trust a lot and he says it's better than AWDwR - so that one.
[18:20:45] gbgdev: has joined #RubyOnRails
[18:20:56] tycoon177: alrighty then :) thank you! i might actually just go to the half priced book store or barnes and noble on my lunch hour in a bit and see if they have the book
[18:20:59] bronson: agreed, I think R4iA is the best Rails book going.
[18:21:03] smathy: peterppp, easiest is to just use gzip compression in your httpd.
[18:21:23] smathy: tycoon177, cool, just make sure it's the latest version.
[18:21:33] tycoon177: will do smathy
[18:21:43] bronson: Now that 5 is just about out, R4iA prices should be takign a dive. :)
[18:21:53] bronson: Even though pretty much everything in it is still current.
[18:21:55] EdwardIII: epic: "You may have encountered a bug in the Ruby interpreter or extension libraries"
[18:21:57] digitalcakes: has joined #RubyOnRails
[18:21:57] smathy: peterppp, there are some gems and stuff, google: rails minify html
[18:22:05] baweaver: smathy: you should ask your friend if they're going to do r5ia
[18:22:09] tycoon177: smathy: do you know if the 2015 version is the latest?
[18:22:26] smathy: baweaver, if he is it won't be for the same publisher :)
[18:22:28] edwinvdgraaf: has joined #RubyOnRails
[18:23:08] smathy: tycoon177, yes, it was only just released, I don't even thing there was an errata fix, really just make sure it's not Rails 3 in Action.
[18:23:18] tycoon177: oh i didnt realize steve klabnik was one of the authors :D familiar names
[18:23:38] smathy: Same author/publisher/cover/colors.
[18:23:40] tycoon177: i've been learning rust as well and he's a big person in that community as well
[18:24:10] smathy: tycoon177, yep, although Ryan Bigg did most of the authoring, he runs this channel.
[18:24:35] tycoon177: steve must really like programming languages that are 4 letters long and start with "r" :P
[18:24:57] arup_r: nice finding.. hehe
[18:24:57] slash_nick: tycoon177: someone should tell him about riot
[18:25:11] tycoon177: lol i'll mention it to him tonight slash_nick
[18:25:29] peterppp: has joined #RubyOnRails
[18:25:36] tycoon177: i'm at work and don't have my standard irc stuff on this laptop or i'd do it now :P
[18:25:51] PedramT: has joined #RubyOnRails
[18:26:13] smathy: arup_r, Radar
[18:26:28] arup_r: yeah, I meant in rust world..
[18:26:44] arup_r: but got it, .. tycoon177 said it
[18:27:10] baweaver: has joined #RubyOnRails
[18:27:15] peterppp: did anyone respond to my question? my connection broke down, so I may have missed it
[18:28:12] arup_r: tycoon177: "i've been learning rust as well and he's a big person in that community as well..." so I was wandering .. who? :)
[18:28:26] tycoon177: arup_r: steve klabnik
[18:28:35] arup_r: but I know now from context
[18:28:48] arup_r: yeah, got it
[18:32:21] MEATCHICKEN: has joined #RubyOnRails
[18:32:45] anjen: has joined #RubyOnRails
[18:32:48] kirillzh: has joined #RubyOnRails
[18:32:56] flashpoint9: has joined #RubyOnRails
[18:33:01] tetraktys: has joined #RubyOnRails
[18:33:14] MEATCHICKEN: I want to use devise confirmable for mobile user confirmation but it links/requires the user to go to the web application
[18:33:17] MEATCHICKEN: How can I work around this?
[18:34:04] kdough: has joined #RubyOnRails
[18:35:42] kirillzh: has joined #RubyOnRails
[18:35:53] cnk: has joined #RubyOnRails
[18:36:40] smathy: Maybe just write some code yourself, devise is really designed to serve a very precise set of use cases.
[18:37:07] srruby: has joined #RubyOnRails
[18:37:24] unreal: has joined #RubyOnRails
[18:37:41] digitalcakes: has joined #RubyOnRails
[18:38:20] drptbl: has joined #RubyOnRails
[18:38:21] srruby: rails3: What is the recommended way to get a non-readonly record ? @foo= Foo.find(id) is my current code
[18:38:32] PedramT: has joined #RubyOnRails
[18:40:30] nerium: has joined #RubyOnRails
[18:41:45] tubbo: srruby: no record should be "read-only".
[18:41:55] peterppp: srruby, just curious: why does it matter whether it's read-only or not?
[18:42:03] B1n4r10: has joined #RubyOnRails
[18:42:12] jfelchner: has joined #RubyOnRails
[18:42:22] jayp: has joined #RubyOnRails
[18:42:38] workmad3: tubbo: I'd assume he means the AR model instance has been marked as 'read-only' because it got loaded in a way that rails can't trust to update correctly?
[18:42:50] workmad3: such as when you have records being loaded through certain joins, etc.
[18:44:12] Wolfram74: has joined #RubyOnRails
[18:44:14] n008f4g_: has joined #RubyOnRails
[18:44:58] arup_r: I saw some where in Rails read_only: true option
[18:45:07] arup_r: but can't recall it
[18:45:40] DonOtreply: has joined #RubyOnRails
[18:46:03] Wolfram74: is there something I need to do to get classes I define in a workers directory visible inside of controllers?
[18:46:53] Wolfram74: or anywhere, it seems?
[18:47:03] arup_r: I think they are by default.. do you mean things you put inside app/workers
[18:47:09] Wolfram74: I can access WelcomeController from the console, but not ChatsWorker
[18:47:15] matthewd: srruby: Foo.find(id) should not return a readonly record; you're going to need to provide more information
[18:47:50] Wolfram74: I get an unitialized constant error
[18:48:44] smathy: srruby, only time Foo.find(id) will be read only is if Foo is backed by a DB view (rather than table).
[18:49:31] srruby: mathewd: I'm taking the record and modifying some of the has_many associated records. I get an error when i do foo.save! Must be the joins. find_by_sql seems to fix it.
[18:50:02] srruby: mathewd: The fix I got from stackoverflow was to use find_by_sql
[18:50:27] arup_r: http://apidock.com/rails/v4.0.2/ActiveRecord/QueryMethods/readonly ..
[18:50:31] scope: has joined #RubyOnRails
[18:50:59] GreatDanton: has joined #RubyOnRails
[18:51:23] arup_r: so User.readonly.find(2) might work. let me try in console
[18:52:07] tubbo: workmad3: i didn't even know that was a thing
[18:52:28] arup_r: srruby: try that.. I tested it throws errors.
[18:53:24] arup_r: Lead.readonly.find(45).update(last_name: 'das1') # booom!
[18:53:38] smathy: arup_r, he wants a NON-readonly record :)
[18:53:57] srruby: arup_r: Yes NON
[18:53:58] djbkd: has joined #RubyOnRails
[18:54:10] tubbo: a read-never record
[18:54:13] tubbo: you can only write it
[18:54:20] smathy: wolfram74, you mean in app/workers ?
[18:54:48] smathy: srruby, !rule0
[18:54:48] helpa: srruby: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.
[18:55:48] Wolfram74: smathy: actually, I have made new progress
[18:56:11] Wolfram74: smathy: I had ChatsWorker defined in chat_worker.rb
[18:56:22] srruby: Thanks everyone! I thought the answer would be simple. I will do some more research later. I appreciate the help.
[18:56:42] Wolfram74: smathy: now I seek to transmit the result back to the user
[18:58:15] ayoros: has joined #RubyOnRails
[18:58:19] mustmodify: has joined #RubyOnRails
[18:58:48] yellow5: has joined #RubyOnRails
[18:59:15] mustmodify: Now that I've been working in Ruby forever I find that I will intentionally avoid rats-nests because there is clean code I could be working with ... has anyone else had this experience? Or am I just whining? Or both?
[18:59:40] smathy: wolfram74, it's not clear whether you still have a problem or not, I'm assuming not.
[18:59:46] arup_r: rats-nests .. new word to me
[18:59:56] kirillzh: has joined #RubyOnRails
[18:59:59] mices: has joined #RubyOnRails
[19:00:12] tubbo: arup_r: rat's nest.
[19:00:13] arup_r: smathy: that's his next action item I guess. :)
[19:00:25] Wolfram74: smathy: I have a new problem that I haven't tackled enough to ask a question, I'll be back in like, 10 or 15 minutes maybe
[19:00:33] mustmodify: yeah rat's nests.
[19:00:35] tubbo: mustmodify: i don't even know wtf you're talking about haha
[19:00:46] arup_r: thanks tubbo :)
[19:00:46] Wolfram74: presuming it is possible to send a json blob to the client from a worker
[19:00:48] mices: if i have wired and wireless network adapters do i have to tell elasticsearch which to listen on in development?
[19:00:49] tubbo: "avoid" rats nests?
[19:00:54] tubbo: mices: no
[19:00:56] gr1m_: has joined #RubyOnRails
[19:01:30] ericx2x__: has joined #RubyOnRails
[19:01:47] mices: tubbo: this is the significant difference between my desktop (where elasticsearch works with my app) and my laptop (where it doesn't)
[19:02:10] mices: my laptop has 2 adapters
[19:02:20] Scriptonaut: has joined #RubyOnRails
[19:02:27] mustmodify: tubbo: I'm a freelancer. I have a new client whose code is ... well ... I understand what they were going for but it seems like the most convoluted way to do this ever. And I find myself avoiding that project and working on other projects that are cleaner.
[19:02:34] Scriptonaut: Does anyone know how I can add the errors of one activerecord object to another?
[19:02:52] bronson: has joined #RubyOnRails
[19:03:10] arup_r: yes... `.add` method
[19:03:44] Scriptonaut: I'm aware of the add method, that's for adding single errors though. I can't just go: model1.errors.add :model2_name, model2.errors
[19:04:02] arup_r: ok.. let me tell me more
[19:04:25] flashpoint9: has joined #RubyOnRails
[19:04:52] dopie: has joined #RubyOnRails
[19:05:36] arup_r: Scriptonaut: then, can you tell more about this requirement?
[19:05:40] arup_r: what is your goal..
[19:05:46] digitalcakes: has joined #RubyOnRails
[19:06:09] Scriptonaut: I have an associated model, I have validates_associated on the parent model. I want to display the child errors on the parent's form
[19:06:45] Scriptonaut: I guess I could do: model2.errors.full_messages.each {|msg| model1.errors.add :base, msg }
[19:07:11] FLeiXiuS: has joined #RubyOnRails
[19:07:11] achamian: has joined #RubyOnRails
[19:07:56] DonOtreply: has joined #RubyOnRails
[19:08:01] tubbo: mustmodify: c'est la vie
[19:08:16] flashpoi_: has joined #RubyOnRails
[19:08:56] tubbo: mices: the URL interface to networking abstracts that from you.
[19:09:23] tubbo: so you don't have to worry about those bits
[19:10:05] tubbo: mices: if you can't connect to ES, maybe it's not running. `ps -ef | grep elasticsearch` will tell you.
[19:10:09] baweaver: has joined #RubyOnRails
[19:11:11] twilling: has joined #RubyOnRails
[19:11:30] ctrlrsf: has joined #RubyOnRails
[19:12:01] flopsec: has joined #RubyOnRails
[19:12:11] tetraktys: has joined #RubyOnRails
[19:14:08] Wolfram74: Ok, it seems like generating the response in a worker is a non-standard usage of workers
[19:16:14] smathy: wolfram74, assuming you mean a response to an http request then yes, not something you'd do in a worker, a worker is for async processing.
[19:17:54] flashpoint9: has joined #RubyOnRails
[19:18:19] B4daBing73: has joined #RubyOnRails
[19:20:49] Wolfram74: smathy: if I have some potentially complicated function that might get invoked by a controller, where should I put that? I gather helpers are supposed to be for views
[19:21:22] smathy: wolfram74, model or service object.
[19:21:56] Wolfram74: service object would go into models maybe?
[19:22:05] manfrin: has joined #RubyOnRails
[19:22:18] Wolfram74: or new folder for services?
[19:22:30] smathy: wolfram74, up to you.
[19:22:59] tetraktys: has joined #RubyOnRails
[19:23:35] ur5us: has joined #RubyOnRails
[19:24:23] arthurix: has joined #RubyOnRails
[19:25:13] mices: has joined #RubyOnRails
[19:27:15] ayoros: has joined #RubyOnRails
[19:27:44] ericx2x__: Hey guys, I want to make a rails blog but not sure what the best approach is. So far, I have made an authentication system and an autorization system where a user can CRUD blog posts.
[19:27:54] ericx2x__: You can check it out here: https://erictheprogrammer.herokuapp.com/
[19:28:03] ericx2x__: But I'm not sure what to do next for my blog
[19:28:27] ericx2x__: There's definitely some things I'm not keeping in mind but I'm not exactly sure what
[19:28:35] ericx2x__: I know I need to do some CSS in the front end
[19:28:40] tubbo: ericx2x__: well i'd start out with actually showing the posts on the front page ;)
[19:28:44] tubbo: i mean on most blogs that's what i see
[19:28:59] ericx2x__: tubbo: yeah I know that I'll get to that eventually
[19:29:00] shinnya: has joined #RubyOnRails
[19:29:05] ericx2x__: but Im talking more high level stuff
[19:29:20] tubbo: ericx2x__: define "high level", what does it mean to you?
[19:29:20] ericx2x__: like any missing functionality or any front end frameworks I should be aware of
[19:29:43] ericx2x__: I'm not sure how to tackle responsive and adaptive aspects of the site, for instance.
[19:29:59] Oog: has joined #RubyOnRails
[19:30:29] tubbo: ericx2x__: yeah, responsive CSS isn't super easy. but CSS libs/frameworks like e.g. zurb foundation or possibly bootstrap will help you along with that.
[19:31:03] ericx2x__: Everyone mentions these frameworks: I honestly dont understand why
[19:31:25] ericx2x__: It's just adding addtional clutter to the project. I also don't see how they help with responsive/adaptive aspects
[19:31:29] baweaver: do you really want to write all of that from scratch?
[19:31:37] tubbo: ericx2x__: lol you're the one who asked :P
[19:31:45] baweaver: ...and hope that you have cross browser compatibility?
[19:31:56] smathy: ericx2x__, you might find it easier if you write a quick rake task to create some fake posts so you can then focus on the display side of things.
[19:32:11] baweaver: hint: you won't unless you're a CSS expert
[19:32:20] tubbo: ericx2x__: there are a few different ways to go. if you don't like all the boilerplate that bootstrap/foundation give you, maybe the bourbon suite would be more your style. http://bourbon.io
[19:32:32] smathy: ericx2x__, don't worry about any of that other crap yet, iterate your way towards that.
[19:33:04] ericx2x__: smathy: yeah, I figure I should worry about the functionality of adding posts etc
[19:33:29] tubbo: scaffold.css isn't a TERRIBLE starting point :)
[19:33:40] ericx2x__: Currently, anyone can make an acc and add, edit posts etc
[19:34:12] digitalcakes: has joined #RubyOnRails
[19:34:20] ericx2x__: I'm not sure what the standard functionality is for personal rails blogs
[19:34:52] ericx2x__: I originially created this to play around with rails for learning purposes and get a working authentication/autorization system going because I was curious about doing that in rails
[19:35:18] ericx2x__: Anyone here make a their personal blog in rails?
[19:35:20] mustmodify: has left #RubyOnRails: ()
[19:35:20] n008f4g_: has joined #RubyOnRails
[19:35:40] tubbo: ericx2x__: i did way back in the day, but replaced it with a static site (jekyll) and eventually an ember.js app
[19:35:52] tubbo: ericx2x__: i basically iterated my way out of rails haha
[19:36:03] Home_: has joined #RubyOnRails
[19:36:05] tubbo: also made the blog to learn more about rails
[19:36:09] ericx2x__: haha, why? rails is too complex for that type of thing?
[19:36:29] baweaver: http://devblog.avdi.org/2012/08/09/why-wordpress/
[19:36:33] baweaver: that explains it well
[19:36:36] tubbo: ericx2x__: yeah, i mean my blog doesn't use a database and it doesn't need login.
[19:36:45] tubbo: deploying the blog means compiling it to HTML and uploading it to S3.
[19:36:57] cnk: has joined #RubyOnRails
[19:37:02] tubbo: i do all my writing with vim in static markdown files
[19:37:09] ericx2x__: How come all the stuff I find online for learning rails uses a blog as an example? lol
[19:37:23] tubbo: ericx2x__: because it's really easy to make and learn about how rails works using the blog as a canvas
[19:37:41] cnk: The original video demoing rails was a blog
[19:37:56] cnk: and it also shows of how well rails handles associations
[19:38:01] htmldrum: has joined #RubyOnRails
[19:38:03] tubbo: other apps people typically use as "examples" are...microblogging social network (e.g. twitter), bug tracker, etc.
[19:38:17] ericx2x__: Yeah, I want to make some personal rails websites so that I can eventually make a portfolio out of the sites displaying what I can do with rails
[19:38:31] ericx2x__: I'm not really sure what to make to impress clients or HR departments
[19:38:42] cnk: I like the to-do list comparison of different JS frameworks
[19:39:06] IrishGringo: has joined #RubyOnRails
[19:39:15] tubbo: ericx2x__: clients aren't impressed with how things work, they're impressed with how things look.
[19:39:43] ericx2x__: tubbo: I don't get how I get started as a rails developer..
[19:39:54] ericx2x__: Sure I can make a fancy front end website and static blog
[19:40:01] ericx2x__: But I won't be able to pass the interview lol
[19:40:22] baweaver: ericx2x__: whereabouts are you?
[19:40:25] Ergo: has joined #RubyOnRails
[19:40:26] tubbo: ericx2x__: anyone interviewing you is going to look at your code. if you have this rails app up on github, that's a huge +1. i got all of my jobs based on my open-source work basically.
[19:40:40] ericx2x__: at least not when technical questions role my way, I guess I just need to study and make stuff. Then I figure why not make a portfolio out of that stuff anyway
[19:41:03] tubbo: my philosophy is to "code in the open" as much as possible
[19:41:08] ericx2x__: baweaver: currently I'm a front end dev making a crap wage and I want to transition into backend rails dev
[19:41:17] baweaver: location wise
[19:41:38] tubbo: ericx2x__: haha why are you asking ME how you should be writing css?? ;)
[19:41:39] baweaver: Boston is one of the larger Rails areas so you should be set there at least
[19:41:43] tubbo: you're most likely better at it than i am!
[19:41:56] baweaver: Ruby meetups
[19:42:00] manfrin: has joined #RubyOnRails
[19:42:00] baweaver: go to every one you can find
[19:42:01] cnk: are you going to the boston.rb mtgs
[19:42:08] cnk: get on their mailing list
[19:42:24] baweaver: first step is to network as much as possible, then try and find out who's hiring.
[19:42:35] ericx2x__: yeah I should go to those meetups but I don't really know rails yet
[19:42:44] ericx2x__: I'm not really sure when I'll "know rails"
[19:42:44] cnk: irrelevant
[19:43:09] tubbo: yeah frankly around here in philly the most experienced folks are the ones who DON'T go to the meetups, it's usually for helping new devs get onboarded.
[19:43:19] cnk: Do some stuff, go to meetup and ask some questions
[19:43:34] cnk: you might consider Thoughtbot's Upcase for some coaching
[19:44:22] ericx2x__: Alright thanks for the tips. I think I have a decent gameplan anyhow
[19:45:03] ericx2x__: I think I'm going to continue making this blog and playing with things. I'll probably add in bootstrap and try to see how that handles repsonsive/adaptive things
[19:45:12] ericx2x__: Does bootstrap use mediaqueiries?
[19:45:18] cnk: ericx2x__: sounds good
[19:45:46] cnk: Since you have some front end skills, perhaps working with one of the CMS projects to help transition
[19:45:54] tycoon177: hey guys, i know that learn python the hard way is recommended a lot. is learn ruby the hard way any good?
[19:45:56] cnk: The RefineryCMS folks seem pretty decent
[19:46:11] cnk: tycoon177: Genearlly, yes
[19:46:20] cnk: What is your background?
[19:46:45] cnk: I liked Chris Pine's book a lot - but not very web centric if that is where you are going
[19:47:08] lemur: has joined #RubyOnRails
[19:47:11] tycoon177: i have quite a bit of programming experience..i'm employed and they're going to trust me to add to vital systems so i think i'm a decent programmer :P
[19:47:17] nettoweb: has joined #RubyOnRails
[19:47:24] cnk: OK then get Eloquent Ruby
[19:47:35] cnk: the hard way series will probably bore you
[19:48:09] tycoon177: i have like nothing to do today since my boss isnt in...is there any resources that I can use to learn rails effectively?
[19:48:15] cnk: I ran a book group and that was my fav
[19:48:28] elcontrastador: has joined #RubyOnRails
[19:48:29] ericx2x__: cnk: are you from boston? what are mtgs?
[19:48:43] ctrlrsf: has joined #RubyOnRails
[19:48:47] cnk: I am not - LA - but I have been on the boston.rb mailing list for years
[19:49:03] tycoon177: i'd need something online to start learning today :/
[19:49:05] tubbo: tycoon177: the best resource is `rails new` ;)
[19:49:35] cnk: Agrreed - along with guides.rubyonrails.org
[19:49:55] flopsec: has joined #RubyOnRails
[19:49:59] tubbo: tycoon177: but also...you could try doing some CodeAcademy stuff to learn more Ruby
[19:50:01] cnk: You can get Eloquent Ruby as an ebook immediagely
[19:50:15] tycoon177: I'll go through them. the guide i was following earlier was terrible...it told me to use singular controllers and such
[19:50:33] tycoon177: i went through all of codeAcademy's ruby stuff I think
[19:50:51] htmldrum: has joined #RubyOnRails
[19:51:23] cnk: spend $30 and get a good book. That's like 20 min at a decent dev's wage
[19:51:41] Pazician: has joined #RubyOnRails
[19:52:29] tycoon177: cnk: i can have them buy me a book, it's just they arent in today..
[19:52:36] Cohedrin: has joined #RubyOnRails
[19:52:38] baweaver: $20/hr is 40k fulltime. That'd be like 180k
[19:53:26] tycoon177: and i'm new to the position and company and i'm more general IT mixed with programming and stuff so it'd be a little less than 2 hours.
[19:53:46] Cohedrin: has joined #RubyOnRails
[19:53:48] cnk: If you program, guides and then playing with 'rails new' + poking at code generated by generate sccaffold should keep you entertained today
[19:54:32] nettoweb: has joined #RubyOnRails
[19:55:00] Cohedrin: has joined #RubyOnRails
[19:55:31] tycoon177: alright cnk. i'm going to make a dumb little project that will track my pto hours. that's not the generic projects and will make it so i cant just copy paste blindly
[19:55:58] cnk: sounds great
[19:57:41] kirillzh: has joined #RubyOnRails
[19:57:54] htmldrum: has joined #RubyOnRails
[19:59:47] PlasmaStar: has joined #RubyOnRails
[19:59:48] emachnic: has joined #RubyOnRails
[20:00:39] ericx2x__: has joined #RubyOnRails
[20:00:54] kirillzh: How to get records with common columns based on single record? Kind of common interests.
[20:02:07] arup_r: kirillzh .select and .pluck is your tool
[20:06:41] tetraktys: has joined #RubyOnRails
[20:07:28] IFrank00: has joined #RubyOnRails
[20:07:58] achamian: has joined #RubyOnRails
[20:08:01] SteenJobs: has joined #RubyOnRails
[20:08:39] monque: has joined #RubyOnRails
[20:10:35] fmcgeough: has joined #RubyOnRails
[20:19:38] pawnbox: has joined #RubyOnRails
[20:21:02] rooose: has joined #RubyOnRails
[20:21:19] adac: has joined #RubyOnRails
[20:22:48] Uranio: has joined #RubyOnRails
[20:24:16] k1t: has joined #RubyOnRails
[20:27:16] Spami: has joined #RubyOnRails
[20:30:54] YourManCJ: has joined #RubyOnRails
[20:31:39] digitalcakes: has joined #RubyOnRails
[20:31:46] YourManCJ: dumb question, when trying to migrate i get "table already exists" what do I have to do? edit the local sqlite3 database?
[20:32:07] smathy: YourManCJ, usually just db:migrate:reset
[20:32:52] YourManCJ: thank you very much, been racking my brain trying to find what the command was to reset the db
[20:34:02] flashpoint9: has joined #RubyOnRails
[20:34:40] jstransky: has joined #RubyOnRails
[20:35:29] RegulationD: has joined #RubyOnRails
[20:37:37] bricker: has joined #RubyOnRails
[20:38:02] mustmodify: has joined #RubyOnRails
[20:38:35] jstew: has joined #RubyOnRails
[20:38:48] mustmodify: I think abstraction is great. And I wish I knew what about this new project is so terrible. Because it's just painful. I have no idea how to even think about fixing it. It's just so painful. And I with I could Martin Fowler it and use big words to name what's wrong.
[20:39:11] mustmodify: because then I would feel like I knew how to avoid doing this to some other dev.
[20:40:11] momomomomo: has joined #RubyOnRails
[20:41:14] bronson: mustmodify: it's impossible... even the best practitioners unintentionally screw over the next guy.
[20:41:22] bronson: they just do it less.
[20:41:24] Papierkorb: mustmodify: The correct abstraction is great. Else things can get messy too. Programming: "Shits complicated, yo"
[20:41:40] djbkd: has joined #RubyOnRails
[20:42:35] bricker: has joined #RubyOnRails
[20:42:43] jottr: has joined #RubyOnRails
[20:42:45] cnk: Perhaps reading POODR would help you id the problem
[20:43:46] bronson: The worst programmers are the ones who read Fowler and friends but don't actually get it.
[20:44:41] bronson: My current project has an 'app/domains' directory that just a giant ball of mud. Previous guy thought the 300-line models were too big and split them into modules and concerns.
[20:45:51] bronson: Except the splits made no sense. Now, instead of reading one big file, I need to scrub over ten files trying to figure out what was included where and why.
[20:46:06] blackmesa: has joined #RubyOnRails
[20:46:13] wolfravenous: has joined #RubyOnRails
[20:46:26] baweaver: has joined #RubyOnRails
[20:46:55] edwinvdgraaf: has joined #RubyOnRails
[20:48:41] jottr_: has joined #RubyOnRails
[20:50:08] xtagon: has joined #RubyOnRails
[20:50:19] mwlang: has joined #RubyOnRails
[20:51:06] wolfravenous: has joined #RubyOnRails
[20:51:22] d0nn1e: has joined #RubyOnRails
[20:51:23] The_Phoenix: has joined #RubyOnRails
[20:51:40] xtagon: Trying to understand strong parameters. Why is `params.require(:attributes).permit(:name, :favorite_color)` and better than `params[:attributes].slice(:name, :favorite_color)`, and why is the latter not allowed even when it appears to be just as secure?
[20:52:11] mwlang: so with devise 3.5 and Rails 4.2, if a user comes to site and signs up, everything works. But when a system admin is adding a new user to the system (with intent to send invite/confirm email to new user), I get “password cannot be blank” What’s the trick to letting a system admin add a new user w/o keying a password (which is going to be reset immediately by the user anyway).
[20:52:18] mices: has joined #RubyOnRails
[20:52:28] mices: tubbo: solved
[20:52:48] xtagon: mwlang: See if devise_invitable fits your purposes
[20:52:56] arup_r: mwlang: ^^
[20:53:01] arup_r: that's what I used
[20:53:02] mwlang: xtagon: thanks
[20:53:04] baweaver: xtagon: because security....
[20:53:13] baweaver: ACTION still hates that
[20:53:17] yxejamir: has joined #RubyOnRails
[20:53:42] baweaver: you have to use to_unsafe_h to get the params to look like an actual hash.
[20:54:22] xtagon: But why, what's the point? If I'm slicing only the attributes I know I want to allow, I don't see why strong parameters is even necessary
[20:54:24] baweaver: I got annoyed and just monkeypatched an unsafe_slice method
[20:54:24] cnk: mwlang: Add something that creates a random password?
[20:54:42] arthropododo: has joined #RubyOnRails
[20:54:51] baweaver: xtagon: I have no idea, I just know they're bent on it and won't listen to any form of reason.
[20:54:59] baweaver: something about saving users from themselves.
[20:55:12] kirillzh: has joined #RubyOnRails
[20:55:18] momomomomo: https://blog.8thlight.com/will-warner/2014/04/05/strong-parameters-in-rails.html
[20:55:19] baweaver: same thing with the to_h method on params
[20:55:37] mrgreenfur: has joined #RubyOnRails
[20:55:44] baweaver: momomomomo: that's not the point
[20:55:54] baweaver: slice is the same type of whitelisting
[20:55:56] tubbo: bronson: yeah i'm on that tip too
[20:55:57] baweaver: but they modified it
[20:56:05] momomomomo: "...I don't see why strong parameters is even necessary"
[20:56:10] tubbo: bronson: we're working on making everything more sensible abstractions.
[20:56:29] bronson: it's a neverending job
[20:57:07] bronson: Even the best abstractions in 2011 might not make sense in 2016.
[20:57:07] xtagon: momomomomo: Thanks for the article. I didn't realize that it went as far as to raise a specific exception if non-whitelisted params are used. Also I meant that I don't see why it's even necessary *provided I already do whitelisting*
[20:57:16] xtagon: Makes sense now though, thanks everyone
[20:57:39] DoctorMonocular: has joined #RubyOnRails
[20:58:31] Scriptonaut: has left #RubyOnRails: ()
[20:58:37] tycoon177: when i'm setting up a project and making things, would "rails generate scaffold" be best to use?
[20:58:54] tetraktys: has joined #RubyOnRails
[20:59:17] cnk: when starting out / learning, yes
[20:59:33] cnk: it will give you a lot of stock functionality and some code to look at
[20:59:38] matthewd: baweaver: Got a link to said unlistened reason? :/
[20:59:55] cnk: eventually you will probably not use scaffold, but for practice, go for it
[21:00:06] tycoon177: why would you not use it when you're experienced cnk? it seems as though it would speed up the development process
[21:00:41] cnk: It does - but then you end up wanting something more than just CRUD - at which point the generated code is kind of in your way
[21:01:21] cnk: but I use scaffold to build my models + admin interfaces and then usually put a public front end on using different controller + viees
[21:01:26] emachnic: has joined #RubyOnRails
[21:01:53] cnk: play with it and see. When you outgrow it, you will know enough ot do something else
[21:02:18] mwlang: tycoon177: scaffolding is a “prop” it gets you going and new users learn from the code that’s generated. However, as the app evolves, what you want your app to do evolves, too and scaffolded code doesn’t necessarily do what you want it to do.
[21:02:41] tycoon177: thanks guys :)
[21:03:10] mwlang: tycoon177: when you find yourself throwing away more scaffolded code or spending more time tweaking it than just writing from scratch…you’ll find you won’t be generating the scaffolded code.
[21:05:15] railsForDaiz: has joined #RubyOnRails
[21:06:59] bronson: I don't use scaffold much anymore because I like to work in smaller bites.
[21:07:12] bronson: create model, write migration and tests, go green, commit
[21:07:20] bronson: create controller, write tests, etc..
[21:07:38] djbkd: has joined #RubyOnRails
[21:08:24] bronson: but when experimenting it can be a nice time saver. `rails g scaffold`, try it out, hate it, `rails destroy`
[21:08:36] achamian: has joined #RubyOnRails
[21:08:58] DEA7TH: has joined #RubyOnRails
[21:09:55] pawnbox: has joined #RubyOnRails
[21:10:27] pwnd_nsfw: I noticed if I use scaffolding, I'm basically writing as much code as I'm deleting
[21:10:32] pwnd_nsfw: So, works out for me to just do it fresh
[21:11:03] baweaver: Oh hey, my conf talk is posted finally - https://www.youtube.com/watch?v=R4lr-2562FQ
[21:12:12] pwnd_nsfw: baweaver, you're such a B.a.D.A.S.S developer
[21:12:23] pwnd_nsfw: who came up with the name and did they have the acronym in mind?
[21:12:32] baweaver: Yes, and not sure who
[21:12:39] baweaver: I came in to interview and they told me
[21:12:52] baweaver: I laughed and said, "No, really, is that the name?"
[21:12:59] baweaver: and they just stared at me for a bit
[21:13:41] baweaver: It's mainly geared in Javascript, because that's the conference
[21:14:55] smathy: Some unfortunate blurring on the terminal sections.
[21:15:15] tubbo: baweaver: lol the gaming industry
[21:15:25] baweaver: See the comment that I put on there to the git repo
[21:15:27] njero: has joined #RubyOnRails
[21:15:28] nettoweb: has joined #RubyOnRails
[21:15:36] baweaver: It contains pretty much all of what I mentioned and the slides
[21:15:46] smathy: Good topic.
[21:16:55] maxx88: baweaver: nice presentation, although feel like i’m on LSD with the screen always adjusting
[21:16:58] ctrlrsf: has joined #RubyOnRails
[21:17:15] pwnd_nsfw: what kind of lsd have you had...
[21:17:35] maxx88: the kind that zooms in and out tooooo fast
[21:18:08] baweaver: yeah, not much I could do for that.
[21:18:16] tubbo: "this acid sucks it just made shit zoom in sometimes also i felt like i was watching a tech talk"
[21:18:24] tycoon177: rails is REALLY cool!
[21:18:31] pwnd_nsfw: tycoon177, chyeah
[21:18:51] digitalcakes: has joined #RubyOnRails
[21:21:14] mwlang: thanks, guys…devise_invitable did the trick and works like a charm.
[21:22:32] FernandoBasso: has joined #RubyOnRails
[21:24:13] tycoon177: in rails, how do I reference a piece of information from another model? The model that I am in belongs to the one I am wanting to reference
[21:24:56] baweaver: child.parent.attribute
[21:25:41] Ergo: has joined #RubyOnRails
[21:25:54] tycoon177: baweaver: what do you mean>?
[21:26:18] baweaver: current_model.parent_model.attribute_you_want
[21:26:37] baweaver: or if you're "in" it, just parent_model.attribute
[21:27:02] tycoon177: I'm in the view actually
[21:27:28] tycoon177: I got it! I did what you suggested and it worked :)
[21:27:50] baweaver: is it in a loop?
[21:27:55] baweaver: or just a single item?
[21:28:36] tycoon177: I've done both now
[21:28:48] baweaver: If you do a loop, look up what an N+1 query is in rails
[21:29:01] baweaver: every time you call parent, it makes an sql query
[21:29:13] baweaver: so if you're doing a loop, that's a lot of extra
[21:29:36] baweaver: why not preload if that's the case? Model.includes(:parent)
[21:30:38] y2mq37: has joined #RubyOnRails
[21:30:59] intrigueD: has joined #RubyOnRails
[21:33:42] zave: has joined #RubyOnRails
[21:33:42] flopsec: has joined #RubyOnRails
[21:34:13] mdel: has joined #RubyOnRails
[21:35:13] tycoon177: where would I put the model.includes(:parent)?
[21:35:35] pwnd_nsfw: wherever you're querying for data from the model
[21:35:54] pwnd_nsfw: and require the parent data as well heh
[21:37:04] baweaver: normally in your controller
[21:37:10] pwnd_nsfw: Definitely not in your view. Controller would be better, but even then, I may set up a scope in the model maybe
[21:41:37] kies: has joined #RubyOnRails
[21:48:21] rakm: has joined #RubyOnRails
[21:48:51] lemur: has joined #RubyOnRails
[21:50:06] new_bruins: has joined #RubyOnRails
[21:51:01] pawnbox: has joined #RubyOnRails
[21:52:03] flashpoint9: has joined #RubyOnRails
[21:52:30] pwnd_nsfw: https://gist.github.com/SirUncleCid/13a16f3f8f3ed43cd519
[21:52:35] pwnd_nsfw: How dirty would you say that stub is?
[21:53:15] pwnd_nsfw: It totally works, but... yano
[21:53:29] blackmesa: has joined #RubyOnRails
[21:53:30] Uranio: has joined #RubyOnRails
[21:53:41] configged: has joined #RubyOnRails
[21:53:48] new_bruins: How would I create a comment with an association to a user and a post. The form is on the Post's 'show' page
[21:54:25] pwnd_nsfw: new_bruins, is something to the tune of "current_user" available in your controller?
[21:55:13] pwnd_nsfw: I'd do something like... post to /post/:id/comment, and in the controller, I'd just set the user manually
[21:55:19] tycoon177: how would I change data in a parent model when a child is added?
[21:55:23] flashpoint9: has joined #RubyOnRails
[21:55:34] pwnd_nsfw: tycoon177, what are you changing?
[21:55:37] digitalcakes: has joined #RubyOnRails
[21:55:46] new_bruins: hmm I'll try that
[21:55:52] pwnd_nsfw: tycoon177, could probably do before_save
[21:56:13] mustmodify: bronson: sorry, just getting back to read your thoughts. Yeah, if you use modules to split up a 300 line model, you aren't fixing the right problem. You're just spreading it around.
[21:56:55] quazimodo: Every time i do class Dummy; end in specs I feel wrong. It's not automatically name spaced and so the different Dummy definitions bleed into one another. double() or Class.new are nicer but in this instance the code that's being tested does thing.class.name. An instance of Class.new returns nil, a double returns RSpec::Mocks::Double
[21:57:11] tycoon177: pwnd_nsfw: i'm just trying to learn rails, so i'm making a web app that tracks employee's pto...i currently have 2 models. They are for the employees and the time off. when a time off instance is recorded for an employee, I need to be able to update the number of hours of pto the employee has left
[21:57:14] quazimodo: Can't think of a nice way to define an isolated named class
[21:58:06] stannard: has joined #RubyOnRails
[21:58:20] pwnd_nsfw: The time off object has access to the employee model
[21:58:44] pwnd_nsfw: Like, you can call functions on the employee model from the time off model
[21:58:55] tycoon177: pwnd_nsfw: the time off one belongs to the employee model
[21:59:01] pwnd_nsfw: Yes, exactly
[21:59:25] pwnd_nsfw: you can call employee.pto or whatever from your time off model
[21:59:59] tycoon177: so I just do like employee.hours -= hours_used?
[22:00:33] new_bruins: pwnd_nsfw, no dice. It doesn't save the attributes of the comment
[22:01:04] pwnd_nsfw: new_bruins, code?
[22:01:10] mrgreenfur: has joined #RubyOnRails
[22:01:16] pwnd_nsfw: tycoon177, and then save it.
[22:01:22] new_bruins: @comment = current_user.comments.build
[22:01:27] xtagon: pwnd_nsfw: I don't see anything wrong with your stub unless you are testing something that involves the geolocation, in which case you should probably set it to something other than a fresh new instance of GeoObject
[22:01:37] new_bruins: @comments.user_id = current_user.id
[22:01:52] new_bruins: thats in the PostsController show method
[22:01:59] pwnd_nsfw: new_bruins, @comment = post.comments.build; @comment.user = current_user; @comment.save
[22:02:11] pwnd_nsfw: comments.build(comment_params) anyways
[22:02:30] pwnd_nsfw: xtagon, thanks!
[22:02:50] new_bruins: can I save it? there's nothing in it yet? I'm just rendering the view for the individual post?
[22:03:17] kirillzh: has joined #RubyOnRails
[22:03:43] gr1m_: has joined #RubyOnRails
[22:04:24] pwnd_nsfw: So, wait, what did you mean it doesn't save the attributes of the comment new_bruins ?
[22:04:27] mdw: has joined #RubyOnRails
[22:04:43] kirillzh: How to find records which attributes intersect with specific record (for example current_user)
[22:05:03] railsForDaiz: has joined #RubyOnRails
[22:05:08] new_bruins: when I submit the form to add a new comment to the post. The post_id and user_id of the comment are not updated
[22:05:29] pwnd_nsfw: Are you posting to the comment's controller?
[22:05:29] kirillzh: Say current_user has products attribute, an array of products, I need other users which have common products as current_user.
[22:06:45] new_bruins: Comments controller looks like this: def create ... @comment = Comment.new(comment_params) .... if @comment.save
[22:07:03] y2mq37: has joined #RubyOnRails
[22:07:11] mustmodify: has left #RubyOnRails: ()
[22:07:16] new_bruins: flash[:notice] = "comment created" .... else redirect_to root ... end
[22:07:21] manfrin_: has joined #RubyOnRails
[22:07:31] flopsec: has joined #RubyOnRails
[22:07:37] new_bruins: If there is a better way for me to type out code into here. Please let me know
[22:08:16] pwnd_nsfw: comment = @post.comments.build(comment_params); comment.user = current_user; if comment.save; redirect_to @post
[22:08:18] new_bruins: def comment_params ... params.require(:comment).permit(:content, :user_id, :post_id) ... end
[22:08:19] pwnd_nsfw: something like that
[22:08:22] jfelchner_: has joined #RubyOnRails
[22:08:22] pwnd_nsfw: new_bruins, gist
[22:08:56] new_bruins: your talking about in the create section of the CommentsController right?
[22:09:03] kirillzh: For example this table https://learneroo-images.s3.amazonaws.com/main/many-to-many-likes.png
[22:09:23] new_bruins: gracias, lemme give it a go
[22:09:39] pwnd_nsfw: kirillzh, maybe like
[22:10:10] pwnd_nsfw: Hmph.. I don't write much sql lol, one sec
[22:10:29] Radar: GOOD MORNING
[22:10:58] kirillzh: Here is desired result for this example: https://gist.github.com/anonymous/f66488700a392411be3f
[22:11:01] pwnd_nsfw: It's almost dinner time Radar
[22:11:11] kirillzh: Considering current_user is "Jim" with id 1
[22:11:29] adaedra: It's UGT, pwnd_nsfw.
[22:11:38] pwnd_nsfw: DONT UGT ME
[22:12:28] adaedra: GOOD  MORNING
[22:13:04] xtagon: Does anyone have a favorite blog post, conference talk, tutorial, etc. that will help me implement financial transactions in a Rails app? Trying to look for the "right way" of doing things. I don't care about actual merchant services, it's just an internal credits system. But I want to go beyond just storing a single balance that gets updated
[22:14:20] new_bruins: @pwnd_nswf @post isn't passed to the CommentsController
[22:14:25] xtagon: It doesn't have to be Rails specific either, looking for database design, patterns, etc.
[22:15:38] pwnd_nsfw: new_bruins, your form_for should include post, so like form_for [@post, @comment]
[22:15:49] pwnd_nsfw: make sure routes are setup correctly... comments nested under post
[22:16:16] new_bruins: Do you have any resources on that for further reading?
[22:16:32] pwnd_nsfw: Rails 4 in Action
[22:16:33] new_bruins: Or what I can search for?
[22:16:41] kirillzh: So far that's what I got, except for additional virtual attribute "products" (or it could be "common_products"): User.where.not(id: @user.id).select {|x| (x.products & @user.products).present?}
[22:16:49] pwnd_nsfw: (Radar, senpai notice me)
[22:17:04] nozpheratu: has joined #RubyOnRails
[22:17:48] pwnd_nsfw: new_bruins, http://stackoverflow.com/questions/10036972/comments-that-belong-to-post-and-belong-to-user
[22:17:50] pwnd_nsfw: this is free
[22:18:09] new_bruins: ya, was about to say
[22:18:22] Radar: pwnd_nsfw: hi
[22:18:33] new_bruins: I've been looking at that post already and couldn't make heads or tails but I'll have another go at it
[22:20:22] sebstrax: has joined #RubyOnRails
[22:20:59] new_bruins: so riddle me this, what is wrong with @post = Post.find(params[:post_id]) ? In my create section of the CommentsController
[22:21:23] pwnd_nsfw: I don't know, need more code
[22:21:30] pwnd_nsfw: http://gist.github.com
[22:22:24] nettoweb: has joined #RubyOnRails
[22:24:03] new_bruins: https://gist.github.com/anonymous/3d9f51d75f8771a74dfa
[22:24:24] ur5us: has joined #RubyOnRails
[22:24:32] SteenJobs: has joined #RubyOnRails
[22:24:47] edwinvdgraaf: has joined #RubyOnRails
[22:25:05] pwnd_nsfw: new_bruins, <%= simple_form_for([@post, @comment]) do |f| %>
[22:28:15] tycoon177: pwnd_nsfw: you mentioned saving the record after changing the hours left. would I just do employee.save? or would the method be update?
[22:29:19] new_bruins: pwnd_nsfw, "undefined method `post_comments_path' for #<#<Class:0x00000003903988>:0x007f53d3262540> Did you mean? posts_path"
[22:29:36] new_bruins: routes problem?
[22:30:01] jottr_: has joined #RubyOnRails
[22:30:29] edwinvdgraaf: has joined #RubyOnRails
[22:30:37] tycoon177: I got it! nevermind :P
[22:32:46] new_bruins: ha! I THINK IT WORKDDD
[22:33:09] Radar: new_bruins: !gist-usage
[22:33:09] helpa: new_bruins: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[22:33:57] achamian: has joined #RubyOnRails
[22:34:18] flopsec: has joined #RubyOnRails
[22:34:32] new_bruins: ah, I will read that b4 gisting again sensei. muchos gracias
[22:35:43] Radar: domo arigato*
[22:36:00] pwnd_nsfw: new_bruins, what does your routes for comments/posts look like
[22:36:04] baweaver: has joined #RubyOnRails
[22:37:15] new_bruins: resources do \n space space resources :comments
[22:37:18] RegulationD: has joined #RubyOnRails
[22:37:45] new_bruins: oh geeze. let me try that again
[22:38:08] new_bruins: resources :posts do \n resources :comments \n end
[22:38:30] ctrlrsf: has joined #RubyOnRails
[22:39:25] pwnd_nsfw: use gist omg lol
[22:39:37] pwnd_nsfw: new_bruins, you need to nest comments under post
[22:39:48] SteenJobs: it looks like it is
[22:40:00] SteenJobs: new_bruins: gist your routes, as well as the problematic code in the view
[22:40:14] pwnd_nsfw: you can even edit your previos gist
[22:40:45] new_bruins: oh, well, it's working now. But I can if you are interested?
[22:41:06] SteenJobs: well code doesn’t magically fix itself…
[22:41:48] new_bruins: I said "ha! I THINK IT WORKDDD"
[22:41:56] tetraktys: has joined #RubyOnRails
[22:42:07] new_bruins: after nesting the resources
[22:43:11] new_bruins: but yes, thank you very much pwnd_nsfw, I had been struggling with that for quite some time.
[22:43:30] bronson: has joined #RubyOnRails
[22:44:16] tycoon177: Thank you for the help with rails guys :) I'm going to be heading home from work here soon so I'm going to leave the channel. I'll probably be on here again though :P
[22:44:58] tycoon177: has left #RubyOnRails: ()
[22:45:41] ziyadb: has joined #RubyOnRails
[22:46:05] new_bruins: I'm still not sure that I completely understand why it works but I will just have to read up on nested routes I guess
[22:47:21] kirillzh: has joined #RubyOnRails
[22:48:44] ascarter: has joined #RubyOnRails
[22:49:51] ebbflowgo: has joined #RubyOnRails
[22:50:21] stannard: has joined #RubyOnRails
[22:51:17] flashpoint9: has joined #RubyOnRails
[22:52:52] tetraktys: has joined #RubyOnRails
[22:54:05] nozpheratu: has joined #RubyOnRails
[22:55:02] SteenJobs: new_bruins: oh didn’t realize they weren’t nested before - there you go!
[22:55:51] Spami: has joined #RubyOnRails
[22:56:47] workmad3: has joined #RubyOnRails
[23:00:17] kirillzh: has joined #RubyOnRails
[23:00:35] pawnbox: has joined #RubyOnRails
[23:06:07] baweaver: has joined #RubyOnRails
[23:09:56] maxdoubt: has joined #RubyOnRails
[23:14:07] Macaveli: has joined #RubyOnRails
[23:14:26] zave: has joined #RubyOnRails
[23:16:27] ebbflowgo: has joined #RubyOnRails
[23:18:45] mwlang: I have about 40 model classes I’m working on deprecating. Is there a way to move these files into “models/deprecated” and configure Rails to find and auto-reload without putting them inside a “Deprecated” module?
[23:19:43] mwlang: we have to go through at least one round of deploy to production and run rake migrations and various housekeeping.
[23:19:59] maxdoubt: has joined #RubyOnRails
[23:20:08] mwlang: after which, it’d be nice to just git rm app/models/deprecated and bam, they’re gone.
[23:21:53] reaVer: has joined #RubyOnRails
[23:23:41] trinaldi: has joined #RubyOnRails
[23:24:37] uglybandersnatch: has joined #RubyOnRails
[23:25:35] snowy: has joined #RubyOnRails
[23:30:18] drbayer: has joined #RubyOnRails
[23:30:40] pawnbox: has joined #RubyOnRails
[23:35:17] robbyoconnor: has joined #RubyOnRails
[23:35:17] Puffball: has joined #RubyOnRails
[23:39:04] tetraktys: has joined #RubyOnRails
[23:42:58] daxroc: has joined #RubyOnRails
[23:45:47] joaomdmoura__: has joined #RubyOnRails
[23:45:52] jlpeters: has joined #RubyOnRails
[23:46:33] stannard: has joined #RubyOnRails
[23:49:39] m15k: has joined #RubyOnRails
[23:49:49] baweaver: has joined #RubyOnRails
[23:50:24] m15k: rake -f /var/lib/posty/Rakefile db:migrate is this correct to specify a Rakefile?
[23:52:49] uglybandersnatch: has joined #RubyOnRails
[23:52:55] Pazician: has joined #RubyOnRails
[23:52:59] one_zero: has joined #RubyOnRails
[23:53:25] ayoros: has joined #RubyOnRails
[23:54:05] thorgi: has joined #RubyOnRails
[23:54:08] cnk: I don't know but why are you trying? I have never had to do aything like that for db:migrate
[23:54:28] lemur: has joined #RubyOnRails
[23:54:51] m15k: cnk, I try to setup an lxc-container where the current directory is not the one with the rails project.
[23:59:21] cnk: seems like that is the way - but since you are asking, I assume it isn't working