« Back to channel list

#RubyOnRails - 17 June 2016

« Back 1 day Forward 1 day »
[00:00:20] DoctorMonocular: has joined #RubyOnRails
[00:01:32] DoctorMonocular: jhass, that makes sense, I thought something like that right now happening
[00:02:57] ashleyw: has joined #RubyOnRails
[00:04:58] macsteps: has joined #RubyOnRails
[00:08:35] dblessing: has joined #RubyOnRails
[00:11:15] SteenJobs: has joined #RubyOnRails
[00:14:57] tildes: has joined #RubyOnRails
[00:15:05] pwnd_nsfw`: has joined #RubyOnRails
[00:15:05] wethu: has joined #RubyOnRails
[00:22:08] snowy: has joined #RubyOnRails
[00:22:57] smathy: has joined #RubyOnRails
[00:24:05] superlou: has joined #RubyOnRails
[00:29:41] cydrobolt: has joined #RubyOnRails
[00:29:41] cydrobolt: has joined #RubyOnRails
[00:31:04] Darmani: Could someone help me out? I can't migrate my db and I don't understand the error.
[00:31:06] Darmani: https://gist.github.com/mfifth/9c9859f8a287415dcc110bdb1a4ab6a2
[00:31:32] Axilla: has joined #RubyOnRails
[00:32:35] jtong: has joined #RubyOnRails
[00:32:56] truenito: has joined #RubyOnRails
[00:34:05] nettoweb: has joined #RubyOnRails
[00:35:00] Darmani: ACTION sighs
[00:35:06] Darmani: never mind. I'll take a crack at this tomorrow.
[00:35:13] Darmani: later pplz.
[00:35:15] Ropeney: Darmani, try :shirts
[00:35:35] xibalba: has joined #RubyOnRails
[00:35:51] Ropeney: actually, they are different databases?
[00:36:29] Ropeney: and their gone, hello me
[00:36:35] dblessing: has joined #RubyOnRails
[00:36:44] guidocalvano: has joined #RubyOnRails
[00:39:40] roamingdog: has joined #RubyOnRails
[00:39:53] rafaelfranca: has joined #RubyOnRails
[00:39:53] rafaelfranca: has joined #RubyOnRails
[00:50:44] lightt: has joined #RubyOnRails
[00:52:55] jancel: has joined #RubyOnRails
[00:53:10] rickmasta: has joined #RubyOnRails
[01:00:24] wd40s: has joined #RubyOnRails
[01:00:27] rickmasta: has joined #RubyOnRails
[01:01:20] rogue_koder: has joined #RubyOnRails
[01:05:25] wd40s: has joined #RubyOnRails
[01:05:35] dblessing: has joined #RubyOnRails
[01:08:35] inoic: has joined #RubyOnRails
[01:10:22] Omen: has joined #RubyOnRails
[01:10:51] xibalba: has joined #RubyOnRails
[01:11:06] eserror: has joined #RubyOnRails
[01:14:28] rickmasta: has joined #RubyOnRails
[01:15:27] jetpackjoe: has joined #RubyOnRails
[01:17:09] mrkhlm: has joined #RubyOnRails
[01:17:17] rickmasta: has joined #RubyOnRails
[01:20:14] jhack: has joined #RubyOnRails
[01:23:02] snowy: has joined #RubyOnRails
[01:25:07] lightt: has joined #RubyOnRails
[01:28:29] emachnic: has joined #RubyOnRails
[01:29:06] Radar: My guess is that the shirt migration is defined after the orders migration.
[01:29:27] kgrz: has joined #RubyOnRails
[01:29:28] Radar: Although psql output shows otherwise. HMMM
[01:31:34] dblessing: has joined #RubyOnRails
[01:32:18] rickmasta: has joined #RubyOnRails
[01:35:09] jtong: has joined #RubyOnRails
[01:35:45] chopin: has joined #RubyOnRails
[01:37:37] adre: has joined #RubyOnRails
[01:38:30] ensyde: has joined #RubyOnRails
[01:41:39] allcentury: has joined #RubyOnRails
[01:44:42] chintanparikh: has joined #RubyOnRails
[01:44:59] Coldblackice: has joined #RubyOnRails
[01:45:09] roamingdog: has joined #RubyOnRails
[01:48:59] Long: has joined #RubyOnRails
[01:52:37] roamingdog: has joined #RubyOnRails
[01:54:24] rickmasta: has joined #RubyOnRails
[02:00:56] Caerus|Away: has joined #RubyOnRails
[02:03:36] banister: has joined #RubyOnRails
[02:06:19] macsteps: has joined #RubyOnRails
[02:08:16] chintanparikh: Anyone know how to get ActionCable to fallback to long polling?
[02:09:01] Alazoral: has joined #RubyOnRails
[02:09:57] jgt3: has joined #RubyOnRails
[02:23:07] emachnic: has joined #RubyOnRails
[02:24:02] ur5us: has joined #RubyOnRails
[02:24:02] alfiemax: has joined #RubyOnRails
[02:27:58] zeknox: has joined #RubyOnRails
[02:35:18] Niham: has joined #RubyOnRails
[02:37:36] jtong: has joined #RubyOnRails
[02:38:32] adre: has joined #RubyOnRails
[02:44:53] chintanparikh: has joined #RubyOnRails
[02:54:56] brianpWins_: has joined #RubyOnRails
[02:58:25] DoctorMonocular: has joined #RubyOnRails
[03:00:01] rueben: has joined #RubyOnRails
[03:09:46] enitiz: has joined #RubyOnRails
[03:10:31] emachnic: has joined #RubyOnRails
[03:10:33] dblessing: has joined #RubyOnRails
[03:10:48] jgt3: has joined #RubyOnRails
[03:11:33] kali3: has joined #RubyOnRails
[03:12:16] sevenseacat: has joined #RubyOnRails
[03:14:03] emachnic_: has joined #RubyOnRails
[03:14:33] jhack: has joined #RubyOnRails
[03:20:10] braincras: has joined #RubyOnRails
[03:20:53] k3rn31: has joined #RubyOnRails
[03:30:53] hahuang62: has joined #RubyOnRails
[03:31:24] Technodrome: has joined #RubyOnRails
[03:34:24] binaryplease1: has joined #RubyOnRails
[03:36:45] emachnic: has joined #RubyOnRails
[03:36:47] Rodya_: has joined #RubyOnRails
[03:39:02] jtong: has joined #RubyOnRails
[03:39:08] sunya7a_1: anyone have experience with zurb foundation and rails? I have the following code: https://gist.github.com/anonymous/93dea7f7e25549a5dbca7e38b946ea5d which doesn't seem to be responding to the size change and keeps the same image
[03:47:52] chintanparikh: has joined #RubyOnRails
[03:53:37] lightt: has joined #RubyOnRails
[03:54:36] dblessing: has joined #RubyOnRails
[03:56:30] tubbo: has joined #RubyOnRails
[03:59:09] Pharaoh2: has joined #RubyOnRails
[04:01:36] mziemys: has joined #RubyOnRails
[04:04:42] tvw: has joined #RubyOnRails
[04:06:17] AdamOnRails: has joined #RubyOnRails
[04:07:10] macsteps: has joined #RubyOnRails
[04:08:03] AdamOnRails: Hope we are all. So I have an irritating issue regarding Bootstrap/JS not firing properly. The story goes a little something like this...
[04:08:10] AdamOnRails: Hope we are all well *
[04:09:33] mziemys_: has joined #RubyOnRails
[04:09:47] AdamOnRails: So I have a registration form, which I use pwstrength bootstrap to generate a password strength meter. It loads up fine on the initial page, but when I hit submit and the validations fail, the rendered form wont display the Strength Meter properly.
[04:09:56] AdamOnRails: And by "properly" - I mean "at all."
[04:10:04] AdamOnRails: http://pastie.org/private/njzs8wijhyyyebnzzj69g
[04:10:20] AdamOnRails: Above is my set up, including links to a few screenshots at the bottom.
[04:11:14] AdamOnRails: The form is working fine, validation errors and instance variables are all as they should be. But the JS seems to be bugging out. I've tried tinkering with the JS script but to no avail.
[04:11:22] sevenseacat: couple of things
[04:11:25] sevenseacat: 1) where's *your* js code
[04:11:38] sevenseacat: 2) please please don't do things like `if Rails.env.production?` in a controller action
[04:11:38] jgt3: has joined #RubyOnRails
[04:12:18] AdamOnRails: I only did that so I could keep the captcha in there whle developing, once the registration form is finished and in production, I plan to remove it.
[04:12:41] sevenseacat: it's likely a turbolinks issue... wait, you're removing the captcha in production? huh?
[04:13:13] d0nn1e: has joined #RubyOnRails
[04:14:31] Pharaoh2: has joined #RubyOnRails
[04:14:40] AdamOnRails: http://pastie.org/private/5zn603l0sfbqrqjalrrpq
[04:14:44] AdamOnRails: ^^ My JS setup
[04:15:28] AdamOnRails: No no, I'm removing the rails.env? stuff. The captcha will remain. It doesn't work on localhost so I skip it in development.
[04:15:45] sevenseacat: ok, so the password thingy is set to run on document ready, which turbolinks doesnt trigger by default on page change
[04:16:51] AdamOnRails: At line 39 of the pastie? Yeah I tinkered with that based on a few stackOverflows, didn't get very far though - may have been doing it wrong.
[04:16:52] sevenseacat: couple of options - 1) remove turbolinks, 2) fix plugin so that you can customize the events it runs on, or 3) include the jquery-turbolinks gem
[04:17:14] sevenseacat: well without knowing what you did, can't say :)
[04:17:19] AdamOnRails: Option 3 seems less intrusive.
[04:17:30] AdamOnRails: I'll give it a whirl, thanks :)
[04:17:43] sevenseacat: I listed those in preference order - I'd lean towards 1 or 2
[04:18:17] teaearlgraycold: has joined #RubyOnRails
[04:20:33] AdamOnRails: Rodgey that, I'll look at Option 1. Turbolinks eh... more new rails stuff. Woohoo.
[04:21:37] AdamOnRails: Howcome your preference is to remove Turbolinks? Isn't this like a super cool speed enhancement type thingy?
[04:23:15] G: has joined #RubyOnRails
[04:23:34] sevenseacat: because its a pain in the fucking ass and the benefits are negligible, compared to the drawbacks of changing how users are used to seeing browsers work
[04:23:59] AdamOnRails: Watching a vid on it now.
[04:24:03] sevenseacat: *user clicks link and expects to see browser progress bar or something... hmm.... nothing
[04:24:10] sevenseacat: *nothing happens until the page is ready to render
[04:26:32] swap_a_b: has joined #RubyOnRails
[04:26:47] jas02: has joined #RubyOnRails
[04:28:30] KnownSy0: has joined #RubyOnRails
[04:29:22] jancel: has joined #RubyOnRails
[04:29:54] jenrzzz: has joined #RubyOnRails
[04:30:12] YourManCJ: has joined #RubyOnRails
[04:30:30] YourManCJ: anyone ever deployed a rails app to amazon ec2 servers?
[04:30:58] dblessing: has joined #RubyOnRails
[04:31:29] swap_a_b: yourmancj: Yes
[04:32:53] roamingdog: has joined #RubyOnRails
[04:33:06] DZj091231kld: has joined #RubyOnRails
[04:33:38] YourManCJ: ok good. I have an ec2 instance running and I am looking to install a rails application to it. do you know of any good guides on this subject?
[04:36:02] swap_a_b: yourmancj: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html
[04:37:19] swap_a_b: yourmancj: I usually automate deployments using puppet
[04:39:49] jtong: has joined #RubyOnRails
[04:40:34] pawnbox: has joined #RubyOnRails
[04:41:53] arooni: has joined #RubyOnRails
[04:48:50] rroyal: has joined #RubyOnRails
[04:48:57] Long: has joined #RubyOnRails
[04:53:54] atrius: has joined #RubyOnRails
[04:58:03] duncannz: has joined #RubyOnRails
[04:59:57] wethu: has joined #RubyOnRails
[05:08:09] macsteps: has joined #RubyOnRails
[05:08:39] AdamOnRails: has joined #RubyOnRails
[05:09:41] AdamOnRails: Sevenseacat: Apart from removing the "require 'turbolinks'" from the application.js, is there any further steps I need to take? Closed/Opened browser, restarted the server just in case... still same issue
[05:10:45] sevenseacat: is turbolinks getting loaded in your pages now?
[05:14:18] AdamOnRails: Checked the source, no link tags to turbolinks
[05:16:53] sevenseacat: then it seems your problem lies firmly with JS - start debugging the JS, is your document.ready being called, etc.
[05:17:11] Ropeney: pretty sure turbolinks is in the application layout too?
[05:17:42] pawnbox: has joined #RubyOnRails
[05:18:34] AdamOnRails: It's wierd - half of the JS is doing its job, the other half isnt. On those screenshots i listed you can see where it shows an error message like "Your password is too short" -> that is part of the pwstrength JS which seems to be working fine. Its in a SPAN that is being injected into the designated DIV.
[05:19:01] AdamOnRails: But the DIVs that are used to produce the visual meter itself don't seem to be appearing.
[05:19:10] AdamOnRails: So to me that says that document.ready is working fine.
[05:19:15] Niham: has joined #RubyOnRails
[05:19:27] sevenseacat: Ropeney: yeah there's more places that should be cleaned up, ie. in the Gemfile, but for now just removing it from application.js will disable turbolinks from screwing things up
[05:19:35] AdamOnRails: I'm just thinking out loud at this point.
[05:19:37] sevenseacat: adamonrails: seems like a bug in your library then
[05:19:47] sevenseacat: if half the functionality is working and the other half isnt
[05:24:01] spectra: has joined #RubyOnRails
[05:24:01] snoobydoo: has joined #RubyOnRails
[05:24:59] AdamOnRails: Hmm, but I haven't changed anything. Wierd. At this point I'm lost as I wouldn't have a clue about JS.
[05:25:22] AdamOnRails: Maybe I don't really need a strength meter :P
[05:29:34] rogue_koder_: has joined #RubyOnRails
[05:30:57] dblessing: has joined #RubyOnRails
[05:31:46] hahuang62: has joined #RubyOnRails
[05:39:00] Technodrome: has joined #RubyOnRails
[05:41:31] KnownSyntax: has joined #RubyOnRails
[05:41:41] jtong: has joined #RubyOnRails
[05:48:30] Pharaoh2: has joined #RubyOnRails
[05:49:07] shinnya: has joined #RubyOnRails
[05:50:46] Coldblackice: has joined #RubyOnRails
[05:58:14] rails45: has joined #RubyOnRails
[05:58:22] rails45: Can someone take a look? https://gist.github.com/anonymous/9ef96dfb54bce03213b7bbe1bcb2b55b
[05:59:22] Radar: add_index :users, :username, unique=true
[05:59:26] Radar: This syntax is a bit weird
[05:59:33] Radar: add_index :users, :username, unique: true
[06:00:24] tildes: has joined #RubyOnRails
[06:00:46] rails45: ahh yes that seems to have been the problem. thanks!
[06:01:34] swap_a_b: has joined #RubyOnRails
[06:01:40] rails45: also, is this the correct way to add a username field to devise?
[06:05:05] eserror: has joined #RubyOnRails
[06:08:07] jgt3: has joined #RubyOnRails
[06:08:59] netzfisch: has joined #RubyOnRails
[06:11:17] macsteps: has joined #RubyOnRails
[06:12:39] Sheperson: has joined #RubyOnRails
[06:15:04] eGGshke: has joined #RubyOnRails
[06:15:35] xibalba: has joined #RubyOnRails
[06:16:05] axxyhtrx: has joined #RubyOnRails
[06:18:16] jancel: has joined #RubyOnRails
[06:21:00] AimlessRAven: has joined #RubyOnRails
[06:22:55] rroyal: has joined #RubyOnRails
[06:26:59] yfeldblum: has joined #RubyOnRails
[06:28:27] srinidhi: has joined #RubyOnRails
[06:28:27] BinaryMaster: has joined #RubyOnRails
[06:30:00] AimlessRAven: https://gist.github.com/anonymous/520f055362f36383ec6a3c6c7c802097
[06:30:24] AimlessRAven: when i set me redemption_methods like this way.. this work, but when form is subbmit, checkbox is mark as unchecked
[06:30:32] AimlessRAven: if i set default labels.. its work normaly, why
[06:30:45] BinaryMaster: Question: I am using rails 5.0.0.rc1 I can run rails db:migrate without any problems but if I try to run rails c I get an error message about it trying to login to mysql with root when that is not the user I have setup nor the user it used to do the migration. Any ideas on what I can look at to track down why it is trying to use root?
[06:31:37] AimlessRAven: what is the good way to set labels for my enumerize
[06:32:04] comrad: has joined #RubyOnRails
[06:33:03] gingray: has joined #RubyOnRails
[06:33:30] netzfisch: has joined #RubyOnRails
[06:35:23] dblessing: has joined #RubyOnRails
[06:35:39] moeabdol: has joined #RubyOnRails
[06:37:57] PotatoChipz: has joined #RubyOnRails
[06:38:30] swap_a_b: has joined #RubyOnRails
[06:40:03] snoobydoo: Question - I have a rake task that I would like to schedule as a Cronjob. I'm going to be using Clockwork/ActiveJob/Sidekiq for this - My question is, Should the active job file define what its supposed to be doing instead of a rakefile in this pattern or can the active job reference or call rake (which doesn't look ideal/possible to me)?
[06:40:04] dionysus69: has joined #RubyOnRails
[06:41:21] AimlessRAven: has joined #RubyOnRails
[06:42:18] AimlessRAven: hi all, why when i set my enumerize labels like this
[06:42:18] AimlessRAven: https://gist.github.com/anonymous/96b2a8d54b1aaf278afa2194f132f220
[06:42:33] AimlessRAven: when submit form this filter my result, but checkbox is go unchecked
[06:42:44] AimlessRAven: if i use default labels, after submit checkbox is checked
[06:43:03] aganov: has joined #RubyOnRails
[06:43:05] jtong: has joined #RubyOnRails
[06:45:21] guidocalvano: has joined #RubyOnRails
[06:45:47] xcesariox: has joined #RubyOnRails
[06:47:55] brandon_j: has joined #RubyOnRails
[06:47:58] PotatoChipz: Hi, so I'm designing a RESTful API for loyalty card.
[06:47:59] PotatoChipz: loyaltycards/<resource_id>/rewards
[06:48:00] PotatoChipz: So, I'm confused if I should use the card # as resource id or the database table's PK.
[06:48:00] PotatoChipz: Which is the RESTful and secured way? Is there a right / wrong answer for this?
[06:48:06] brandon_j: Is there something for Rails that converts a number like 1,536 to 1.5k?
[06:48:16] brandon_j: Similar to Twitter with favorite/retweet count.
[06:48:22] ferr: has joined #RubyOnRails
[06:48:41] brandon_j: I know there's number_to_human, but it would convert 1,536 to "1.54 Thousand"
[06:48:55] PotatoChipz: number_to_human(1536, :format => '%n%u', :units => { :thousand => 'K' })
[06:49:02] PotatoChipz: something like that.
[06:49:15] xcesariox: has joined #RubyOnRails
[06:49:49] brandon_j: potatochipz: thanks!
[06:54:14] BinaryMaster: potatochipz, either way is fine but whatever you use it should be an indexed col
[06:55:05] PotatoChipz: Binarymaster yeah thanks. I've been searching for security risks if I use 16-digit numbers... is this common?
[06:56:06] BinaryMaster: I think the only risk is if you don't verify that the resource is owned by the user
[06:56:30] BinaryMaster: as long as you do that you are in the clear
[06:56:47] lurch_: has joined #RubyOnRails
[06:56:57] PotatoChipz: Alright then... thank you
[06:57:09] BinaryMaster: if that isn't possible then use some kind of uuid
[06:57:26] GoranPavlovic: has joined #RubyOnRails
[06:57:49] lurch_: hi, is there a way to monitor the connection pool and check for leaked connections?
[07:02:46] qejk: has joined #RubyOnRails
[07:04:38] Guest_: has joined #RubyOnRails
[07:05:56] lightt: has joined #RubyOnRails
[07:06:28] danostrowski: has joined #RubyOnRails
[07:10:41] DoctorMonocular: has joined #RubyOnRails
[07:11:04] dionysus69: has joined #RubyOnRails
[07:12:12] artto: has joined #RubyOnRails
[07:16:48] ksoze: has joined #RubyOnRails
[07:18:56] norc: has joined #RubyOnRails
[07:21:46] arBmind: has joined #RubyOnRails
[07:22:16] darutoko: has joined #RubyOnRails
[07:23:38] matthewd: lurch_: Define leaked?
[07:23:47] matthewd: lurch_: Also, what Rails version?
[07:24:21] norc: has joined #RubyOnRails
[07:26:38] axxyhtrx: has joined #RubyOnRails
[07:28:11] lurch_: matthewd: rails 4.1.2.. the problem we are having is that we run rails via puma (with multiple threads) and set the DATABASE_POOL_SIZE to equal the amount of threads. However, we often get the “could not connect to db in 5 secs” error indicating that the pool was exhausted… so i guess either the connections are not released properly back to the pool, or some connections become unusable somehow.. would like to monitor the usage of the connections in
[07:28:12] lurch_: pool (allocation / deallocation) so that we can see when some part of the code is misbehaving
[07:28:36] FCser: has joined #RubyOnRails
[07:29:05] DoubleMalt: has joined #RubyOnRails
[07:31:41] matthewd: lurch_: If threads die (with a connection), the connection will be leaked like that
[07:31:55] matthewd: lurch_: (that was fixed in 4.2, if it helps)
[07:32:35] lurch_: matthewd: good to know. thanks!
[07:32:43] matthewd: lurch_: Are you doing any manual threading, beyond what puma does internally?
[07:33:37] matthewd: Another thing to check would be if you're accidentally causing a DB connection during app boot (e.g., calling .column_names inside a model class)
[07:33:57] matthewd: .. that would leave your master thread with a connection, meaning your total need was POOL+1
[07:34:30] Dimik: has joined #RubyOnRails
[07:35:13] lurch_: matthewd: no manual threading afaik.. will check the initializers. thanks!
[07:35:28] dblessing: has joined #RubyOnRails
[07:36:49] matthewd: lurch_: The dead-threads-keep-locks fix was https://github.com/rails/rails/pull/14360, if you want to backport it
[07:36:57] jgt3: has joined #RubyOnRails
[07:38:11] snoobydoo: Guys, quick question. Can I call a rake task within an active job? Or should i rewrite my task within activejob perform?
[07:41:12] Ergo: has joined #RubyOnRails
[07:42:41] Mia: has joined #RubyOnRails
[07:44:28] matthewd: snoobydoo: !guys but: I think I'd move to code to the job, then change the rake task to TheJob.perform_now
[07:44:28] helpa: snoobydoo: We're not all guys here - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[07:45:04] jtong: has joined #RubyOnRails
[07:45:33] matthewd: snoobydoo: You could probably convince the job to invoke the rake task, but to me, it seems structurally the wrong way 'round.. a consequence of where the code is right now, and not the way one would write it from a blank slate
[07:45:34] snoobydoo: My bad. I've seen the !guys flag multiple times. Sorry!
[07:46:26] snoobydoo: matthewd: I don't need a rake task per se. I initially wrote a rake task so I could setup cron. But I've moved to using clockwork/activejob/sidekiq - so technically all I want is a background job that runs on intervals
[07:49:15] matthewd: Yeah, sounds like the job class is the ideal place for that code to live, then
[07:50:09] snoobydoo: Cool, thanks!
[07:51:45] alfiemax: has joined #RubyOnRails
[07:51:57] wd40s: has joined #RubyOnRails
[07:53:29] edwinvdgraaf: has joined #RubyOnRails
[07:53:33] AmiMoench: has joined #RubyOnRails
[07:56:20] rubyonrails884: has joined #RubyOnRails
[07:57:41] srinidhi: has joined #RubyOnRails
[08:02:23] workmad3: has joined #RubyOnRails
[08:02:32] neanderslob: has joined #RubyOnRails
[08:02:40] neanderslob_: has joined #RubyOnRails
[08:03:57] neanderslob: has joined #RubyOnRails
[08:08:30] adre: has joined #RubyOnRails
[08:15:27] jsrn: has joined #RubyOnRails
[08:15:28] dannyguk: has joined #RubyOnRails
[08:15:49] lightt: has joined #RubyOnRails
[08:20:29] nickjj_: has joined #RubyOnRails
[08:20:34] mozzarel1: has joined #RubyOnRails
[08:23:13] PaulePanter: has joined #RubyOnRails
[08:23:40] moeabdol: has joined #RubyOnRails
[08:23:47] herenow: has joined #RubyOnRails
[08:23:53] D9: has joined #RubyOnRails
[08:24:37] Trynemjoel: has joined #RubyOnRails
[08:25:02] hiddenloop: has joined #RubyOnRails
[08:25:16] emachnic: has joined #RubyOnRails
[08:25:25] AmiMoench: has joined #RubyOnRails
[08:25:28] norfumpit: has joined #RubyOnRails
[08:27:27] callumacrae: has joined #RubyOnRails
[08:31:27] dblessing: has joined #RubyOnRails
[08:31:47] xall: has joined #RubyOnRails
[08:34:54] helpa: has joined #RubyOnRails
[08:36:12] prooftechnique_: has joined #RubyOnRails
[08:36:29] Psy-Q_: has joined #RubyOnRails
[08:37:09] boshhead: has joined #RubyOnRails
[08:37:09] boshhead: has joined #RubyOnRails
[08:37:15] Nowaker: has joined #RubyOnRails
[08:37:22] knight_: has joined #RubyOnRails
[08:37:40] PaulePan1er: has joined #RubyOnRails
[08:37:52] Sirecote: has joined #RubyOnRails
[08:37:52] dever_: has joined #RubyOnRails
[08:37:59] hfp_work: has joined #RubyOnRails
[08:38:09] hightower2: has joined #RubyOnRails
[08:38:14] funnel_: has joined #RubyOnRails
[08:38:23] fumk: has joined #RubyOnRails
[08:38:33] fl4sh__: has joined #RubyOnRails
[08:39:35] chrisml`: has joined #RubyOnRails
[08:40:14] Kuukunen: has joined #RubyOnRails
[08:40:16] Synthead: has joined #RubyOnRails
[08:40:46] strongcode: has joined #RubyOnRails
[08:41:01] erlend: has joined #RubyOnRails
[08:41:05] AdamOnRails: if I do @user.errors.add(:blah, "Blah needs to be something different.")
[08:41:14] AdamOnRails: will @user.save validate?
[08:41:46] silverdu1t: has joined #RubyOnRails
[08:41:52] gthank: has joined #RubyOnRails
[08:41:52] gthank: has joined #RubyOnRails
[08:41:58] AdamOnRails: Or will the @user object get saved to the DB even though it has my custom error inside it
[08:42:19] tekku: has joined #RubyOnRails
[08:42:26] sevenseacat: has joined #RubyOnRails
[08:42:31] schmoot-: has joined #RubyOnRails
[08:42:42] pokEarl: has joined #RubyOnRails
[08:42:49] svkurowski: has joined #RubyOnRails
[08:42:49] arBmind: has joined #RubyOnRails
[08:42:58] sandelius: has joined #RubyOnRails
[08:42:59] EXCHGR: has joined #RubyOnRails
[08:42:59] veloutin: has joined #RubyOnRails
[08:43:08] iamayam: has joined #RubyOnRails
[08:43:09] Fridtjof: has joined #RubyOnRails
[08:43:12] Vircung: has joined #RubyOnRails
[08:43:22] fox_mulder_cp: has joined #RubyOnRails
[08:43:43] chrisarcand: has joined #RubyOnRails
[08:43:48] jdcauley: has joined #RubyOnRails
[08:43:57] pragmatism: has joined #RubyOnRails
[08:44:01] D9: has joined #RubyOnRails
[08:44:03] _underscore_: has joined #RubyOnRails
[08:44:39] apeiros: has joined #RubyOnRails
[08:45:11] universa1: adamonrails: !try
[08:45:11] helpa: adamonrails: Why don't you try it and find out for yourself?
[08:45:50] AdamOnRails: as soon as I typed it, I knew I shoudn't have asked until I tried it haha
[08:45:53] AntiSpamMeta: has joined #RubyOnRails
[08:46:40] jtong: has joined #RubyOnRails
[08:47:01] yfeldblum: has joined #RubyOnRails
[08:47:17] Hates_: has joined #RubyOnRails
[08:47:37] Hosh: has joined #RubyOnRails
[08:47:39] deeprave: has joined #RubyOnRails
[08:47:40] dmcc: has joined #RubyOnRails
[08:47:44] upgrayeddd: has joined #RubyOnRails
[08:49:01] spectra: has joined #RubyOnRails
[08:49:29] jcp: has joined #RubyOnRails
[08:49:30] Fridtjof: has joined #RubyOnRails
[08:49:39] marr: has joined #RubyOnRails
[08:49:49] gmci: has joined #RubyOnRails
[08:50:57] Circuit8: has joined #RubyOnRails
[08:52:04] blackmesa: has joined #RubyOnRails
[08:53:40] tvw: has joined #RubyOnRails
[08:56:33] weckl: has joined #RubyOnRails
[08:57:53] axxyhtrx: has joined #RubyOnRails
[09:01:24] defsdoor: has joined #RubyOnRails
[09:04:01] mdw: has joined #RubyOnRails
[09:11:07] lurch_: has joined #RubyOnRails
[09:12:02] guidocalvano: has joined #RubyOnRails
[09:12:21] arBmind: has joined #RubyOnRails
[09:15:27] czerasz: has joined #RubyOnRails
[09:15:35] fidalgo: has joined #RubyOnRails
[09:16:15] srinidhi: has joined #RubyOnRails
[09:17:19] axxyhtrx: has joined #RubyOnRails
[09:19:11] Cervajz: has joined #RubyOnRails
[09:19:49] artto: has joined #RubyOnRails
[09:20:09] alfiemax: has joined #RubyOnRails
[09:24:56] artto_: has joined #RubyOnRails
[09:27:53] bruce_lee: has joined #RubyOnRails
[09:28:05] edwinvdgraaf: has joined #RubyOnRails
[09:28:21] kristofferR: has joined #RubyOnRails
[09:32:38] wd40s: has joined #RubyOnRails
[09:32:57] jgt3: has joined #RubyOnRails
[09:36:32] noodle: has joined #RubyOnRails
[09:37:26] c355E3B: has joined #RubyOnRails
[09:37:31] rubyonrails803: has joined #RubyOnRails
[09:37:46] ngw: has joined #RubyOnRails
[09:39:59] AzaToth: has joined #RubyOnRails
[09:40:06] moep: has joined #RubyOnRails
[09:42:03] GoranPavlovic: has joined #RubyOnRails
[09:45:14] VULNZ: has joined #RubyOnRails
[09:45:20] VULNZ: Hello dear friends
[09:46:01] VULNZ: can I ask questions in here about ruby on rails development ( basics) ?
[09:47:22] snowy: has joined #RubyOnRails
[09:47:32] jtong: has joined #RubyOnRails
[09:47:53] matthewd: VULNZ: Hi! Yep, ask away!
[09:49:35] wethu: has joined #RubyOnRails
[09:50:25] apotry: has joined #RubyOnRails
[09:50:26] VULNZ: Thank you. I have real question. In my ruby on rails application in show.html.erb file I added some code where i have require and it does not work for some reason. Also I know that all code I need to put away from erb files, but how can I include my variables after they proceed in erb?
[09:50:55] etiago: has joined #RubyOnRails
[09:51:01] Mia: has joined #RubyOnRails
[09:51:01] Mia: has joined #RubyOnRails
[09:51:13] AdamOnRails: When I do... @user = User.find(params[:id]) ... I want to be able to do a check if a user was found (@user.nil? or something) but instead it throws an exception saying that it couldn't find a User with that particular ID
[09:51:18] alfiemax: VULNZ, would be good if you would share your veew file
[09:51:46] alfiemax: adamonrails, use, find_by
[09:51:51] matthewd: VULNZ: !didntwork
[09:51:51] helpa: VULNZ: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[09:51:59] AdamOnRails: Basically im searching for a User so that I can match its activation code with params[:activation_code]
[09:52:54] alfiemax: and use @user.present?
[09:53:24] alfiemax: it does a similar thing as nil? but is more meaningful
[09:53:33] jancel: has joined #RubyOnRails
[09:54:03] VULNZ: Guys: Question is: I have show.html.erb file where i put some code between <%= a=1 %> and it works, when I put there require it does not work, do you know why and where do i have to put my ruby code? controllers/helpers and how do I do this. thanks
[09:54:19] srinidhi: has joined #RubyOnRails
[09:54:39] alfiemax: VULNZ, it won't work
[09:55:17] alfiemax: it seems like you are trying to put some logic in your views
[09:55:21] alfiemax: which you shouldn't
[09:55:27] moeabdol: has joined #RubyOnRails
[09:55:39] VULNZ: yes i do and i know i should not. I would like to know where to put it.
[09:56:30] alfiemax: it should be done in your controller, if you would specify what you are trying to require, or atleast describe your context some one might be able to provide you some advice
[09:56:53] alfiemax: without that, i can only say that you should be doing it in your controller
[09:57:08] alfiemax: where i'm not certain what "it" is
[09:57:26] VULNZ: I will post in , few seconds
[09:59:10] xall: has joined #RubyOnRails
[09:59:16] VULNZ: http://pastebin.com/KzbmPJAt and i put it in my show.html.erb between <%= %> and it does not work
[10:01:28] axxyhtrx: has joined #RubyOnRails
[10:03:09] matthewd: VULNZ: As the bot said, "does not work" is not enough information. What is happening? How is it different from what you're expecting?
[10:03:38] alfiemax: VULNZ, what is this???
[10:04:02] alfiemax: did you put the complete code in the snippet in your view?
[10:04:11] alfiemax: what are you trying to achieve?
[10:05:30] VULNZ: I would like this code to finish and when it will finish i would like to get its answer to ruby on rails page ( show)
[10:06:43] hirvi: are you expecting the puts commands to output to your page?
[10:06:43] mercerist: has joined #RubyOnRails
[10:07:24] VULNZ: i know they will not work, i know that simple variable should show without using put.
[10:07:49] alfiemax: VULNZ, this is just a plain ruby script
[10:08:07] VULNZ: it is. I put it inside rails show
[10:08:17] alfiemax: yes, and it won't work like that
[10:08:31] alfiemax: have you build any basic app using rails?
[10:08:40] alfiemax: if not i suggest you start learning rails
[10:09:23] VULNZ: I tried to, i just need to understand where to put logics and how to show it in .htmk.erb files.
[10:09:25] alfiemax: without that i don't think anyone would be having any time to walk you through the whole process of learning rails
[10:09:37] Kedare: has joined #RubyOnRails
[10:10:29] alfiemax: VULNZ, do you understand that rails has a MVC architecture?
[10:10:44] hirvi: you need to understand relationship between model, controller and view. i.e. MVC.
[10:10:45] alfiemax: and how each component talks with each other?
[10:11:03] VULNZ: yes, but I dont understand where to put code and how to get it out to viewer files
[10:11:41] VULNZ: model view controller, but i dont understand where to put code and how to get variables out of that code to view
[10:11:56] alfiemax: ok, any instance variables defined in your controller action would be available in your corresponding view
[10:12:13] hirvi: extremely generalized: logic goes mostly into model, controller passes the data from model to view. view has as little logic as possible.
[10:12:56] blackmesa: has joined #RubyOnRails
[10:13:42] VULNZ: thanks guys. If i put my entire code inside controller how do you call it inside viewer file?
[10:14:10] emachnic: has joined #RubyOnRails
[10:14:43] hirvi: you can set the instance variable in the controller (starts with @) e.g. @balance = 100. then in your view cou can show it: Your balance is: <%= balance %>
[10:15:03] VULNZ: thanks, will try.
[10:15:03] hirvi: sorry. Your balance is: <%= @balance %>
[10:15:16] jgt: has joined #RubyOnRails
[10:18:07] hirvi: and I suggest you start with a general rails tutorial before trying to implement your code.
[10:19:32] Circuit8: Hey guys I've just deployed my app to heroku, its working absolutely fine in development, and the previous version was running fine in production, but this version is giving me a strange error when I try to run rails console
[10:19:34] Circuit8: https://gist.github.com/Circuit8/73650e8c1c8a154bd3f46f6d34711885
[10:19:44] Circuit8: Any help would be greatly appreciated :)
[10:20:33] VULNZ: sudo bundle install ?
[10:21:30] hirvi: heroku bundles on deploy.
[10:22:41] hirvi: Circuit8: can you show your sessions_controller.rb? or at least the first lines.
[10:24:23] Circuit8: hirvi: I've added it to the gist, thanks
[10:24:44] Circuit8: hirvi: I've also added the heroku error i get in the logs when I try to visit the app
[10:26:17] VULNZ: hirvi hey! did not work
[10:26:45] VULNZ: hirvi Extracted source (around line #76):
[10:26:54] VULNZ: require 'colorize'
[10:27:24] armyriad: has joined #RubyOnRails
[10:27:49] TvL2386: has joined #RubyOnRails
[10:30:15] pawnbox: has joined #RubyOnRails
[10:32:04] k3rn31: has joined #RubyOnRails
[10:38:40] alfiemax: has joined #RubyOnRails
[10:39:11] srinidhi: has joined #RubyOnRails
[10:41:33] Circuit8: Fixed it hirvi dont worry!
[10:44:09] ur5us: has joined #RubyOnRails
[10:46:09] k3rn31: has joined #RubyOnRails
[10:47:37] adre: has joined #RubyOnRails
[10:48:57] jtong: has joined #RubyOnRails
[10:56:34] allcentury: has joined #RubyOnRails
[10:59:04] artto: has joined #RubyOnRails
[11:02:22] jgt: has joined #RubyOnRails
[11:02:56] AlexJakeGreen: has joined #RubyOnRails
[11:05:26] basldex: has joined #RubyOnRails
[11:06:45] snoobydoo: has joined #RubyOnRails
[11:12:45] AmitT: has joined #RubyOnRails
[11:14:48] artto: has joined #RubyOnRails
[11:16:39] tvw: has joined #RubyOnRails
[11:17:06] lurch_: has joined #RubyOnRails
[11:20:11] Fernando-Basso: has joined #RubyOnRails
[11:21:20] darutoko: has joined #RubyOnRails
[11:21:35] moeabdol: has joined #RubyOnRails
[11:22:39] pawnbox: has joined #RubyOnRails
[11:23:49] AimlessRAven: has joined #RubyOnRails
[11:24:02] AimlessRAven: hi all, i have link, who go to pdf file
[11:24:13] AimlessRAven: ok but if i set data: { confirm: "text"}
[11:24:17] AimlessRAven: after click confirm
[11:24:22] AimlessRAven: link dont go to pdf page
[11:24:43] startupality: has joined #RubyOnRails
[11:24:54] marahin: http://hastebin.com/bawoguvara.coffee - can someone please explain why is the equasion returning false?
[11:25:47] rvanlieshout: marahin: cause object_id is different
[11:26:24] marahin: rvanlieshout, but the result (user) is the same for both of things. How can I properly check if it's true, then?
[11:26:30] hirvi: compare user id instead of object
[11:27:33] rvanlieshout: marahin: wiki.memberships.where(:admin => true).joins(:user).where(users: { id: User.first.id }).present?
[11:27:48] rvanlieshout: try to perform all logic in the db if possible
[11:28:01] marahin: rvanlieshout, whoah, what
[11:28:23] rvanlieshout: do you just want to know if that user is in the wiki's memberships?
[11:28:43] marahin: frankly, I just have a method on my model, that returns admin user (so the user with admin => true on the polymorphic Membership model)
[11:28:48] matthewd: That's not supposed to be false :/
[11:28:56] marahin: matthewd, that's what I thought
[11:29:27] marahin: let me explain better:
[11:29:33] matthewd: marahin: Rails version?
[11:30:03] matthewd: `User.first == User.first` is true, right?
[11:30:56] marahin: I have a Wiki model with polymorphic association to Memberships. Memberships contain admin (bool), user_id (int), membershipable_type and membershipable_id. I have a method in Wiki model - .admin - that _should_ return admin user (so I thought of self.memberships.where(:admin => true).try(:first).try(:user) ), and then in another method, .can?, which takes (action, user) arguments I want to compare given user object (user) with one self.admin
[11:31:19] marahin: matthewd, Rails 4.2.5.1
[11:32:13] rvanlieshout: marahin: if you need a user, always start with User
[11:32:38] rvanlieshout: User.joins(:memberships).where(memberships: { admin: true, wiki_id: self.id })
[11:32:47] marahin: rvanlieshout++, so it would be some kind of User.find( self.memberships.where(:admin => true).try(.....) ) :)?
[11:32:50] marahin: oh, that way.
[11:32:54] marahin: damn I have a lot to learn
[11:33:07] marahin: I will check that out in a sec
[11:33:21] marahin: but... uh.
[11:33:24] matthewd: user.memberships.find_by(wiki_id: wiki).try(:admin?)
[11:33:50] marahin: As far as I've heard, it's not a good thing to mix models (so using User constant in Wiki model method?)
[11:33:53] rvanlieshout: marahin: if you include try.try.try you're performing all kinds of logic in ruby where the db can handle it
[11:34:06] rvanlieshout: marahin: but you want that method to return a user
[11:34:10] rvanlieshout: so that's what it's supposed to do
[11:35:04] marahin: rvanlieshout, and you are completely correct with the logic - somehow I didnt think of delegating those to activerecord calls
[11:35:14] marahin: let me see if it works now :)
[11:35:29] matthewd: So, I still don't see why the equality wouldn't work, but agree it's not the right choice here anyway
[11:36:15] blackmesa: has joined #RubyOnRails
[11:36:39] rvanlieshout: marahin: that's because of the object_id
[11:36:46] marahin: matthewd * ^
[11:37:22] marahin: rvanlieshout, seems to be working. Thank you! :)
[11:37:32] ldnunes: has joined #RubyOnRails
[11:37:34] rvanlieshout: you're welcome
[11:38:11] jgt: has joined #RubyOnRails
[11:38:40] hirvi: did a bit of testing and users should equal true even with different object ids. weird.
[11:40:18] hirvi: http://hastebin.com/awelaroxel.coffee
[11:41:33] marahin: btw, rvanlieshout
[11:41:38] marahin: where(memberships: { admin: true, wiki_id: self.id })
[11:41:56] marahin: what's wiki_id in this case (and why is it wiki_id), assuming we have membershipable_id and membershipable_type, no wiki_id there?
[11:42:10] rvanlieshout: oh. i forgot about the polymorphic stuff
[11:42:15] matthewd: rvanlieshout: AR::Base#== doesn't use the object_id
[11:42:18] rvanlieshout: then where membershipable_id: id, membershipable_type: 'wiki'
[11:42:28] rvanlieshout: matthewd: as one would expect. awesome
[11:42:59] Guest_: has joined #RubyOnRails
[11:44:01] dionysus69: has joined #RubyOnRails
[11:46:08] marahin: in controller's before_filter - what is the best way to access name of the action user requested to access?
[11:46:44] marahin: controller.action_name doesn't work (undefined local variable or method `controller')
[11:47:34] matthewd: marahin: `action_name` will have the answer... but that's rarely a thing you should actually be doing
[11:47:48] marahin: params.action_name? (The params hash will always contain the :controller and :action keys, but you should use the methods controller_name and action_name instead to access these values.)
[11:48:06] Fernando-Basso: has joined #RubyOnRails
[11:48:13] marahin: matthewd, well as I mentioned before: due to a lot of issues with authorizing access to different actions on Wikis, I had to create a method .can? on the Model
[11:48:43] marahin: and in order to check if _user_ can access _action_ on Wiki, I want to do ' @wiki.can?( action, user ) ' in before_filter to certain, potentially harmful actions
[11:48:53] rodfersou: has joined #RubyOnRails
[11:48:55] marahin: (seems like a relatively good approach?)
[11:49:21] marahin: by 'issues with authorizing' I mean various combinations for various Wiki privacy settings, and the occuring model relations
[11:50:41] jtong: has joined #RubyOnRails
[11:51:37] mdw: has joined #RubyOnRails
[11:52:24] snoobydoo: has joined #RubyOnRails
[11:53:29] marahin: got it - action_name works just fine
[11:54:15] arBmind: has joined #RubyOnRails
[11:58:37] rails45: has joined #RubyOnRails
[11:59:59] rails45: how can i format user.last_sign_in_at?
[12:00:07] rails45: i tried @user.last_sign_in_at("%H:%M, %d %B") but that isn't working
[12:01:27] marahin: @user.last_sign_in_at.strftime(whatyouwrote)?
[12:01:33] marahin: rails45, ^
[12:01:39] rvanlieshout: rails45: I18n.localize(@user.last_sign_in_at)
[12:01:42] rvanlieshout: rails45: I18n.localize(@user.last_sign_in_at, format: :foobar)
[12:02:15] emachnic: has joined #RubyOnRails
[12:04:07] kedare1: has joined #RubyOnRails
[12:04:15] sergio_101: has joined #RubyOnRails
[12:04:23] mdw7: has joined #RubyOnRails
[12:06:49] rails45: @rvanlieshout is localize supposed to convert to local time zone?
[12:07:00] christianrojas: has joined #RubyOnRails
[12:07:06] rvanlieshout: rails45: that would be part of your config/application.rb
[12:07:13] rvanlieshout: set app time zone there
[12:07:56] mercerist: has joined #RubyOnRails
[12:08:00] rails45: but what if i want the time zone to change depending on the location of users?
[12:09:02] rails45: @rvanlieshout is that possible?
[12:09:09] rvanlieshout: then you'll have to convert it there
[12:09:21] rvanlieshout: I18n.localize(@user.last_sign_in_at.in_time_zone('FOOBAR'))
[12:10:42] FastJack_: has joined #RubyOnRails
[12:13:08] jhass: has joined #RubyOnRails
[12:14:10] truenito: has joined #RubyOnRails
[12:14:45] GodFather: has joined #RubyOnRails
[12:17:13] snowy: has joined #RubyOnRails
[12:18:14] conta: has joined #RubyOnRails
[12:18:14] pydave6367: has joined #RubyOnRails
[12:18:42] bbrowning: has joined #RubyOnRails
[12:19:07] fmcgeough: has joined #RubyOnRails
[12:21:31] conta: so I have STI: Product(Payment, Transport). Problem is that I have also Payment(CashPayment,CardPayment). When I call Payment.all I am not getting Cash and Card payments, but only those who are Payment
[12:21:32] artto: has joined #RubyOnRails
[12:22:08] conta: But if I call first CashPayment.all and then Payment.all, Payment.all will include CashPayments as well
[12:23:58] rvanlieshout: that's because STI sucks
[12:24:14] matthewd: conta: http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoloading-and-sti
[12:25:06] oystersauce8: has joined #RubyOnRails
[12:26:30] conta: matthewd: thanks, checking it right now
[12:28:52] dannyguk: has joined #RubyOnRails
[12:29:04] Axilla: has joined #RubyOnRails
[12:32:03] jhass: has joined #RubyOnRails
[12:33:38] conta: matthewd: worked like a charm! many thanks, I was googling for long time but couldn't find it
[12:33:40] franzip: has joined #RubyOnRails
[12:35:44] rails45: has joined #RubyOnRails
[12:36:02] Kingdutch: If I have a user that has_many addresses, what would the relation be for a subscription to have a billing and a shipping address to point to one of the address? So an address belongs_to one user but could also belong to many subscriptions?
[12:36:20] JakFrist: has joined #RubyOnRails
[12:37:32] jgt: has joined #RubyOnRails
[12:37:47] rails45: https://gist.github.com/anonymous/647d4c683ebcae780a859d8749d67162
[12:37:51] rails45: can someone take a look?
[12:38:09] conta: Kingdutch look into polymorphic associations
[12:39:51] nettoweb: has joined #RubyOnRails
[12:40:10] pawnbox: has joined #RubyOnRails
[12:40:55] Kingdutch: conta: I have Address set up as a polymorphic belongs_to :addressable. The problem is then that the reference is stored within Address so the same address can't belong to both a user and a subscription at the same time. I thought about user has_many addresses through subscriptions but that would require the user to have a subscription to have an address which is not true.
[12:41:57] Kingdutch: Typing it out like that, would that mean that the subscription belongs to an address which the user owns and the subscription also belongs to a user? That actually makes sense now I think about it ^^' somehow I thought the subscription should have an address but it actually belongs to one.
[12:42:22] Kingdutch: Sorry for thinking out loud but thanks for helping : )
[12:42:59] GarethAdams: has joined #RubyOnRails
[12:43:17] snoobydoo: has joined #RubyOnRails
[12:43:20] conta: do you have address belongs_to :addressable, polymorphic: true?
[12:45:40] edwinvdgraaf: has joined #RubyOnRails
[12:46:10] fermonkus: has joined #RubyOnRails
[12:46:27] Psy-Q: has joined #RubyOnRails
[12:47:22] bruce_lee: has joined #RubyOnRails
[12:49:18] conta: I was doing something similar
[12:49:43] conta: I had asset that had attachments and that could be to page or product
[12:50:20] conta: asset was has_many :attachements
[12:50:20] conta: has_many :pages, through: :attachements, source: :attachable, source_type: 'Page'
[12:50:21] conta: has_many :products, through: :attachements, source: :attachable, source_type: 'Product'
[12:50:53] conta: attachment was: belongs_to :attachable, polymorphic: true
[12:50:53] conta: belongs_to :asset
[12:51:18] conta: and page: has_many :attachments, as: :attachable
[12:51:18] conta: has_many :assets, through: :attachments
[12:51:33] conta: that way same asset could be on page and also on product
[12:52:36] sk0r: has joined #RubyOnRails
[12:56:55] emachnic: has joined #RubyOnRails
[12:57:09] ramortegui: has joined #RubyOnRails
[13:02:37] evansbee: has joined #RubyOnRails
[13:04:41] snowy: has joined #RubyOnRails
[13:05:22] dionysus69: has joined #RubyOnRails
[13:08:24] arup_r: has joined #RubyOnRails
[13:09:20] franzip: has joined #RubyOnRails
[13:10:18] flashpoint9: has joined #RubyOnRails
[13:10:37] cgfbee: has joined #RubyOnRails
[13:10:44] FernandoBasso: has joined #RubyOnRails
[13:11:03] ybart: has joined #RubyOnRails
[13:11:38] lurch_: has joined #RubyOnRails
[13:11:41] greg: has joined #RubyOnRails
[13:12:12] greg: is there any way to create multiple object without using nested form?
[13:12:59] ybart: General question. Any recommendation for reading material about scaling Rails projects by breaking it up in modular parts? I'm particularly interested in the case where models perhaps should be shared.
[13:13:16] greg: michecl hatl
[13:13:42] sk0r: has joined #RubyOnRails
[13:14:45] greg: anyone here please solve my query...
[13:14:57] k3dare: has joined #RubyOnRails
[13:15:12] lupine: _bart: I've seen more than one presentation arguing that you shouldn't :3 but I certainly would
[13:15:55] ybart: lupine: I know it's a much debated question, I just wonder how to deal with the models, when the module isn't only based on arguments passed in a query. Any thoughts on that?
[13:16:08] jhass: greg: unsolicited highlights to draw attention to a question, especially if I wasn't active in the channel for a couple of hours, makes me just ignore you. gl
[13:16:13] startupality: has joined #RubyOnRails
[13:16:41] lupine: _bart: I can't really parse that, sorry
[13:17:51] greg: jhass: will you please help[ me
[13:17:56] aegis3121: has joined #RubyOnRails
[13:18:25] ybart: lupine: Let's say a complete rails project does many different things, and a seperate rails project purely for analysis of data is made, which uses exactly the same models/database as the big rails project. How would you deal with the models being in 2 different projects?
[13:18:47] Fernando-Basso: I need to provide a button/link that when clicked will download two files. send_data can be used only once for request. What approach could be used here?
[13:19:17] Fernando-Basso: My first idea was to use ajax and generate two separate requests when the user clicks the download link.
[13:19:18] srinidhi: has joined #RubyOnRails
[13:19:19] ybart: lupine: I can imagine that sometimes you can have a module that only depends on an argument, let say a module that squares its argument, you just pass it a number from the main rails project. But what if the module needs the models to do its job.
[13:19:34] lupine: _bart: fundamentally it's about loading the code. you can split the models out into a common gem, could even use rails engines or whatever they're called now
[13:19:37] Fernando-Basso: Zipping the two files is not desirable in this case.
[13:19:50] lupine: TBH though I would not expect there to be much overlap in requirements between the two domains
[13:20:15] lupine: being the same database is not hte same as being the same domain. each codebase has very different questions it wants to ask of that data
[13:20:39] lupine: for the sake of a few has_many calls, I wouldn't necessarily be fussed about sharing codebase
[13:21:47] ybart: lupine: so what do you suggest? Duplicate models where necessary?
[13:22:01] lupine: I wouldn't rule it out, certainly
[13:22:07] lupine: the rails engine code sharing is another option
[13:22:21] lupine: as is just futzing load paths
[13:22:39] lupine: as is keeping the analytics in the same codebase as the customer project
[13:22:49] roamingdog: has joined #RubyOnRails
[13:22:53] lupine: it doesn't have run on the same machine, or be the same process
[13:23:32] ybart: that's true, but seperate codebases have their advantages too
[13:23:49] ybart: separate*
[13:24:10] ybart: I will look into rails engines though
[13:26:02] chintanparikh: has joined #RubyOnRails
[13:26:37] artto: has joined #RubyOnRails
[13:27:03] roelof: has joined #RubyOnRails
[13:28:04] oystersauce8: can you guys see this message
[13:28:09] ybart: oystersauce8: yep
[13:28:19] macsteps: has joined #RubyOnRails
[13:28:25] mdw7: hey people
[13:28:36] startupality: has joined #RubyOnRails
[13:28:42] mdw7: I have a simple uniqueness validation on my User's username
[13:28:43] tknz: has joined #RubyOnRails
[13:28:43] mdw7: https://gist.github.com/mattsrobot/fe1b5186c42ed9934b9b09a50201753d
[13:29:08] mdw7: I'm wondering, do I need to add anything further in the migration to enforce case insensitive uniqueness?
[13:29:35] arup_r: mdw_: ur native dbms is?
[13:29:47] jancel: has joined #RubyOnRails
[13:29:47] mdw7: postgres
[13:30:05] GreatDanton: has joined #RubyOnRails
[13:30:15] roelof: It is possible to make this work (https://gist.github.com/rwobben/6c37e7c3ad99a90b74a62818adfe73bf) without using the show template and the show function in a controller ?
[13:30:19] xibalba: has joined #RubyOnRails
[13:30:24] snowy: has joined #RubyOnRails
[13:30:41] wethu: has joined #RubyOnRails
[13:31:37] tbuehlmann: roelof: I don't understand the question, can you elaborate?
[13:31:56] arup_r: mdw_: something in internet https://www.postgresql.org/message-id/c57a8ecec259afdc4f4caafc5d0e92eb@mitre.org ... but AR validation is fine I think.. :)
[13:32:55] mdw7: arup_r thanks
[13:33:08] JakFrist: has joined #RubyOnRails
[13:33:17] roelof: tbuehlmann: I will try , normally when you use a form , you use create and show.
[13:33:32] roelof: I want to use create and index as actions on a form
[13:34:55] ybart: roelof: redirect_to @account will redirect to show, but you want to redirect to index?
[13:35:41] roelof: _bart , yes, I want to do that
[13:35:44] ybart: roelof: that way you will never need the show template or function
[13:35:46] sypheren: has joined #RubyOnRails
[13:35:57] roelof: _bart : exactly
[13:36:50] ybart: roelof: so I guess you know the answer yourself now right? :) Just change that line to redirect to the index path instead of the account specific page
[13:37:03] ybart: roelof: and make sure you display the flash notice in the index view
[13:37:45] roelof: oke, so I need to change it to accounts_index_path ?
[13:38:11] ybart: roelof: just try it
[13:38:21] machinewar: has joined #RubyOnRails
[13:38:50] allcentury: has joined #RubyOnRails
[13:39:23] tbuehlmann: mdw_: I highly recommend having db constraints in addition to AR validations
[13:39:48] mdw7: tbuehlmann thanks! I looked at this
[13:39:48] mdw7: add_index :users, :username, :unique => true
[13:40:00] machinewar: is anyone familiar with Memcached + Rails. Trying to find a way to access the configured URL at runtime
[13:40:06] mdw7: just double checking if it's case insensitive though
[13:40:29] mustmodify_: has joined #RubyOnRails
[13:40:37] machinewar: Thinking of something like this but not sure Rails.application.config.cache_store.some_attribute or method
[13:40:45] moty66: has joined #RubyOnRails
[13:41:06] tbuehlmann: mdw_: have a look at this: http://shuber.io/porting-activerecord-validations-to-postgres/
[13:41:16] mustmodify_: I have a situation where users try to get a resource as an SVG file... if they aren't authenticated, they won't see it. Should I redirect to a padlock asset or render it inline?
[13:41:32] mshowman: has joined #RubyOnRails
[13:41:51] mdw7: tbuehlmann thankyou! I might enforce a lowercase username in before save, maybe that's simpler.
[13:44:57] roelof: _bart : you mean the line in the controller ?
[13:45:48] maxx88: has joined #RubyOnRails
[13:46:17] xpl0iter: has joined #RubyOnRails
[13:46:20] Mia: has joined #RubyOnRails
[13:46:20] Mia: has joined #RubyOnRails
[13:46:35] flashpoint9: has joined #RubyOnRails
[13:46:55] Axilla: morning all, i'm working on creating public profiles in a application i'm working on, quick question. I was thinking of just making it short and sweet and making to_param use users name.parameterize to display the public profile for show, but how can I prevent two common names from causing problems; ie John Smith
[13:47:17] yellow5: has joined #RubyOnRails
[13:47:37] mustmodify_: which I guess would be something like "format.svg { redirect_to asset_path 'padlock.svg' }" vs "format.svg { render file: '/app/assets/padlock.svg' }
[13:47:51] xpl0iter: My action new in http://pastie.org/private/ssuqdqlgfw51hrzstynow is loading the application layout, no matter what I do. I have given the layout only tag at the beginning, Can someone please help me to find the issue?
[13:47:55] roelof: when I do this : redirect_to @accounts_path I see this error message : Cannot redirect to nil!
[13:48:06] Axilla: mustmodify_: i'd redirect to login
[13:48:08] Axilla: or signup
[13:48:09] FCser: has joined #RubyOnRails
[13:48:16] macsteps: has joined #RubyOnRails
[13:48:17] Axilla: and use it as a situation to get signups :)
[13:49:00] Axilla: if they're not authenticated their logical step would be to authenticate so they can do whatever it is they wanted to do.
[13:49:23] mustmodify_: axilla: That's what happens now. Unfortunately it's embedded as an svg in another app so it results in an iframe that covers like 200x120
[13:49:26] roelof: and this are my routes : https://gist.github.com/rwobben/370bb23b4a85ecc7792d223ca1b7b370
[13:49:41] xpl0iter: Can someone please tell me why it still uses the application layout?
[13:49:57] roelof: Can someone help me to redirect to the index page ?
[13:50:13] xpl0iter: roelof, redirect_to root_url?
[13:50:48] Axilla: roleof redirect_to accounts_index_path
[13:51:28] Axilla: or accounts_path
[13:51:35] Axilla: you seem to have two accounts index routes
[13:51:45] Axilla: accounts_index and accounts
[13:51:57] dkam: has joined #RubyOnRails
[13:52:01] Axilla: you don't want to do @
[13:52:03] allcentury: has joined #RubyOnRails
[13:52:10] Axilla: that's an instance variable and is obviously nil
[13:52:33] roelof: Solved : I had to use this redirect_to accounts_path instead of redirect_to @accounts_path
[13:52:56] Axilla: yea, that's what i said
[13:53:05] Axilla: you would do redirect_to account_path(@account)
[13:53:08] Axilla: if you were doing a show
[13:53:14] Axilla: where @account is an instantiated object of an account
[13:53:24] Axilla: ie @account = Account.all.first
[13:53:40] Axilla: or Account.find_by(email: 'foo') or anything else
[13:53:42] roelof: axilla: then I apolize that I misunderstood you
[13:54:17] Axilla: you should cleanup your routes
[13:54:23] Axilla: you don't need those account_index account_create routes
[13:56:59] roelof: Which routes do I need to create and update accounts ?
[13:57:03] kitsuneyo: has joined #RubyOnRails
[13:57:25] kitsuneyo: what does this mean, specifically the end part: "Rendered places/subdivisions/update_subdivs.js.coffee within layouts/application"
[13:57:47] kitsuneyo: i had this problem once before when i name a layout .haml instead of .html.haml
[13:58:09] kitsuneyo: i'm not sure what is causing the "within layouts/application" part this time
[13:58:34] rueben: has joined #RubyOnRails
[13:58:56] blackmesa: has joined #RubyOnRails
[14:01:28] tbuehlmann: roelof: I highly recommend reading and understanding http://guides.rubyonrails.org/routing.html
[14:02:37] soroot: has joined #RubyOnRails
[14:02:50] kitsuneyo: ok i guess that was the problem again lol
[14:03:42] roelof: tbuehlmann: thanks, I will do that in the next time
[14:06:08] artto: has joined #RubyOnRails
[14:08:43] terrabl: has joined #RubyOnRails
[14:09:24] mustmodify_: has left #RubyOnRails: ()
[14:10:38] terrabl: Hello, at the moment I am attempting to create a form that has nested objects, for example if someone wants to input more than one type of food they can click an add button that would create a new row, I would like to store this in a mongo database as an array of different objects but I do not understand how to created nested form objects nor do I know how to store an array of objects intoa mongoDB from rails.
[14:10:41] chouhoulis: has joined #RubyOnRails
[14:12:58] terrabl: If someone could point me in the right directrion of doing either of these thigns ti would be great
[14:19:32] augcesar: has joined #RubyOnRails
[14:20:04] oystersauce8: any reason for using mongo? more of us will be able to help you if you switch to a more traditional DB
[14:20:29] oystersauce8: Sometime ago I came across a website that does something like jsfiddle/codepen, but for rails apps.
[14:20:29] oystersauce8: So using just your browser, you can mount a rails app, fiddle with its front and back end, for demos and experiments.
[14:20:29] oystersauce8: I forgot to note down the url of that website, does anyone know which url it exists at ?
[14:20:41] dionysus69: has joined #RubyOnRails
[14:21:09] ybart: roelof: you should also run "rake routes", which will show you all the routes (which is also in the documentation)
[14:21:48] dstarh: has joined #RubyOnRails
[14:22:19] ksoze: has joined #RubyOnRails
[14:26:06] jscheel: has joined #RubyOnRails
[14:26:28] pawnbox: has joined #RubyOnRails
[14:30:22] wd40s: has joined #RubyOnRails
[14:31:56] terrabl: Yeah I just have to use mongo for the project I'm working on. It's good but their isnt much documentation on it.
[14:32:24] lurch_: has joined #RubyOnRails
[14:33:42] sid_fules: has joined #RubyOnRails
[14:35:10] arup_r: has joined #RubyOnRails
[14:35:36] jhack: has joined #RubyOnRails
[14:36:06] prithaj: has joined #RubyOnRails
[14:36:27] ur5us: has joined #RubyOnRails
[14:36:35] terrabl: I also could just store the form data as a json and send it to mongo that way. I think that would be the best way but I still have to figure out how to created nested objects...
[14:36:51] emachnic: has joined #RubyOnRails
[14:38:24] artto: has joined #RubyOnRails
[14:40:29] christianrojas: has joined #RubyOnRails
[14:41:07] rafaelfranca: has joined #RubyOnRails
[14:41:39] yardenbar: has joined #RubyOnRails
[14:43:07] melonstorm: has joined #RubyOnRails
[14:43:14] frem_: has joined #RubyOnRails
[14:43:50] pawnbox: has joined #RubyOnRails
[14:44:02] tjohnson: has joined #RubyOnRails
[14:45:12] mercerist: has joined #RubyOnRails
[14:52:15] yellow5: has joined #RubyOnRails
[14:54:29] eserror: has joined #RubyOnRails
[14:55:14] Oliphaunte: has joined #RubyOnRails
[14:56:29] siaw23: has joined #RubyOnRails
[14:57:54] polishdub: has joined #RubyOnRails
[15:00:58] agent_white: has joined #RubyOnRails
[15:01:06] swap_a_b: has joined #RubyOnRails
[15:01:08] allcentury: has joined #RubyOnRails
[15:02:02] startupality: has joined #RubyOnRails
[15:02:56] chouhoulis: has joined #RubyOnRails
[15:03:13] rakm: has joined #RubyOnRails
[15:03:45] xhoy: good morning
[15:06:35] jhack: has joined #RubyOnRails
[15:06:44] moeabdol: has joined #RubyOnRails
[15:09:46] lictor36: has joined #RubyOnRails
[15:10:42] eGGshke: has joined #RubyOnRails
[15:11:37] alexandernst: has joined #RubyOnRails
[15:12:53] artto: has joined #RubyOnRails
[15:13:59] moeabdol: has joined #RubyOnRails
[15:14:29] alexandernst: What is the difference between "has_many :services, :dependent => :destroy" and "has_many :services, dependent: :destroy" ?
[15:15:01] Long: has joined #RubyOnRails
[15:15:01] emachnic: has joined #RubyOnRails
[15:15:03] rails45: has joined #RubyOnRails
[15:15:04] chintanparikh: alexandernst: Nothing
[15:15:16] chintanparikh: It's just different syntax for the same thing. The hashrocket is older syntax
[15:16:03] chintanparikh: :foo => bar is the exact same as doing foo: bar
[15:16:21] rails45: = pluralize(@errors.count, "error") <-- I'm getting an "undefined method `count' for nil:NilClass" in this line
[15:16:31] rails45: isn't count supposed to be a built in method?
[15:16:32] chouhoul_: has joined #RubyOnRails
[15:16:32] alexandernst: chintanparikh: I see
[15:16:53] jhass: rails45: not for nil
[15:17:26] rails45: @jhass how should i go about fixing this?
[15:17:36] jhass: make sure @errors is not nil
[15:17:40] tvw: has joined #RubyOnRails
[15:18:27] alexandernst: chintanparikh: What about " services.not_archived.all? { |s| s.archivable? } " and " services.not_archived.all?(&:archivable?) " ?
[15:18:32] rails45: @jhass i'm getting the error when there IS an error. it works fine otherwise
[15:18:49] jhass: rails45: your error message proves otherwise
[15:19:14] chouhoul_: has joined #RubyOnRails
[15:21:10] rails45: @jhass If I specify something like "validates :title, presence: true" in a model, it throws an error when title is left blank right?
[15:21:21] rails45: I get the "undefined method `count' for nil:NilClass" error when I leave the title blank
[15:21:37] jhass: then you don't set @errors in that case
[15:21:40] GodFather: has joined #RubyOnRails
[15:22:04] siaw23: hello. can someone please help me? I get an error running migration and i’m not sure why. i have the error, schema and the migration in question here: https://gist.github.com/siaw23/76c0d46c04d278c7553e9e86141cf793
[15:23:21] chintanparikh: has joined #RubyOnRails
[15:23:29] christianrojas: has joined #RubyOnRails
[15:23:30] Axilla: you're not setting @errors it's nil @errors isn't a helper method its an instance variable of errors that you set
[15:23:30] rails45: @jhass ahh yes it's working now. thanks!
[15:23:31] jhass: relation "index_copyrighted_urls_on_url" does not exist
[15:23:41] jhass: quite clear to e siaw23
[15:23:51] Axilla: anything that starts w/ @ is a object of data you set
[15:24:31] siaw23: jhass: i’m a bit confused because i did this before and didn’t get index_copyrighted_urls_on_url
[15:24:36] Axilla: rails45: what you're looking for is @foo.errors
[15:24:50] moeabdol: has joined #RubyOnRails
[15:24:54] Axilla: so @title.errors or whatever you're trying to validate
[15:25:06] jhass: siaw23: well then you probably already successfully renamed it, got an error later and now run into it not existing anymore
[15:25:14] siaw23: jhass: i mean i’m a bit confused because i did this before and didn’t get index_copyrighted_urls_on_url doesn’t exist ” error
[15:25:43] siaw23: jhass: which means i can remove that migration right?
[15:25:52] jhass: I can't tell
[15:26:22] siaw23: jhass: i’m even more confused because i dropped the db and created it again. which means it shold start from scratch as far as i understand
[15:26:47] jhass: siaw23: I said all there's to say from the information available
[15:27:19] disgrntld: has joined #RubyOnRails
[15:30:45] moeabdol: has joined #RubyOnRails
[15:30:46] evansbee: has joined #RubyOnRails
[15:32:21] fermonkus: has joined #RubyOnRails
[15:35:32] siaw23: jhass: rake db:schema:load fixes it
[15:35:32] Moeh: has joined #RubyOnRails
[15:35:48] Guest31_: has joined #RubyOnRails
[15:36:04] xall: has joined #RubyOnRails
[15:36:47] nettoweb: has joined #RubyOnRails
[15:37:36] rafaelfr_: has joined #RubyOnRails
[15:38:43] Jenzo: has joined #RubyOnRails
[15:39:01] guidocalvano: has joined #RubyOnRails
[15:39:11] Jenzo: What am I doing wrong in this coding?
[15:39:13] Jenzo: # boolean_1 = 77 < 78 && 77 < 77
[15:39:13] Jenzo: boolean_1 = true && true => true
[15:39:13] Jenzo: # boolean_2 = true && 100 >= 100
[15:39:13] Jenzo: boolean_2 = true && true # => true
[15:39:13] Jenzo: # boolean_3 = 2**3 == 8 && 3**2 == 9
[15:39:14] Jenzo: boolean_3 = false && false # => false
[15:40:08] jhass: 77 is not lower than 77
[15:40:48] Jenzo: thanks let me modify that
[15:40:56] jhass: 2**3 is 8
[15:40:59] matthewd: !gist please
[15:40:59] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:41:02] jhass: 3**2 is 9
[15:41:13] emachnic: has joined #RubyOnRails
[15:41:21] Jenzo: Oops, try again. Make sure to type true or false after each =!
[15:41:21] k3rn31: has joined #RubyOnRails
[15:41:58] smathy: has joined #RubyOnRails
[15:42:08] Jenzo: I found the error missed the #
[15:43:02] jhass: Jenzo: !rule12
[15:43:02] helpa: Jenzo: Do not PM members of the channel without first asking if that is OK.
[15:43:03] dkam: has joined #RubyOnRails
[15:43:15] Jenzo: It works now
[15:43:16] Jenzo: # boolean_1 = 77 < 78 && 77 < 77
[15:43:16] Jenzo: boolean_1 = true && false # => false
[15:43:16] Jenzo: # boolean_2 = true && 100 >= 100
[15:43:16] Jenzo: boolean_2 = true && true # => true
[15:43:17] Jenzo: # boolean_3 = 2**3 == 8 && 3**2 == 9
[15:43:17] Jenzo: boolean_3 = true && true # => true
[15:43:36] jhass: Jenzo: !rule7
[15:43:36] helpa: Jenzo: Anything more than 2 lines goes in a Gist (http://gist.github.com) or a Pastie (http://pastie.org). Spamming the channel with walls of text is not welcome.
[15:43:43] Jenzo: What is the double ** mean?
[15:43:56] jhass: http://devdocs.io/ruby~2.3/fixnum#method-i-2A-2A
[15:44:02] moeabdol: has joined #RubyOnRails
[15:44:18] dstarh: has joined #RubyOnRails
[15:44:41] artto: has joined #RubyOnRails
[15:47:25] diegoviola: has joined #RubyOnRails
[15:47:33] [Butch]: has joined #RubyOnRails
[15:47:59] jgt: has joined #RubyOnRails
[15:52:05] alfiemax: has joined #RubyOnRails
[15:56:33] danostrowski: has joined #RubyOnRails
[15:57:31] kitsuneyo: has joined #RubyOnRails
[16:01:23] whathappens: has joined #RubyOnRails
[16:02:34] zave: has joined #RubyOnRails
[16:11:51] jetpackjoe: has joined #RubyOnRails
[16:12:18] snoobydoo: has joined #RubyOnRails
[16:13:12] soroot: has joined #RubyOnRails
[16:14:36] davidw: has joined #RubyOnRails
[16:14:36] gingray: has joined #RubyOnRails
[16:14:36] fermonkus: has joined #RubyOnRails
[16:14:39] roamingdog: has joined #RubyOnRails
[16:15:36] choke: has joined #RubyOnRails
[16:16:22] artto: has joined #RubyOnRails
[16:19:19] dkam: has joined #RubyOnRails
[16:19:42] blackmesa: has joined #RubyOnRails
[16:22:43] Jenzo: Am I doing this correctly?
[16:22:45] Jenzo: https://gist.github.com/anonymous/befb769cf3274b3bfc9f4bc055a57c68
[16:23:09] braincrash: has joined #RubyOnRails
[16:24:09] alfiemax: Jenzo, i think this is a question to be asked in #ruby
[16:25:26] jancel: has joined #RubyOnRails
[16:28:07] mdw: has joined #RubyOnRails
[16:30:16] smathy: Jenzo, no, you're meant to be just setting the var to true or false.
[16:31:17] smathy: ...I mean you effectively are setting 1 and 3 to true and 2 to false, but the idea is just to give the final answer of what you believe the commented expression will evaluate to.
[16:32:12] flashpoint9: has joined #RubyOnRails
[16:32:54] chouhoulis: has joined #RubyOnRails
[16:33:55] cschneid: has joined #RubyOnRails
[16:35:24] emachnic: has joined #RubyOnRails
[16:37:51] arBmind: has left #RubyOnRails: ()
[16:37:56] jxs_: has joined #RubyOnRails
[16:38:03] aegis3121: has joined #RubyOnRails
[16:38:11] arBmind: has joined #RubyOnRails
[16:38:24] jorrin: has joined #RubyOnRails
[16:38:51] braincrash: has joined #RubyOnRails
[16:40:24] pilne: has joined #RubyOnRails
[16:40:45] noodle: has joined #RubyOnRails
[16:40:46] kitsuneyo: has joined #RubyOnRails
[16:41:48] allcentury: has joined #RubyOnRails
[16:44:48] moeabdol: has joined #RubyOnRails
[16:46:37] banister: has joined #RubyOnRails
[16:46:42] manfrin: has joined #RubyOnRails
[16:47:10] codesoda: has joined #RubyOnRails
[16:48:25] chintanparikh: has joined #RubyOnRails
[16:48:43] rafaelfranca: has joined #RubyOnRails
[16:48:43] rafaelfranca: has joined #RubyOnRails
[16:51:29] eserror: has joined #RubyOnRails
[16:52:21] hardtail: has joined #RubyOnRails
[16:54:05] marr: has joined #RubyOnRails
[16:55:43] dkam: has joined #RubyOnRails
[17:00:18] jsownz: has joined #RubyOnRails
[17:04:40] mercerist: has joined #RubyOnRails
[17:06:41] Axilla: i don't usually use gems if i can help it, but i'm really happy with friendly_id for vanity URLs... extremely simple to get working just the way I wanted to create public profiles :D
[17:07:21] rogue_koder: has joined #RubyOnRails
[17:07:49] hahuang62: has joined #RubyOnRails
[17:11:50] hahuang65: has joined #RubyOnRails
[17:17:25] yellow5: has joined #RubyOnRails
[17:17:51] mdw7: has joined #RubyOnRails
[17:19:29] GodFather: has joined #RubyOnRails
[17:22:44] jtong: has joined #RubyOnRails
[17:22:46] Pharaoh2: has joined #RubyOnRails
[17:25:30] alfiemax: axilla, but really a pain when there are duplicates
[17:30:18] banister: has joined #RubyOnRails
[17:31:10] hardtail: has joined #RubyOnRails
[17:31:18] Jenzo: ok thanks smathy
[17:32:28] dkam: has joined #RubyOnRails
[17:32:38] wolfravenous: has joined #RubyOnRails
[17:33:32] GodFather: has joined #RubyOnRails
[17:34:13] Pazician: has joined #RubyOnRails
[17:34:14] Pazician: has joined #RubyOnRails
[17:35:57] chouhoulis: has joined #RubyOnRails
[17:37:06] dannyguk: has joined #RubyOnRails
[17:38:32] truenito: has joined #RubyOnRails
[17:42:14] whathapp_: has joined #RubyOnRails
[17:43:16] adre: has joined #RubyOnRails
[17:43:40] whathapp_: has joined #RubyOnRails
[17:44:15] whathapp_: has joined #RubyOnRails
[17:44:34] GodFather: has joined #RubyOnRails
[17:45:31] whathappens: has joined #RubyOnRails
[17:48:27] jhack: has joined #RubyOnRails
[17:49:46] jiblet: has joined #RubyOnRails
[17:51:30] jiblet: Hey so I'm using the ruby select method on an activerecord relation, and I get a nice array of the db entries that I want, however the codebase Im working on needs an activerecord realtion? is there anyway I can have the select return a realtion instead of an array? or do I have to rewrite my select in sql?
[17:51:52] syndikate: has joined #RubyOnRails
[17:52:02] alfiemax: jiblet, your current code?
[17:52:17] blackmesa: has joined #RubyOnRails
[17:52:28] syndikate: Hello people, I am trying to pass a variable with double quotes onto a view, but the view is having problem rendering it. I tried using html_safe, still no good, any tips?
[17:52:28] jiblet: geo_restricted_cards, non_geo_restricted_cards = avail.partition { |e| e.gift_card_vendor.geo_restricted }
[17:52:42] jiblet: *I meant partition ,I was using select before
[17:52:49] alfiemax: jiblet, http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-select
[17:53:20] k3rn31: has joined #RubyOnRails
[17:53:24] jiblet: I read that already, it looks liek it will always return an array
[17:53:59] DoctorMonocular: has joined #RubyOnRails
[17:54:00] jiblet: and that I must rewrite my code in sql if I need an activerecord relation
[17:54:17] jhack: has joined #RubyOnRails
[17:55:17] GodFather: has joined #RubyOnRails
[17:55:26] Ergo: has joined #RubyOnRails
[17:55:35] jorrin2: has joined #RubyOnRails
[18:02:14] roamingdog: has joined #RubyOnRails
[18:02:48] artto: has joined #RubyOnRails
[18:07:49] jas02: has joined #RubyOnRails
[18:08:58] learner: has joined #RubyOnRails
[18:09:07] dkam: has joined #RubyOnRails
[18:11:45] learner: hey guys on this page https://github.com/coreyhaines/bawch/blob/episode2/spec/coderetreat_live/coderetreats_spec.rb lline 11, I want to write it the new way, is this a correct way: allow(CoderetreatLive::Coderetreats::Presenters::Collection).to receive(for: running_today).and_return(presenter)
[18:13:30] Leepoff: has joined #RubyOnRails
[18:15:38] Dimik: has joined #RubyOnRails
[18:18:23] flashpoint9: has joined #RubyOnRails
[18:18:48] axl_: has joined #RubyOnRails
[18:19:01] oystersauce8: has joined #RubyOnRails
[18:20:12] teaearlgraycold: has joined #RubyOnRails
[18:20:52] kgrz: has joined #RubyOnRails
[18:23:23] soroot: has joined #RubyOnRails
[18:24:47] rickmasta: has joined #RubyOnRails
[18:25:19] whathappens: has joined #RubyOnRails
[18:26:47] evansbee: has joined #RubyOnRails
[18:29:08] jhack: has joined #RubyOnRails
[18:30:12] teaearlgraycold: has joined #RubyOnRails
[18:30:45] learner: ok nvm found the solution
[18:32:17] smathy: jiblet, yes, you must rewrite your code, or you could just do another query using the IDs from your array.
[18:32:40] AndrewCare: has joined #RubyOnRails
[18:33:52] rickmasta: has joined #RubyOnRails
[18:33:54] AndrewCare: Is there a way to get the text in a text_field in ruby? For example, I have some code that waits until a user is done typing and then it should get the text that is in that text box and make an HTTParty request to get the response and then produce that response on the page?
[18:35:25] smathy: andrew____, you would need to use JS to listen for either the blur event, or keypress with a timeout so you know when they've "finished typing", then fire off a request to your server via ajax.
[18:35:34] GodFather: has joined #RubyOnRails
[18:36:20] AndrewCare: I'm trying to avoid AJAX all together because of CORS issues...
[18:37:12] smathy: andrew____, there's only two choices: (1) the user submits a form/request to your server or (2) some JS submits to your server (which == ajax)
[18:37:25] rickmasta: has joined #RubyOnRails
[18:37:41] chopin: has joined #RubyOnRails
[18:37:41] AndrewCare: Alrighty I might need to tackle the higher level CORS issue I am having. Thanks though!
[18:37:52] dannyguk: has joined #RubyOnRails
[18:37:56] replay: has joined #RubyOnRails
[18:38:33] replay: has joined #RubyOnRails
[18:40:28] AndrewCare: Okay, I taclked the issue, how would I go about sending an AJAX request to rails to recieve the variable?
[18:41:49] hahuang62: has joined #RubyOnRails
[18:43:15] teaearlgraycold: has joined #RubyOnRails
[18:43:18] Cervajz: has joined #RubyOnRails
[18:44:21] context: "to recieve the variable"
[18:44:33] context: probably the same way you send any other ajax request to rails
[18:45:42] AndrewCare: I have never actually used AJAX request to rails. I have only used HTTParty inside of Ruby...
[18:45:50] dkam: has joined #RubyOnRails
[18:46:01] rickmasta: has joined #RubyOnRails
[18:46:28] yfeldblum: has joined #RubyOnRails
[18:46:33] jiblet: ya I ended up using the ids, not the most beautiful way of doign it but I think its simpler than using sql
[18:48:02] jtong: has joined #RubyOnRails
[18:48:16] learner_: has joined #RubyOnRails
[18:51:11] smathy: andrew____, http://guides.rubyonrails.org/working_with_javascript_in_rails.html
[18:53:12] soroot: has joined #RubyOnRails
[18:53:56] arBmind: has joined #RubyOnRails
[18:54:36] blackmesa: has joined #RubyOnRails
[18:59:48] AndrewCare: I understand it a little bit more after reading that article but I still dont understand how to move data from a javascript variable into my .html.erb file which then will render data recieved from an HTTParty request. I might be over thinking this in some way
[19:01:37] flashpoint9: has joined #RubyOnRails
[19:02:32] dionysus69: has joined #RubyOnRails
[19:02:40] rickmasta: has joined #RubyOnRails
[19:06:36] smathy: andrew____, but you're calling from JS out to your Rails app which is then calling out to somewhere else using httparty, it'll get a response back from there, then it will respond back to the JS request, which will receive the JSON object and can act accordingly in JS.
[19:08:55] AndrewCare: Yeah I understand how to go from Rails to JS, but I need to formulate an AJAX request that will send text to my controller that will then send the HTTParty request, but what I need from their in an instance variable and then use JS to append that to the .html.erb file. Could you help me formulate that AJAX request?
[19:09:49] Pazician: has joined #RubyOnRails
[19:09:49] Pazician: has joined #RubyOnRails
[19:11:19] smathy: andrew____, "to the .html.erb file" is a mistake in your thinking. Your controller will respond back to your JS/Ajax request with some data, probably in JSON format, your JS code will then handle that return and probably alter the DOM somehow, but it's a DOM in a browser it's not an .html.erb file.
[19:11:48] jancel: has joined #RubyOnRails
[19:12:02] alfiemax: andrew____, ajax request -> rails controller -> request to external service using HTTParty -> response -> js response back (send a json) -> AJAX success block -> do what ever you want with the JSON data
[19:12:33] sid_fules: has joined #RubyOnRails
[19:12:53] helpa: has joined #RubyOnRails
[19:13:10] AndrewCare: okay. I understand the progress of how this all has to work but I still dont understand the ajax -> rails controller. For instance how to formulate that request.
[19:13:45] alfiemax: andrew____, do you know how to make an AJAX request?
[19:14:12] AndrewCare: alfiemax: No.
[19:14:16] alfiemax: if so in the url param, pass in the url for the controller action you want to execute and get the response from
[19:14:29] alfiemax: if not, checkout jquery docs for AJAX
[19:14:42] gusrub: has joined #RubyOnRails
[19:15:44] lacuna: has joined #RubyOnRails
[19:15:52] jgt: has joined #RubyOnRails
[19:16:24] norc_: has joined #RubyOnRails
[19:16:48] flowing-farrows: has joined #RubyOnRails
[19:16:50] pwnd_nsfw: has joined #RubyOnRails
[19:20:12] emachnic: has joined #RubyOnRails
[19:20:58] futilegames: has joined #RubyOnRails
[19:21:23] rickmasta: has joined #RubyOnRails
[19:21:25] gking: has joined #RubyOnRails
[19:21:35] Ikri: has joined #RubyOnRails
[19:23:24] dkam: has joined #RubyOnRails
[19:26:23] roamingdog: has joined #RubyOnRails
[19:26:33] soroot: has joined #RubyOnRails
[19:27:27] AndrewCare: alrighty, I have figured out how to send an AJAX request to my rails server but I'm still getting a 404 error to the endpoint that I am attempting to send the data too.
[19:30:21] lurch_: has joined #RubyOnRails
[19:30:56] SMackMyBitchUp: has joined #RubyOnRails
[19:31:15] SMackMyBitchUp: Hey World! I'm still fighthing my way through beginner tutorials; this time I've decided to try this one: https://www.sitepoint.com/building-your-first-rails-application-views-and-controllers/ , but alas I get a funny error at the end: "uninitialized constant UrlsController::Url" . Could someone try to see whats up with that?
[19:31:21] Axilla: has joined #RubyOnRails
[19:31:21] badoo: has joined #RubyOnRails
[19:33:41] badoo: Hi everyone, I'm trying to enhance my website page load time, so I'm deleting unneccesary assets from my app. I'd like to know how to compile assets in development environement so I can see the exact sizes of my js and css files.
[19:33:48] oystersauce8: has joined #RubyOnRails
[19:34:03] mrbubbles: Hey folks, I'm just building a master-detail view app - I need a list of accounts to appear in the sidebar, visible down every page, and then when an account is clicked on the details are shown alongside the menu. Can I use the ApplicationController to retrieve the list or is this bad practice?
[19:34:07] Mia: has joined #RubyOnRails
[19:34:07] Mia: has joined #RubyOnRails
[19:34:41] manfrin: has joined #RubyOnRails
[19:35:45] banister: has joined #RubyOnRails
[19:36:28] RedNifre: has joined #RubyOnRails
[19:36:49] tvw: has joined #RubyOnRails
[19:37:44] RedNifre: Hi. I'm trying to install the getontracks app on my OpenBSD server. The install worked, but I got no css because the asset generation step failed somehow. Given that I have no experience with rails I don't understand what it's trying to tell me... what does this mean?: https://gist.github.com/RedNifre/7132b8da0510aa7f1cf6bbfebe9014a3
[19:37:58] blackmesa: has joined #RubyOnRails
[19:38:37] dannyguk: has joined #RubyOnRails
[19:41:27] alfiemax: badoo, rake assets:precompile
[19:43:15] hahuang62: has joined #RubyOnRails
[19:43:46] adam12: RedNifre: Not sure if it would solve your problem but I'd try this version: `RAILS_ENV=production bundle23 exec rake assets:precompile --trace`
[19:45:14] AntiSpamMeta: has joined #RubyOnRails
[19:47:37] conta: has joined #RubyOnRails
[19:49:40] whathappens: has joined #RubyOnRails
[19:51:36] ElFerna: has joined #RubyOnRails
[19:51:39] rickmasta: has joined #RubyOnRails
[19:53:22] dkam: has joined #RubyOnRails
[19:58:15] Jon30: has joined #RubyOnRails
[19:59:09] smathy: has joined #RubyOnRails
[20:01:02] srinidhi: has joined #RubyOnRails
[20:01:10] dkam: has joined #RubyOnRails
[20:02:45] pwnd_nsfw`: has joined #RubyOnRails
[20:04:35] edwinvdgraaf: has joined #RubyOnRails
[20:06:09] RedNifre: adam12 thanks, that seems to have fixed it.
[20:06:12] neanderslob: has joined #RubyOnRails
[20:06:24] edwinvdgraaf: has joined #RubyOnRails
[20:09:49] alfiemax: i'm trying to write a method, which in turn passes a set of params to a method
[20:09:56] alfiemax: here is the code i have : https://gist.github.com/alfie-max/f658bcececb3cc40c8e6cf7823d1c146
[20:10:30] alfiemax: as described, the params should be dynamic according to the number of emails in a contact,
[20:10:48] context: wow thats ugly
[20:10:49] alfiemax: but how do i dynamically pass in emails to respective parameter key ?
[20:10:54] context: why not use an array
[20:11:00] Jasaka: has joined #RubyOnRails
[20:11:02] adaedra: a little bit of map.with_index would do fine
[20:11:37] alfiemax: i thought about map_with_index but how would that play out? map returns an array
[20:11:45] context: also, why is it Email and not Email_1 , and why do you start at 1 (or blank) and not 0
[20:12:19] alfiemax: context, this method is for creating a contact in a 3rd party service and not within the rails app
[20:12:30] adaedra: >> %w[a@b.c d@e.f g@h.i].map.with_index { |e, i| [i == 0 ? :Email : :"Email_#{i + 1}", e] }.to_h
[20:12:32] context: params["Email_#{idx}".to_sym] = email_addr_from_loop
[20:12:34] alfiemax: so it's not me who actually decides the name of params
[20:12:38] adaedra: er, wrong chan
[20:13:11] alfiemax: adaedra, i'm doing this within a rails app
[20:13:12] context: find a new service
[20:13:23] coaltown: has joined #RubyOnRails
[20:13:27] adaedra: alfiemax: this should still do, what's the problem?
[20:13:36] alfiemax: adaedra, let me try
[20:13:39] adaedra: but yeah, I agree it's ugly.
[20:13:45] alfiemax: i too agree
[20:13:57] alfiemax: it's just a one time thing
[20:14:04] emachnic: has joined #RubyOnRails
[20:14:06] context: params = {firstname, lastname, ...} ; arr.each.with_index {|em, idx| params["Email_#{idx+1}".to_sym] = em}
[20:14:12] alfiemax: i'm migrating a bunch of records from one serv to another
[20:14:29] coaltown: has joined #RubyOnRails
[20:14:50] context: still ugly no matter how you look at it.
[20:15:02] adaedra: but yeah, map.with_index and to_h seems to be your solution here
[20:16:09] adaedra: A hash can be represented as an array of 2-dimensions arrays ([[:a, 1], [:b, 2]] => {a: 1, b: 2}) so map can totally make you hash structures (to_h will make it back to a Hash)
[20:16:28] alfiemax: oh, didn't know that
[20:17:01] adaedra: s/2-dimensions/2-elements/
[20:17:06] adaedra: not fully awake I am
[20:18:16] alfiemax: context, i agree it's ugly. can you suggest an alternative (and i cant change services)
[20:19:12] yellow5: has joined #RubyOnRails
[20:19:52] edwinvdg_: has joined #RubyOnRails
[20:21:57] machinewar: has joined #RubyOnRails
[20:21:58] adam12: RedNifre: In cae you were wondering, the fix was converting the environment into a proper environment variable (with assignment). Moving it to the beginning of the line is just habit. My guess is you were running in development and the dependency it was error'ing about wasn't available.
[20:22:35] machinewar: if I build a gem, is there a way to check if someone is using it with Rails v. in just a normal ruby script. i..e if Rails.exists?
[20:22:46] Technodrome: has joined #RubyOnRails
[20:22:49] lightt: has joined #RubyOnRails
[20:23:02] adam12: machinewar: Maybe `if defined?(Rails)` ?
[20:23:22] machinewar: adam12: that seems pretty nice
[20:23:23] srinidhi: has joined #RubyOnRails
[20:25:48] sid_fules: has joined #RubyOnRails
[20:28:29] RedNifre: adam12 I see, thanks.
[20:28:35] matthewd: That's likely to cause you pain at some point
[20:28:49] matthewd: machinewar: ^
[20:28:54] machinewar: matthewd: can you explain, thanks
[20:28:56] mostlybadfly: has joined #RubyOnRails
[20:29:23] matthewd: A library can define that module
[20:29:30] machinewar: ah that's true
[20:29:32] RedNifre: The pain I have right now is that I don't see css in the browser. The html currently says <link href="/assets/login-3004709191b241768afd6bd1554bb867.css" media="screen" rel="stylesheet" />
[20:29:41] matthewd: Why do you want to do this?
[20:30:23] machinewar: matthewd: the exact use case is that if the gem is used in Rails I want to access the Rails.cache, otherwise the user has to specify a different configuration
[20:30:42] machinewar: or if you know if I can access memcached in Rails explicitly without Rails.cache
[20:30:47] adam12: RedNifre: Does that file exist in public/assets?
[20:30:50] machinewar: i.e. with something like Dalli
[20:31:17] machinewar: like get the address, port its running on (which should be known by some object
[20:31:35] RedNifre: ...and the css on the server is in /home/michael/live/getontracks/tracks-2.3.0/public/assets/login-3004709191b241768afd6bd1554bb867.css
[20:32:14] matthewd: I think the defined? check is a popular choice, so I wouldn't rule it out.. just be aware of the risk of false positives
[20:32:45] machinewar: matthewd: yea I was looking through some gems and it seems pretty common, but totally get the possible issues thanks for the heads up
[20:32:58] RedNifre: I know nearly nothing about web servers or rails, does the html href point to the right place assuming I started the rails server in the tracks-2.3.0 directory?
[20:33:22] RedNifre: this getontracks app uses webrick if that matters.
[20:33:32] adam12: RedNifre: You'll likely need something to serve the static assets.
[20:33:49] adam12: RedNifre: are you running the rails server in production?
[20:33:52] enkristoffer: has joined #RubyOnRails
[20:34:01] RedNifre: I think so, yes. One sec...
[20:34:07] matthewd: machinewar: The problem is basically things like rails-html-sanitizer -- it's a dep of actionview, so likely to be loaded when that is present
[20:34:20] RedNifre: I started it with: bundle23 exec rails server -e production
[20:34:34] matthewd: machinewar: ... but "AV is present" is some distance away from "this is a configured Rails application"
[20:35:26] adam12: RedNifre: This is definitely not the best way to run a Rails app, but to get you going, you likely need to tell Rails to serve static assets.
[20:35:30] matthewd: machinewar: See e.g. https://github.com/rails/rails-html-sanitizer/issues/26
[20:35:43] machinewar: yea guess simplest way would just to be to check that the classes I'm looking for are defined if defined?(Rails) && Rails.respond_to?(:cache) && defined?(Rails::Cache)
[20:35:44] adam12: RedNifre: Inside config/environments/production.rb you want to set `config.serve_static_assets` to true.
[20:36:17] context: alfiemax: i already showed you how to do it
[20:36:23] RedNifre: okay, I'll try..
[20:37:49] matthewd: machinewar: tbh, if all you're doing is pulling a cache config, I'd be dubious that's within your library's purview (vs it being up to the user to configure in an initializer)
[20:38:09] RedNifre: adam12 you mean in the config folder inside the getontracks ruby app? That folder doesn't have env in it.
[20:38:35] machinewar: matthewd: you're right
[20:38:37] dkam: has joined #RubyOnRails
[20:38:48] RedNifre: I guess you mean environment.rb or environments?
[20:38:53] adam12: RedNifre: Can you find the file? `find . -name production.rb` It has to be there somewhere, tho the folder name you pasted earlier looks odd.
[20:38:59] adam12: RedNifre: environments/production.rb
[20:39:25] RedNifre: ah dammit, your message was cut off after env, sorry.
[20:41:01] dannyguk: has joined #RubyOnRails
[20:41:50] RedNifre: adam12 it works! Thanks a lot! What's the problem with telling Rails to serve static assets though?
[20:42:06] adam12: RedNifre: Webrick is slow. Good for dev, not much more than that.
[20:42:28] adam12: RedNifre: And traditionally, the other servers are only moderately better. Best to leave asset serving to nginx/apache/etc.
[20:43:30] adam12: RedNifre: I encourage you to look into using a reverse proxy setup (Apache or nginx, reverse proxying to Puma/Thin/Unicorn), or even simpler, Apache+mod_passenger. Although what you have is now working, the configuration is definitely not encouraged for production use.
[20:43:55] jorrin: has joined #RubyOnRails
[20:46:11] arup_r: has joined #RubyOnRails
[20:47:21] RedNifre: I see. Well, the plan is this: I'll be the only person using it and while the web interface is fast enough for me, I want to write an android app that talks to the xml api. I guess the XML REST API speed is independent of webrick etc. since it doesn't have anything to do with the assets, right?
[20:48:17] adam12: The XML rest API is likely served by Webrick as well
[20:48:20] adam12: so you're in the same boat
[20:48:32] adam12: But really, you should be able to switch to Puma or Thin without difficulty
[20:48:44] havenwood: RedNifre: If you `rails new` with Rails 4 it uses Unicorn or with Rails 5 it will be Puma.
[20:48:47] adam12: And run it with them serving assets, if you think it's going to be low traffic.
[20:49:26] havenwood: RedNifre: Adding Puma/Thin/Unicorn to your gemfile and bundling is all it takes. An unconfigured Puma for example is much better than an unconfigured Webrick.
[20:49:58] RedNifre: It's all new to me, I'm just happy that I got something running. I'll look into Puma/Thin/Unicorn/nginx/apache etc. later.
[20:50:50] Rafcio: has joined #RubyOnRails
[20:50:52] Rafcio: hey guys, in Ruby how can I add 7 days to a date? Rails has helpers but don’t help in plain ruby
[20:51:42] lupine: to a date? Date.today + 7
[20:51:50] RedNifre: It's getting late again. Thank you so much for helping me out on this :) Have a good night.
[20:52:35] adam12: RedNifre: Good stuff ;)
[20:53:43] rakm: has joined #RubyOnRails
[20:53:44] chintanparikh: has joined #RubyOnRails
[20:54:18] AntiSpamMeta: has joined #RubyOnRails
[20:56:08] arup_r: Rafcio: http://ruby-doc.org/stdlib-2.3.1/libdoc/date/rdoc/Date.html#method-i-next_day
[20:56:57] srinidhi1: has joined #RubyOnRails
[20:57:13] Leepoff: has joined #RubyOnRails
[20:57:20] Rafcio: thanks arup_r :)
[20:59:31] oystersauce8: has joined #RubyOnRails
[21:00:46] DoctorMonocular: buh. I have an object with a class var that is a hash, and I set up that hash to be with_indifferent_access, plus have a default. Then I used DeepClone to make a copy, and the hash keeps its data, but alas the indifferent access and default breaks on it. Just bitching really, not asking a question
[21:03:40] jsrn: has joined #RubyOnRails
[21:06:13] gking: has joined #RubyOnRails
[21:06:23] gking: Hello, how can I modify data before it is returned from a model?
[21:07:08] gking: Do I just name a method the same as the column?
[21:08:15] phredus: hello all, could someone please shed some light on this issue, thank you. ruby 2.1 rails 4.2.6 https://bpaste.net/show/9f592daec68c It keeps using sass 5.0.4 and I am running rails 4.2.6 and it doesent like it
[21:08:20] smathy: gking, yes, and then use self[:attribute_name] to refer to the attribute value.
[21:08:39] yfeldblum: has joined #RubyOnRails
[21:09:33] smathy: phredus, !gist your Gemfile and Gemfile.lock
[21:09:33] helpa: phredus: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[21:10:14] GodFather: has joined #RubyOnRails
[21:11:49] roamingdog: has joined #RubyOnRails
[21:12:57] phredus: thanks guys, here is the gist https://gist.github.com/edvernon/13b2fc51e8e054557bcb494219c10990
[21:14:29] smathy: phredus, run `bundle`
[21:15:12] dkam: has joined #RubyOnRails
[21:16:56] phredus: bundle completes without issues but rails server still gives same error
[21:17:24] eljimmy: has joined #RubyOnRails
[21:17:49] phredus: did you want the output of bundle?
[21:19:05] smathy: phredus, just the last line of the bundler output.
[21:19:36] phredus: smathy: Bundle complete! 12 Gemfile dependencies, 52 gems now installed.
[21:19:36] phredus: Use `bundle show [gemname]` to see where a bundled gem is installed
[21:19:58] hirvi: has joined #RubyOnRails
[21:21:01] smathy: phredus, hmm, which version of bundler do you have? `bundle -v`
[21:21:26] phredus: smathy: Bundler version 1.12.4
[21:21:47] srinidhi: has joined #RubyOnRails
[21:22:30] ur5us: has joined #RubyOnRails
[21:22:33] Technodrome: has joined #RubyOnRails
[21:22:44] havenwood: phredus: Have you tried prefixing `bundle exec` to your command?: bundle exec rails s
[21:22:54] smathy: phredus, maybe this is some spring "ism" - kill spring.
[21:23:02] smathy: havenwood, his Gemfile.lock is missing the `sass` dependency.
[21:23:21] smathy: ...but `bundle` isn't complaining.
[21:23:44] havenwood: is it really missing?
[21:23:45] havenwood: seems to be there
[21:23:58] smathy: havenwood, sass itself: https://gist.github.com/edvernon/13b2fc51e8e054557bcb494219c10990
[21:24:04] phredus: should sass-rails-5.0.4 the fact that is version 5 have anything to do with the issue
[21:24:10] smathy: phredus, nope.
[21:24:30] smathy: phredus, I have a 4.2.6 here with sass-rails 5.0.4 - it should have sass (and three other gems) as dependencies.
[21:24:35] mshowman: has joined #RubyOnRails
[21:25:49] phredus: it is installed bundle show sass /usr/lib64/ruby/gems/2.1.0/gems/sass-rails-5.0.4
[21:26:44] havenwood: phredus: I'm curious what changes in the Gemfile.lock with a: bundle update sass-rails
[21:28:11] gking: Does Model.create() and Model.create!() both return the newly created record?
[21:29:00] smathy: phredus, it has to appear in your Gemfile.lock file in order for Rails to be able to use it.
[21:29:14] noraatepernos: has joined #RubyOnRails
[21:29:16] phredus: bundle update sass-rails completed without issues
[21:29:28] smathy: phredus, _something_ is tricking the `bundle` that you run into thinking `sass` is in the dependencies/requirements even though it
[21:29:28] phredus: did you want the output?
[21:29:35] smathy: ...it's not in the Gemfile.lock
[21:29:35] arooni: has joined #RubyOnRails
[21:29:42] smathy: phredus, no, I want you to kill spring.
[21:29:43] noraatepernos: What is the site where I can pay a rails expert for an hour long chat?
[21:29:44] havenwood: phredus: yup
[21:30:00] noraatepernos: Like…the top ror contributor would charge $200/hr for a call, etc.
[21:30:06] smathy: phredus, did running `bundle update sass-rails` add `sass` to your Gemfile.lock file?
[21:30:21] havenwood: spring stop
[21:30:44] havenwood: export DISABLE_SPRING=1
[21:30:44] smathy: Might need to kill other spring processes too.
[21:31:57] arup_r: noraatepernos: https://www.codementor.io/ probably :)
[21:31:57] phredus: bundle update sass-rails https://gist.github.com/edvernon/848407da1462c80b355946f90dd2dcf8
[21:32:15] havenwood: phredus: the Gemfile.lock
[21:32:16] noraatepernos: arup_r: I found it. It’s airpair.com. I need a redshift person.
[21:32:41] jancel: has joined #RubyOnRails
[21:33:19] phredus: smathy: sorry I got lost, heree I will follow you
[21:33:29] phredus: smathy: kill spring, how?
[21:33:39] Synthead: has joined #RubyOnRails
[21:33:59] smathy: phredus, well first `spring stop` as havenwood mentioned. But after that check for other spring processes with: `ps aux | grep spring`
[21:34:04] phredus: havenwood: got spring stop
[21:35:10] smathy: phredus, assuming there are no more spring processes, try `bundle` again. Hopefully it reports that your Gemfile.lock is corrupt.
[21:35:54] phredus: smathy: spring stop bash: spring: command not found
[21:36:14] smathy: phredus, and the `ps aux | grep spring` ?
[21:36:28] phredus: smathy: ps aux | grep spring 16663 0.0 0.0 10852 2208 pts/3 S+ 14:34 0:00 grep --colour=auto spring
[21:36:42] smathy: phredus, ok, damn. So this wasn't a spring issue.
[21:37:14] smathy: ...which is really weird because `spring` is in your Gemfile.
[21:38:06] smathy: ...and your bpaste shows spring in the stacktrace.
[21:40:26] phredus: I'v tried ruby 2.1 2.2 2.3 and Carefully installed and reinstalled many times thinking it may be an issue with the installation and each time exactly the same result
[21:40:31] manfrin: has joined #RubyOnRails
[21:41:48] dannyguk: has joined #RubyOnRails
[21:43:37] lightt: has joined #RubyOnRails
[21:49:29] beneggett: has joined #RubyOnRails
[21:51:07] beneggett: I've been having InvalidAuthenticityToken errors with Rails 5 RC1 on Amazon EC2 with multiple hosts under a load balancer; it seems if I submit on one machine, and it sends the request to another, it raises InvalidAuthenticityToken error
[21:51:08] dkam: has joined #RubyOnRails
[21:51:39] beneggett: Has anyone experienced this? I can't confirm it's isolated to Rails 5 RC1, maybe there is something I need to just adjust as far as expires in NGINX or something?
[21:52:34] smathy: beneggett, I haven't noticed it, but it sounds like something that would happen with all versions of Rails. You need sticky sessions.
[21:52:56] DukeDave: So, I just started using Docker for a Rails app, and: None of the online tutorials mention the fact that when you bundle inside a container, the Gemfile.lock on the host is *not* updated. What am I missing?
[21:54:53] MojoJojo8: has joined #RubyOnRails
[21:58:15] arooni: has joined #RubyOnRails
[21:58:57] GodFather: has joined #RubyOnRails
[22:02:06] r1v3r_: has joined #RubyOnRails
[22:02:09] emachnic: has joined #RubyOnRails
[22:03:08] beneggett: smathy: yeah, that's the strange thing; I'm using the same setup on my rails 5 app, that I have on previous rails 4 apps; and it's just happening now
[22:03:17] phredus: hey guys I tried gem pristine --all and got another errorhttps://gist.github.com/edvernon/b86aa3bc521454dc73f7b7ef09496cc3
[22:03:18] beneggett: as far as nginx settings go
[22:03:41] phredus: error https://gist.github.com/edvernon/b86aa3bc521454dc73f7b7ef09496cc3
[22:04:09] smathy: beneggett, the nginx settings wouldn't be where it would be, it'd be in your load balancer settings.
[22:04:27] beneggett: ah... let me take a look at my ELB settings, I know what you're saying now
[22:05:43] smathy: phredus, some of your gems are installed in a `sudo`-only location.
[22:06:57] phredus: smathy: I let my package manager do all the installing and yes I have run the package manager as root, how can I fix that?
[22:10:34] smathy: phredus, I'd recommend using a version manager for your ruby so you're not interfering with the system one for your app(s). chruby or rbenv with ruby-install.
[22:10:48] smathy: (other people like rvm, although I don't so I'm not recommending it)
[22:11:22] lightt: has joined #RubyOnRails
[22:11:39] phredus: smathy: I was just reading on RVM, I use gentoo do you have knowledge of which version manager work best with gentoo?
[22:12:38] smathy: The distro won't make any difference. Regardless of distro I think chruby is the best written and lightest, and rbenv is next best, and I dislike rvm's approach a lot (although it is a simpler install process).
[22:13:01] beneggett: thanks again smathy; that should clear it up
[22:13:20] smathy: beneggett, np.
[22:13:24] phredus: smathy: my package manager is portage, ive read that sometimes there can be issues because portage tries do updates and re-does or -un-does what the version manager does and viseversa
[22:13:36] dannyguk: has joined #RubyOnRails
[22:14:44] globalall0c: has joined #RubyOnRails
[22:15:09] smathy: phredus, I can't speak for rvm because I'm not familiar enough with it (although my best guess would be that in this regard it'd be the same as the others) but rbenv and chruby will both install your full ruby into a directory in your local user's home directory, I can't imagine any scenario when any package manager at the system level would ever have an impact on that.
[22:15:22] jenrzzz: has joined #RubyOnRails
[22:16:44] jancel: has joined #RubyOnRails
[22:16:48] workmad3: has joined #RubyOnRails
[22:16:57] jtong: has joined #RubyOnRails
[22:17:59] phredus: OK and of those 2 which do you recommend? ruby is part of my os so I cant have a version manager manage it. how would I go abaout that issue? I can uninstall rails and install it using the version manager you suggest.
[22:20:36] Axilla: has joined #RubyOnRails
[22:24:45] mdw: has joined #RubyOnRails
[22:24:51] mwlang: has joined #RubyOnRails
[22:25:46] mwlang: what is the up/down button on a numeric input called?
[22:26:11] Hobogrammer: has joined #RubyOnRails
[22:26:20] adaedra: Sometimes "spinner"
[22:26:46] mwlang: I have an on “blur” event tied to such an input that fires if user types new number and tabs/clicks away. but that on “blur” even does not fire if user clicks the up/down button to change quantity in the input box then clicks or tabs elsewhere.
[22:27:00] macsteps: has joined #RubyOnRails
[22:27:04] dkam: has joined #RubyOnRails
[22:27:29] mwlang: so I need to figure out how to either a) return focus after click to the input or on “blur” the “spinner” (thanks adaedra)
[22:27:53] phredus: I need to use a Ruby Version Manager to manage Ruby on Rails and its Gems, however Ruby is part of the gentoo os so I can't have a version manager manage it. How would I go abaout that issue? RBENV, CHRUBY or RVM Which Ruby Version Manager works best with gentoo?
[22:28:05] smathy: phredus, I recommend chruby, and the ruby that is part of your OS has nothing to do with the ruby installed by these version managers, that's kind of the point. You get a nice clean, predictable ruby for your app that you can have at whatever version your app demands, without ever impacting your system ruby.
[22:28:31] smathy: phredus, and no, the version managers are just for ruby, you'll still use `gem` or `bundle` to manage gems.
[22:30:44] maxx88_: has joined #RubyOnRails
[22:30:50] norfumpit: has joined #RubyOnRails
[22:31:11] phredus: smathy: sorry that last post was meant for the gentoo guys.
[22:32:00] phredus: smathy: OK chruby it is. What you are saying is it will install a whole new separate version of ruby and ruby on rails?
[22:33:58] hahuang62: has joined #RubyOnRails
[22:34:48] smathy: phredus, no, rails is a gem. chruby will install a new version of whatever version(s) of ruby you want (actually the associated installer: ruby-install will), then you will use chruby to change your PATH and a few other things so that `gem` and `bundle` both use that ruby, so then when you run `bundle` it will install the gems relative to the ruby it's using - which is your own pristine install of ruby.
[22:35:55] gingray: has joined #RubyOnRails
[22:36:01] tanuki: has joined #RubyOnRails
[22:38:15] KnownSyntax_: has joined #RubyOnRails
[22:38:51] mwlang: nevermind, figured out a solution. The input *does* detect when user is clicking the spinner and fires the “click” event. So, solution is to set focus to the input in the on click fire. Then when user does click elsewhere, the on blur event is guaranteed to fire.
[22:39:07] mwlang: it seems in FF, it’s possible to click the spinners without the input obtaining focus.
[22:41:41] iooner: has joined #RubyOnRails
[22:41:51] noraatepernos: has joined #RubyOnRails
[22:42:35] KnownSyntax_: has joined #RubyOnRails
[22:45:40] superlou: has joined #RubyOnRails
[22:46:12] diegoaguilar: has joined #RubyOnRails
[22:46:36] maxx88_: has joined #RubyOnRails
[22:47:10] KnownSyntax: has joined #RubyOnRails
[22:47:10] KnownSyntax: has joined #RubyOnRails
[22:47:48] nettoweb: has joined #RubyOnRails
[22:48:05] diegoaguilar: has joined #RubyOnRails
[22:48:08] oystersauce8: has joined #RubyOnRails
[22:49:13] jari: has joined #RubyOnRails
[22:56:43] Synthead: has joined #RubyOnRails
[23:01:35] dkam: has joined #RubyOnRails
[23:06:01] truenito: has joined #RubyOnRails
[23:06:53] chipotle: has joined #RubyOnRails
[23:09:30] oystersauce8: has joined #RubyOnRails
[23:10:08] r1v3r: has joined #RubyOnRails
[23:10:11] phredus: smathy: So I will never usse my package manager to install gems or to update rails or gems, I will instead use chruby, right?
[23:11:32] jancel: has joined #RubyOnRails
[23:13:08] Axilla: has joined #RubyOnRails
[23:14:17] dannyguk: has joined #RubyOnRails
[23:17:25] siaw23: has left #RubyOnRails: ()
[23:18:50] xall: has joined #RubyOnRails
[23:22:19] ruurd: Wrong. You will use RVM
[23:23:55] unreal_: has joined #RubyOnRails
[23:30:51] dalbusch1t: has joined #RubyOnRails
[23:35:08] jpterry: has joined #RubyOnRails
[23:36:48] Pazician: has joined #RubyOnRails
[23:37:07] roamingdog: has joined #RubyOnRails
[23:43:59] SirOliver: has joined #RubyOnRails
[23:44:22] wethu: has joined #RubyOnRails
[23:48:31] evansbee: has joined #RubyOnRails
[23:50:34] hahuang62: has joined #RubyOnRails
[23:50:55] emachnic: has joined #RubyOnRails
[23:51:10] pawnbox: has joined #RubyOnRails
[23:54:32] ur5us: has joined #RubyOnRails
[23:54:38] queequeg1: has joined #RubyOnRails
[23:57:32] startupality: has joined #RubyOnRails
[23:58:27] phredus: smathy: I guess I should I unstall anything rails? since I have the error with the current setup anyway?
[23:58:42] phredus: ruurd: Sorry was that for me I stepped way