« Back to channel list

#RubyOnRails - 20 February 2015

« Back 1 day Forward 1 day »
[00:02:03] bricker: Arthius: what issue
[00:03:22] Arthius: Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
[00:03:22] Arthius: server certificate B: certificate verify failed (https://rubygems.org/gems/rake-
[00:03:22] Arthius: 10.4.2.gem)
[00:03:22] Arthius: An error occurred while installing rake (10.4.2), and Bundler cannot continue.
[00:03:22] Arthius: Make sure that `gem install rake -v '10.4.2'` succeeds before bundling.
[00:03:48] smathy: Arthius, does this apply to you: https://gist.github.com/luislavena/f064211759ee0f806c88 ?
[00:04:16] Arthius: Yes Thank you very much
[00:04:33] smathy: You're welcome.
[00:07:05] bricker: Arthius: you can also upgrade Open SSL (via Homebrew, for example) and then re-compile Ruby. I've resolved that error a few times before with this method.
[00:08:36] Arthius: Ok... Youll have to forgive me as I am just starting in the programming field and still have a lot to learn
[00:16:22] Arthius: It worked Perfect. I actually only how to Download the new cert and place is in the Secure_SSL file in the ruby install and it worked. Thanks again.
[00:19:18] rhizome: not having fun
[00:19:20] wethu: i18n translation files cascade right? or would that be something implemented yourself? I have a legacy app and they've structured updates in an updates dir and called them by year 2014_update.yml etc..
[00:19:48] helpa: Please explain your problem better as we are having trouble understanding what you mean. A Gist (http://gist.github.com) is always helpful!
[00:22:09] wethu: if foo.yml has en: node: heading: "Hi Radar" and bar.yml has en: node: heading: "Bye Radar" would there be any circumstances where those 2 files could be concatenated and the result be "Bye Radar" ?
[00:22:21] Radar: wethu: !gist
[00:22:21] helpa: wethu: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[00:22:33] Radar: wethu: Depends on which order those files are loaded in.
[00:22:42] patrick99e99: hi rails friends.. does anyone know, is it possible some how for two tabs in a browser to have different sessions?
[00:22:46] Radar: Translations are just a hash, so they'll be overridden
[00:22:54] wethu: so yml configs do cascade ? oh ok they don't..
[00:23:05] Radar: wethu: Define "cascade"
[00:23:09] Radar: patrick99e99: no. Open a new incognito window.
[00:23:19] patrick99e99: Radar: maybe you will know the answer to this --> http://stackoverflow.com/questions/28467764/devise-goes-crazy-with-accept-headers-of
[00:32:30] Spami: why does sometimes for nested_attributes I have to use _build, and sometimes .build
[00:33:10] jfelchner: Anyone know if there's a gem that will output Rails errors as text instead of HTML so that when I'm testing an API call, I don't have to look through HTML elements and CSS?
[00:33:31] jfelchner: I thought I saw something somewhere, but can't find it now.
[00:33:55] pipework: jfelchner: Tail the test log?
[00:35:02] jfelchner: pipework: Yeah, that's what I've been doing, it'd just be nice to see it returned by the curl statement.
[00:35:33] pipework: jfelchner: Maybe you should change your app to use .rescue_from and return json?
[00:35:39] pipework: I think that'd do what you want.
[00:38:14] jfelchner: pipework: I only wanted it in development, but I think that's basically what I'm going to have to do. Either that or a custom middleware.
[00:40:18] jfelchner: The DebugExceptions middleware is the one that's responsible for showing the error page.
[00:47:48] jfelchner: Figured it out. You have to pass "-H 'X_REQUESTED_WITH: XMLHttpRequest'" to curl. Rails will assume it's an XHR request and output the stacktrace as text.
[00:48:02] jfelchner: It still shows a ton of HTML, but ti's better than nothing.
[00:59:40] johntrails: Can someone please set me in the right path. Unsure how to go about the following. I have an application I am working on which is a reporting tool feeding off of our ERP database. One of the methods in the application passes a couple of params. Brand name, and date field. the datefield is for a between clause where I can choose start date and end date. my date format is yyyymmdd (eg; 20150219). On the reporting tool I am working
[00:59:40] johntrails: on I need to be able to select a date range (lets say start date 20150208.. end date 20150214)
[01:00:37] johntrails: I need to be able to see data from the same model for the same week of the year, previous year... my problem is that that date range, even though represents week of the year for this year, it is not the same for last year
[01:00:43] johntrails: that would be week 7 current year
[01:01:19] johntrails: last year week 7 was 20140209 through 20140215
[01:01:45] johntrails: I am lost on how to write a method that will pull data for the same week last year, when choosing a date range in the current year, the date range will never be the same
[01:02:35] johntrails: so i have 2 tables on a view that will show the data, table 1 = date range of current year, table 2 = same week of current year range, previous year
[01:02:39] johntrails: if that makes any sense
[01:12:43] jfelchner: johntrails: not sure I'm following but have you tried `my_date - 1.year`?
[01:13:06] jfelchner: Or possibly `my_date - 52.weeks`
[01:14:25] johntrails: jfelchner, to simplify, I need a method that will grab my params and give me the same week of last year... so if i select 20150208 through 201502014, it will convert that to week of the year and give me the date range for the same week last year, which in this example would be 20140209 through 20140215
[01:16:35] jfelchner: `Time.utc(2015, 2, 8, 0, 0, 0) - 52.weeks #=> 2014-02-09 00:00:00 UTC
[01:21:15] bricker: johntrails: you may be able to use `beginning_of_week` too to help
[01:22:34] johntrails: im researching both scenarios.. thanks guys
[01:40:57] rhizome: an evening of diff debugging
[01:41:33] batasrki: using git bisect?
[01:41:38] Taurvi: Hi, does anybody know what it means when the MySQL2 gem gives a "Could not initialize MySQL client library?"
[01:41:53] rhizome: batasrki: alas no, actual diff
[01:42:10] rhizome: i guess i could use meld for this if i really think about it
[01:43:12] batasrki: Taurvi: exactly what it says. You probably don't have dev libraries installed
[01:47:19] smathy: Taurvi, handing that error to google shows this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770896
[01:47:27] smathy: Taurvi, are you using the latest mysql2 gem?
[01:49:35] weaksauce: how do you setup haml with rails engines
[01:50:45] Taurvi: @Smathy> Yes, I am 0.3.18
[01:51:36] smathy: Taurvi, and you get this with a vanilla Rails 4.2.0 app using Ruby 2.2, created from scratch?
[01:52:02] Taurvi: How does one update Ruby? I think the server I'm running is using an outdated version of Ruby (1.9.3)
[01:53:41] bricker: Taurvi: package manager or compile yourself
[01:54:18] Taurvi: @Bricker> Compile by self
[02:00:03] batasrki: Taurvi: if on Ubuntu, you can use brightbox packages
[02:00:51] Taurvi: I have no clue what machine this is on tbh... and I'm getting the impression that the stupid host won't allow me to install a higher version of Ruby
[02:00:56] yuung: for some reason my app isn't sending mail; here's the development.rb, mailer.rb, and the controller that calls the mail function: https://gist.github.com/anonymous/525fb3cb5ca913f59c85
[02:01:48] basichash: i'm gettting /home/user/.gem/ruby/2.1.5/gems/puma-2.9.1/lib/puma/configuration.rb:164:in `read': No such file or
[02:01:50] basichash: ???directory @ rb_sysopen - config/puma.rb (Errno::ENOENT)
[02:01:57] basichash: i'm getting "/home/user/.gem/ruby/2.1.5/gems/puma-2.9.1/lib/puma/configuration.rb:164:in `read': No such file or
[02:02:00] basichash: ???directory @ rb_sysopen - config/puma.rb (Errno::ENOENT)
[02:02:11] yuung: also, in my log it says the mail sent
[02:02:12] basichash: when trying to run foreman
[02:21:36] basichash: wtf is wrong with the config file?
[02:22:14] Sigma00: sounds like config/puma.rb doesn't exist
[02:23:04] basichash: Sigma00: i don't get it, it doesn't in my other heroku app, and that seems to work fine
[02:23:35] Radar: My guess is that the file doesn't exist.
[02:24:46] Sigma00: basichash, sorry but we don't have enough info to help. I also don't really have time to help right now
[02:25:06] basichash: The heroku 'getting started' guide never mentioned this at all
[02:25:22] Sigma00: so this is a blank rails app with puma?
[02:25:24] Radar: basichash: Did you commit + push that file to Heroku?
[02:25:57] Sigma00: git status and look at untracked files
[02:26:13] basichash: Radar: i'm talking about running locally with foreman
[02:26:27] Radar: basichash: Show us your foreman configuration.
[02:27:07] basichash: which path is that in?
[02:27:17] Radar: It's Procfile
[02:28:35] basichash: shit i'll shut up now, thanks Radar
[02:28:40] Radar: basichash: np
[02:34:33] weaksauce: anyone know why adding haml as a gemspec dependency in a rails engine doesn't add it to the template handlers?
[02:35:39] weaksauce: my google is failing me
[02:35:49] Radar: weaksauce: You didn't restart your server or you added it to the wrong group.
[02:36:57] Radar: Or the engine isn't requiring haml, which would be another reason.
[02:37:00] Radar: Or it's Lupus.
[02:37:18] weaksauce: Radar It fails when running tests and the way I added it was to put it in the gemspec file and run bundle install. s.add_dependency 'haml'
[02:37:38] weaksauce: is there a separate place that I need to require it?
[02:37:38] Radar: weaksauce: I guess then it's not requiring haml.
[02:37:45] Radar: weaksauce: in the engine's lib/engine.rb
[02:38:07] Radar: I would normally require that in lib/<engine name>.rb along with all the other stdlib/gem deps
[02:38:44] weaksauce: ah! first time making an engine and I was unaware of the need to specifically require it
[02:38:59] Radar: I don't recall if haml-rails is required or not. In this non-engine app that I'm in right now we've just got haml in the Gemfile
[02:39:09] weaksauce: added a require and it seems to parse it now
[02:39:12] Radar: which is why I suspect requiring will fix it... because in an app, dependencies are required.
[02:39:30] Radar: In an engine context I think they're only added to the loadpath and then you need to require them as you need them
[02:39:35] weaksauce: I think haml-rails just adds some generators and a convert script
[02:41:51] Radar: https://github.com/indirect/haml-rails#haml-rails
[03:37:46] pontiki: hallo, ppl
[03:37:55] joelbrewer: hey pontiki :)
[03:38:00] sevenseacat: mornin' pontiki
[03:38:51] pontiki: p.good rails hack nite
[03:39:12] joelbrewer: sevenseacat: You in the middle east?
[03:40:17] joelbrewer: sevenseacat: ahh. isn't it afternoon there?
[03:40:17] pontiki: about as far as
[03:41:29] joelbrewer: sevenseacat: gotcha :)
[04:09:19] johntrails: Can someone please help me out... http://pastie.org/9964370
[04:09:34] johntrails: i am defining ajax in my formats in the controller.
[04:09:44] johntrails: but I am getting a template is missing error
[04:10:02] johntrails: i can fix by taking out ajax portion. but then I am not getting the ajax partial refresh
[04:10:26] johntrails: I know my params are passing correctly, because if i take it off and open my link in a new tab, i get the desired results
[04:15:20] smathy: johntrails, `render 'ajax_called'` will look for the template file called ajax_called.
[04:15:36] smathy: Oh, sorry, you have that and want that.
[04:15:50] smathy: What's the full error you're getting?
[04:16:39] johntrails: ActionView::MissingTemplate (Missing template reports/filtered_index ..........
[04:18:30] johntrails: nevermind, i got it going. was trying to call multiple renderings from the method
[04:20:29] johntrails: now on to the real mission.. .trying to get my date params to show me data for the selected week on the previous year
[04:23:40] johntrails: Anyone have any tips on selecting the same week last year? I have params on my method for "start date" and "end date", i want to also have on the same method some way of selecting the same week last year of the dates
[04:24:36] johntrails: eg; current year = between 20150208 and 20150214, last year = between 20140209 and 20140215 (because both dates are week 7 of the year
[04:24:52] johntrails: the dates will be selected from jquery.ui.datepicker
[04:26:24] rhizome: what if the range covers more than one week?
[04:27:02] s2013: sup folks
[04:27:05] s2013: Radar, where art thou
[04:27:19] Radar: s2013: working hard
[04:27:43] s2013: or hardly working?
[04:27:57] s2013: have thou forsaken us ? :(
[04:29:30] blahwoop: when i'm building an rails api. and i need to get this to work GET /tags/:entity_type/:entity_id does it mean i need to pass in the type and id to retrieve it?
[04:29:50] johntrails: rhizome, it should calculate the the same dates for last year... if it's more than 1 week
[04:29:59] johntrails: date selections will always be based on a week to week basis
[04:30:05] s2013: sevenseacat, hi
[04:30:20] blahwoop: curl api.example.com/tags[:entity_type]="something"&&[:entity_id]="1"
[04:30:37] s2013: like /tags/something/someid
[04:31:21] hotelca: I have a USER table. Each user can have many documents. For each document, a user can invite other users to see. As a user, you will be able to see other users' documents only if you have the invitation. WHat the best way to construct my models for this?
[04:31:34] blahwoop: ok those are attributes of tags
[04:31:44] s2013: hotelca, create an invitation tale to keep track of it
[04:32:05] hotelca: was thinking a Invitation model, that has "belongs_to user" and "belongs_to document" also
[04:32:11] hotelca: is this the right approach?
[04:33:01] s2013: so user has many documents through invitations
[04:33:28] s2013: or something like
[04:35:17] hotelca: right now, I have USER(has_many documents, has_many invitations), DOCUMENT(belongs_to user, has_many invitations), INVITATION(belongs_to user, belongs_to document)
[04:35:45] hotelca: but the thing is each user has own documents too
[04:36:03] blahwoop: s2013: so would my controller have something like @tag = Tag.find(params[:entity_type])?
[04:36:04] hotelca: and documents, that he/she can have access to(other people's documents)
[04:36:09] pontiki: isn't that what user has_many documents is about?
[04:36:21] s2013: because blahwoop its still a parameter
[04:36:40] s2013: rails doesnt distinguish between parameters in the url or via query string
[04:36:43] s2013: atleast on the surface
[04:36:59] pontiki: hotelca: consider ownership as different from viewable
[04:37:36] pontiki: so users can manage (read, edit, create, destroy) their own documents, but only read other's documents by invitation
[04:37:51] blahwoop: i mean a simple get tags/1 makes sense to me but going by tags/entity_type/entity_id messes me up
[04:37:52] pontiki: you'll need some sort of role-based authorization system
[04:38:32] pontiki: do not private message without permission, hotelca
[04:38:40] pontiki: keep your questions in channel, also
[04:38:45] pontiki: they can benefit all
[04:39:02] jake_g: Non-rails question: I???m starting a side project that I might want to grow into a small business (no other employees) within the next 6ish months. I have domain/email stuff setup. Should I create a new heroku account specifically for this side project or is it better to put it onto my personal account with all the small stuff I play around with? The repo is a private repo on my personal github account (not sure if that matters).
[04:40:05] pontiki: jake_g: I'd go ahead and create a "business" account
[04:40:08] Radar: s2013: No I have not forsaken you. It's an unspoken of this rule that anyone with founder access must not participate in channel discussions.
[04:40:14] Radar: Or even idle.
[04:40:18] Radar: I am actually breaking the rules right now.
[04:40:29] s2013: can i be a founder access?
[04:40:30] blahwoop: mute urself
[04:40:31] Radar: s2013: no
[04:40:34] pontiki: it's a holdover from the origins of rails in idlerpg
[04:40:50] pontiki: radar is ded now
[04:40:52] ChanServ: +q *!*@
[04:41:02] pontiki: he has to role for a new character
[04:41:05] jake_g: pontiki: Awesome. Thanks. Thats what I suspected but I wasn???t sure if I???d run into weirdness with the same Github account linked to two heroku accounts.
[04:41:10] s2013: noooooooooooo
[04:41:14] ChanServ: -q *!*@
[04:41:32] notradar: hi I am new to Rails how do I get started?
[04:41:35] s2013: oo Radar is gone, lets badmouth him
[04:41:43] pontiki: jake_g: i don't have experience with that *directly* but i'd be just super surprised if there was such a restriction
[04:41:44] blahwoop: michael hartls tutorial
[04:42:01] s2013: notradar, you do sudo apt-get install nodejs
[04:42:12] jake_g: ponktiki: Yeah thatd be weird. Thanks for the advice!
[04:44:33] pontiki: notradar, stop using windows, you need to buy a Mac
[04:45:07] hotelca: and try working through this book to start with https://www.railstutorial.org/book/frontmatter
[04:45:34] s2013: hotelca, lol
[04:45:44] s2013: theres a better book you should recommend, rails 4 in action
[04:46:28] hotelca: is it free?
[04:48:06] s2013: so i wanted to teach Rails at the class im teaching. i polled students.. out of 50 kids, not a single one said they wanted to learn rails :'(
[04:48:26] blahwoop: it not cool anymore
[04:48:29] hotelca: why do you think that is?
[04:48:35] s2013: cause they are silly kids
[04:48:46] hotelca: what do they want to learn then?
[04:49:02] hotelca: do you think that's the future?
[04:49:12] s2013: eh... too many things
[04:49:15] blahwoop: the mean stacks
[04:49:20] s2013: i use node now more than rails but i like rails more
[04:49:39] s2013: each has its uses.
[04:49:40] hotelca: so why do you use node more?
[04:50:00] s2013: cause my work uses different things and the projects im in charge of uses node and few other things
[04:50:44] hotelca: oh, and back to my question with the users, do you think this make sense? USER(has_many documents, has_many invitations), DOCUMENT(belongs_to user, has_many invitations), INVITATION(belongs_to user, belongs_to document)
[04:51:01] s2013: yeah thats a has many through
[04:51:37] hotelca: and in order to determine whether a user has access to someone else's document, we look at the INVITATION table
[04:51:58] hotelca: alright, let me go hack then
[04:52:00] pontiki: try it and see
[04:52:33] hotelca: going from C++ to rails is harder than I thought :/
[04:53:02] pontiki: you mean C++ to Ruby
[04:53:12] pontiki: Rails is a Framework written in Ruby
[04:54:15] blahwoop: node is like objective c
[04:56:05] hotelca: right, that's what I meant
[04:56:27] pontiki: my meaning was that it's not just a different language, but another set of domains of knowledge
[04:56:27] hotelca: but just in general switching from low level programming to web dev
[04:56:45] pontiki: the magnitude of the change is multidimensional
[04:56:51] hotelca: the whole database thing makes it totally different
[04:57:13] pontiki: and the 3-tier thing as well, client-server-datastore
[04:57:39] pontiki: jump into node.js and add async in as well for extra fun!!!
[04:58:32] pontiki: hotelca: you generally have the right idea in your arrangement. what i really suggest is set up some tests that describe the different scenarios and see how it works
[04:58:52] pontiki: you can do it with just models, you don't need to worry so much about adding in the controllers and views as yet if you don't want to
[04:59:17] pontiki: not the way most people approach learning rails, exactly, but i think it's still legit
[04:59:56] hotelca: alright, let me try
[05:00:20] hotelca: thanks for the tip
[05:03:59] jake_g: What do you guys think about going the other direction? I started learning ruby and javascript last spring. After talking to friends who are in the second year of undergrad CS degrees, working with C++ and other low level languages sounds WAY over my head. Coming from a ruby/javascript background, would I be able to pick up some of those more technical concepts (memory management, etc.) or is it just completely different?
[05:05:00] greenride: jake_g: The basics aren't hard.
[05:05:05] sevenseacat: why would you want to?
[05:06:40] jake_g: Idk haha. At this point in time, I have no desire to deal with low level languages. Just sorta curious about what itd be like if I were to explore different types of software development some time in the future
[05:09:06] greenride: Faraday modifies headers by uppercasing, pre-pending HTTP_, and transforming '-' to '_'. I currently have a header that is transmitted from one rails server to another in a dev environment but not on a test server on AWS. Is the cause most likely some quirk in Faraday, AWS stripping out headers, or a quirk in my application?
[05:11:36] s2013: hi sevenseacat how are you? i miss your sarcasm and snarkyness
[05:11:53] sevenseacat: it hasnt gone anywhere
[05:12:03] s2013: put a noob in his place
[05:12:16] sevenseacat: only when he deserves it
[05:12:42] s2013: woah.. thats sexist.. what if its a she?
[05:12:48] s2013: jk. its irc. there are no women on irc
[05:12:55] sevenseacat: then its not 'his place' is it
[05:13:33] s2013: ah there it is. yay
[05:31:07] Radar: s2013: I miss your help vampirism ;)
[05:31:28] Radar: If only you could spare some time to help out in this channel like sevenseacat does on a daily basis?
[05:31:54] Radar: Compare: http://logs.ryanbigg.com/p/s2013/activity vs http://logs.ryanbigg.com/p/sevenseacat/activity
[05:32:38] sevenseacat: to be fair a lot of that is because i just gasbag about all kinds of crap.
[05:38:54] luser0: Hi guys, I've got a weird issue. When I am trying to upload images from my nested form, they don't get saved in database. I've tried everything I could think of, but failed. Could you please take a look in here? https://gist.github.com/8cbe4881296e65d43ddb No idea why it doesn't work :F
[05:40:11] sevenseacat: luser_: https://gist.github.com/luseerr/8cbe4881296e65d43ddb#file-gistfile1-txt-L24 gallery_images_attributes is not a scalar value
[05:40:20] sevenseacat: its an array of stuff
[05:40:42] luser0: Oh right, sevenseacat that's just temp thing. I was trying to check what I get in params.
[05:41:03] luser0: When I call gallery_params from console I get title and description only
[05:41:10] luser0: When I call params instead, I get full object.
[05:41:18] sevenseacat: because gallery_images_attributes is being dropped
[05:41:24] sevenseacat: because its not a scalar value, its an array of stuff
[05:41:43] luser0: Okay, what should I look for in google?
[05:41:47] sevenseacat: http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters
[05:42:13] s2013: Radar, wow, after all ive done
[05:42:23] s2013: im hurt :(
[05:46:55] rhizome: BOURBON <shakes fist>
[05:49:12] errakeshpd: How can i get the difference of two date_times in seconds , ie. 2016-02-25 01:16:39 - 2015-02-20 04:16:39 = "in seconds" ?
[05:49:13] basichash: I'm using rails devise, this is my model: https://gist.github.com/anonymous/97568454b522e457382a. How do I create a seperate model when creating a User based of a param?
[05:49:20] pontiki: whisky is what ye need, boyo
[05:49:47] vedu: pontiki: is that a gem? :D
[05:50:22] s2013: errakeshpd, convert them to unix timestamp
[05:50:24] s2013: and subtract them?
[05:50:47] luser0: Ok sevenseacat, this moved me one step forward: params.require(:gallery).permit(:description, :title, gallery_images_attributes: [:photo]) since now I get full hash in my gallery_params, but photos still doesn't get saved :\
[05:50:48] pontiki: a nice islay is
[05:51:34] sevenseacat: luser_: https://gist.github.com/luseerr/8cbe4881296e65d43ddb#file-gistfile1-txt-L72
[05:52:49] rhizome: pontiki: now, yes!
[05:52:55] tejas-manohar: any rails developers looking to join a team of distributed freelancers? http://appupa.com/ - weekly availability should be 10-20 hours, you won't be necessary EVERY week but as we get more projects, most. alright frontend skills are preferable, not just backend APIs but you don't have to be a designer.
[05:53:09] rhizome: trying to experiment with sherry bombs these days
[05:54:10] tejas-manohar: lowest compensation is $40/hr, but if you have experience we don't mind paying $50, $60 etc-- but not looking for rockstar $150/hr devs and all :P -- please email portfolio + details to jobs@appupa.com or msg me now on freenode (but i don't come on here all that often otherwise)
[05:54:25] rhizome: basichash: do what now?
[05:54:29] pontiki: ACTION sets up a couple of tumblers and pours an inch neat into them and sets one in front of rhizome 
[05:54:55] s2013: tejas-manohar, are they all bunch of hh folks
[05:54:56] luser0: sevenseacat: Changed it in my params to allery_images_attributes: ['gallery_image'] and now in gallery_params I get a hash which looks like this: => {"description"=>"", "title"=>"", "gallery_images_attributes"=>{"0"=>{}}}, closer :P
[05:55:15] sevenseacat: luser_: where are you getting gallery_image from?
[05:55:20] rhizome: tejas-manohar: forty us dollars?
[05:55:23] tejas-manohar: s2013: not anymore, we're on-boarding more folks from outside
[05:55:25] basichash: rhizome: basically i want to run another method when a new User is registered
[05:55:32] tejas-manohar: rhizome: yes, starting at that much
[05:55:46] s2013: hh people seem like they would be horrible to work with
[05:55:51] tejas-manohar: our team section isn't wholly up-to-date, we're going through onboarding of more people
[05:55:52] s2013: atleast the ones that are active
[05:56:01] tejas-manohar: s2013: these ones aren't, haha no node.js fanboys
[05:56:06] rhizome: you need bigger jobs so everybody can be paid decently. us taxes take 1/3 of that, plus health ins, etc.
[05:56:16] s2013: rhizome, they are mostly hs/college kids
[05:56:17] luser0: sevenseacat: I am supposed to get it from gallery_image model through association with gallery, am I wrong?
[05:56:17] rhizome: half of what a plumber makes
[05:56:21] tejas-manohar: 16% 1099 tax iirc
[05:56:29] tejas-manohar: s2013: mostly college students, ash.co is joining us who isn't
[05:56:32] sevenseacat: luser_: what params are you submitting?
[05:56:38] tejas-manohar: rhizome: ^^ about taxes
[05:57:00] tejas-manohar: rhizome: that said, what hourly rate you at?
[05:57:02] rhizome: 16% never heard that before
[05:57:05] luser0: sevenseacat: :title, :description and :gallery_images[:photo]
[05:57:10] s2013: its not a set #
[05:57:14] s2013: depends on all your income
[05:57:15] sevenseacat: luser_: so, where are you getting gallery_image from?
[05:58:27] luser0: From :gallery_images[:photo] attr?
[05:58:36] rhizome: i'm just curious about this 16% number
[05:58:52] sevenseacat: if you're submitting a photo param, why are you permitting a gallery_image param
[05:58:56] tejas-manohar: rhizome: sorry
[05:59:45] tejas-manohar: rhizome: On the first $113,700 of income, that???s a whopping 15.3% rate. Beyond $113,700, the rate drops to 2.9%. -- this is for 1099 contractors AFAIK, we have someone else for legal + a CPA to handle these things. but most of it happens on your individual filing, we'll send over 1099s jan of next year
[06:00:08] pontiki: in the US, as well, if you're working on a 1099, you also get to pay your own payroll taxes in addition to income taxes, yippee!
[06:00:10] Varun_krishna: Hi guys what is wrong with this migration ? https://gist.github.com/Varun-Krishna-P/43959a13591d0072651e
[06:00:23] s2013: generally you get higher pay if you are contractor
[06:00:27] sevenseacat: Varun_krishna: the comma
[06:00:28] s2013: but the hassle sometiems isnt worth it
[06:00:45] tejas-manohar: pontiki is correct
[06:01:01] luser0: sevenseacat: Thought I have to do it like that because I've got nested f.fields_for
[06:01:22] sevenseacat: luser_: absolutely nowhere is gallery_image referenced anywhere
[06:01:23] rhizome: yes, that must be the remaining 14+%
[06:01:27] basichash: how can I set username to nil if it's not given for devise?
[06:01:34] Varun_krishna: sevenseacat: https://gist.github.com/Varun-Krishna-P/43959a13591d0072651e#file-migrationfile-rb-L4 the comma was added by the migration itself.
[06:01:46] sevenseacat: Varun_krishna: on the previous line.
[06:01:47] Varun_krishna: Ok I'll remove the comma and try it out.
[06:01:49] luser0: sevenseacat: Yeah, it isn't.
[06:02:03] Varun_krishna: sevenseacat: Ok.
[06:02:28] tejas-manohar: rhizome: yeah, as usual w/ contractors. i'd be interested in hearing your desired rate, we can go from there.
[06:02:46] pontiki: Varun_krishna: it's because you put a comma in the rails generate command
[06:03:03] basichash: if someone knows this i'll water my fern
[06:03:10] tejas-manohar: s2013: btw, generally don't have to deal w/ HH'ers like the ones active in that group, haha. I muted notifications and unfollowed, left for a while too, as they can get quite irritating-- also, you'll work alone for most tasks individually assigned to you.
[06:03:16] tejas-manohar: s2013: looking for any work?
[06:03:16] Varun_krishna: pontiki: Yeah, Just now I found it out . Than you :)
[06:03:20] Varun_krishna: sevenseacat: Thank You :)
[06:04:26] pontiki: WON'T SOMEONE THINK OF THE FERNS???
[06:04:44] Varun_krishna: I want to store hours:minutes in my database , so what migration should I write ?
[06:04:52] basichash: he's looking pretty dehydrated right now, not gonna lie
[06:05:04] sevenseacat: Varun_krishna: what field type stores hours and minutes?
[06:05:14] Varun_krishna: sevenseacat: Date.
[06:05:27] Varun_krishna: But I have two fields one for hours and another for minutes.
[06:05:28] sevenseacat: so whats your question?
[06:05:41] sevenseacat: so store them as two fields?
[06:06:04] Varun_krishna: *two dropdowns for hour and another for minutes.
[06:06:21] sivsushruth: basichash read this, https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address
[06:06:25] Varun_krishna: sevenseacat: Storing it as two fields is not a bad idea ? I thought it was a bad idea.
[06:06:34] sivsushruth: basichash grab essential content from here and apply it to your sceario
[06:06:36] sevenseacat: you can store it however you want.
[06:06:39] luser0: sevenseacat: I might be retarded, but I still didn't figure it out :D.
[06:06:40] sivsushruth: should be straightforward
[06:06:42] sevenseacat: you can store it as two or combine it into one.
[06:06:49] sevenseacat: luser_: what problem are you having now?
[06:06:54] basichash: sivsushruth: i have now watered the fern, thank you
[06:07:06] pontiki: *storage* is an entirely different issue that *gathering input*
[06:07:15] Varun_krishna: sevenseacat: How do I combine them to one field in the database ?
[06:07:24] luser0: Still not sure what to pack inside .permit() to be able to save these files
[06:07:38] sevenseacat: Varun_krishna: are you going to give me your paycheck too?
[06:08:10] Varun_krishna: sevenseacat: He he he , no :(
[06:08:26] sevenseacat: you cant just answer every suggestion with 'ok tell me how to do that'
[06:09:59] Varun_krishna: sevenseacat: Yes I understand it. But I don't know how to generate a migration for that, which combines two fields from view .
[06:10:08] sevenseacat: its got nothing to do with a migration
[06:10:36] Varun_krishna: sevenseacat: Ok, I'll try it out and get back to you.
[06:11:24] sivsushruth: https://news.ycombinator.com/item?id=9066379
[06:14:10] basichash: sivsushruth: right so i found the migration where users was created, how can I change it to default: null?
[06:14:38] basichash: sivsushruth: actually it's in schema.rb to be accurate
[06:16:20] basichash: sivsushruth: will i also have to set null: true?
[06:17:16] basichash: also will <input value=""> override the default value? i.e. will rails ignore the empty string value and use the default value instead?
[06:17:25] sivsushruth: basichash yes
[06:17:38] basichash: sivsushruth: so changing default: null won't do anything?
[06:17:41] sivsushruth: basichash you have to set null true
[06:17:47] basichash: sivsushruth: ah ok
[06:18:12] sivsushruth: and what you can do is, in before_save if username.blank? ; username=nil;
[06:18:16] sivsushruth: something like this
[06:20:52] sivsushruth: basichash add this to your migration if you already have username column => change_column :users, :username, :string, :null => true
[06:21:10] sivsushruth: basichash read this too https://stackoverflow.com/questions/11372486/how-to-set-devise-to-require-one-of-email-or-username-to-be-populated-for-saving
[06:21:46] basichash: sivsushruth: thanks, and also default => :null if most users won't have a username?
[06:21:55] basichash: *:defualt => null
[06:21:58] luser0: https://gist.github.com/anonymous/072e947a73425c2ab5f4 this is where I am sevenseacat, is that a good direction?
[06:22:13] sivsushruth: basichash Yes
[06:22:25] sevenseacat: luser_: again, you dont have gallery_image anywhere, why do you keep listing it
[06:24:58] luser0: sevenseacat: Just trying to understand why this isn't enough: gallery_images_attributes: [:photo]
[06:25:09] sevenseacat: who says its not enough?
[06:25:23] luser0: Well, image doesn't save, thought it's wrong.
[06:25:39] sevenseacat: (13:51:33) sevenseacat: luser_: https://gist.github.com/luseerr/8cbe4881296e65d43ddb#file-gistfile1-txt-L72
[06:25:46] sevenseacat: you're rejecting all of the images.
[06:26:07] sivsushruth: http://robots.thoughtbot.com/rails-on-docker
[06:27:32] basichash: sivsushruth: hmm didn't seem to work, still getting that empty string value ("")
[06:27:44] luser0: Ok, after removing this lambda part I get missing attr_accessor for 'photo_file_name', step forward, thanks for your patience sevenseacat.
[06:28:02] basichash: sivsushruth: this was my migration change_column :users, :username, :string, :null => true, :default => nil
[06:28:20] sivsushruth: basichash read my above comments, I suggested you to use a before_save to check if the string was empty, if it was the assign nil to the username
[06:28:49] basichash: sivsushruth: ah missed that
[06:29:09] basichash: sivsushruth: is that in the model?
[06:29:19] sivsushruth: basichash Yes
[06:29:43] wethu: Has anyone here used any gems from the trailblazer project? https://github.com/apotonick/trailblazer
[06:29:56] sevenseacat: ive read about it, havent tried any out yet
[06:30:10] sevenseacat: bought the trailblazer book
[06:30:24] wethu: likes, dislikes ?
[06:30:38] sevenseacat: havent tried any out yet
[06:30:57] wethu: the author is a colleague ...
[06:32:21] wethu: half the project we're working implements concepts from that, and the other half is done with traditional vanilla rails way
[06:35:25] wethu: if only this rain would stop
[06:36:34] sivsushruth: wethu http://www.trailblazerb.org/ the site is incomplete. a lot of instances of lorem ipsum :p
[06:37:02] sivsushruth: just letting you know
[06:37:15] tamouse__: wathu, i've looked at cell, but haven't used it. i am enamoured of his concept, however
[06:38:29] sargas: does rails 4.2 have a known issue loading precompiling or serving assets slowly?
[06:38:49] basichash: sivsushruth: if i want to create another model instance when someone registers, what's the best way tto achieve that? I thought about checking for the existance of a user with the new users email address (unique and required), but then this is always being called years after the user has registered
[06:39:07] basichash: or does it not really matter?
[06:39:25] sargas: My application has a view with just an audio tag, it is playing mp3 files, though with slow loading, but it refuses to play ogg
[06:39:25] tamouse__: sargas: on an old 3.1 app, it used to take about 12 minutes to precompile the assets. what's slow?
[06:39:49] tamouse__: are you precompiling an audio file??
[06:39:59] sargas: tamouse__: no
[06:40:17] sargas: tamouse__: it's just in a dev env anyways, haven't even tried to precompile
[06:40:30] sivsushruth: basichash use validations
[06:40:46] sivsushruth: basichash https://stackoverflow.com/questions/12686131/unique-usernames-in-devise-for-rails
[06:40:50] sargas: tamouse__: but webrick is failing to shutdown when I press crtl + C
[06:40:55] tamouse__: sargas: apologies, you were asking about precompiling time, i assumed it was a continuation of that
[06:40:55] luser0: sevenseacat: Works like a charm. Thanks for all your help.
[06:41:23] sargas: tamouse__: I apologize for not being clear on my question
[06:41:30] sargas: I'll make a gist of my app
[06:42:08] tamouse__: is webrick serving the audio file?
[06:42:21] basichash: sivsushruth: this isn't about validation, that was just a method of determining whether the user is a new user (nearly registered) or not
[06:42:40] basichash: sivsushruth: basically i want to call a callback everytime a new user signs up
[06:43:07] sivsushruth: basichash got it, https://stackoverflow.com/questions/4702806/how-to-add-callback-after-registration-with-rails3-and-devise
[06:43:13] tamouse__: you want to use after_create, then, basichash ?
[06:43:31] sivsushruth: yes, use an after_filter
[06:43:41] basichash: what's the difference?
[06:43:55] sivsushruth: this is in the registrations controller through
[06:44:14] sivsushruth: or you can use an after_create in the user model
[06:44:19] sivsushruth: either way works
[06:44:58] tamouse__: might be a question of what you're going to do after the user is signed up
[06:45:13] tamouse__: there's already hooks for sending mails, forex
[06:45:36] sargas: here is the Gist for my application (it is that simple right now)
[06:45:37] sargas: https://gist.github.com/anonymous/04066739291e7e4bdda9
[06:46:10] sargas: I am not sure why the ogg file is not being loaded, the browser keeps loading and loading, and I'm never able to play
[06:46:53] sivsushruth: sargas check developer console to see if the data is actually coming in, also check the webrick logs
[06:47:00] sivsushruth: try posting the logs to the gist
[06:47:01] sargas: then I try to shut webrick down with ctrl + C and it stops responding until I do ctrl + C a second time, that's when I get the errors
[06:47:51] sargas: sivsushruth: Started GET "/assets/audiotest-b8e239be11aa09715a5049a8909c8e11.ogg" for at 2015-02-20 06:36:03 +0000
[06:48:01] sargas: it's trying to serve it I think
[06:49:03] basichash: sivsushruth: how can i turn on Rails.logger?
[06:50:14] tamouse__: don't put the audio (or any media) files in your assets
[06:50:19] tamouse__: put them directly in public
[06:50:27] sargas: I'm wondering if, because the audio files are in the assets folder, sprockets are trying to precompile them...
[06:50:37] sargas: and that is causing the problem
[06:50:38] basichash: specifically Rails.logger.debug
[06:51:15] sargas: tamouse__: I'll try that
[06:51:23] tamouse__: remember also, webrick is not built for serving multiple requests of any kind
[06:51:44] sargas: tamouse__: I'm aware of that
[06:51:49] sivsushruth: tamouse__ try with a unicorn/thin server
[06:51:59] sivsushruth: check if you have the same issue
[06:52:09] tamouse__: well then issues with burping interrupts should be expected, no?
[06:52:11] sargas: is the Rails way to put only text files like scss and js in the assets folder?
[06:52:24] tamouse__: sivsushruth: this isn't my issue
[06:52:38] sivsushruth: basichash https://pooreffort.com/blog/better-rails-logging/
[06:52:39] tamouse__: small images are okay, too
[06:52:50] sargas: sivsushruth: I was thinking that, but I'll try tamouse__'s suggestion and move the files to the public folder
[06:53:03] sargas: and delete the contest of tmp/cache
[06:53:15] sargas: contents*
[06:53:32] tamouse__: while your at it, restart the server, stop spring if it's running
[06:53:40] basichash: sivsushruth: thanks
[06:53:55] sivsushruth: basichash also read this for more configs http://guides.rubyonrails.org/debugging_rails_applications.html
[06:54:59] cryo28: the rule of thumb is to put into assets directory just the files which are a part of your application code (css js images referenced from css) - whatever you commit to repository. And the public folder should contain the files which represent publicly available data of your application
[06:55:46] tamouse__: a corrolary to that is don't put your large media files into your code repository *either*
[07:01:04] sargas: cryo28: I agree, the audio files are going to be huge, but they are tied to model instances, so I thought I could put them in the assets folder inside my app
[07:01:16] tamouse__: they are just data
[07:01:18] sargas: I guess wasn't a viable solution
[07:01:23] tamouse__: they aren't tied to model implementation
[07:01:45] sargas: tamouse__: true that, I was just my imperfect way of thinking
[07:02:49] tamouse__: it's a common enough mistake
[07:03:08] tamouse__: someone did that with some videos on one project i was working on
[07:03:40] tamouse__: we couldn't understand why our development slowed down so much
[07:03:53] tamouse__: checkouts became so painful
[07:04:07] arup_r: Radar: Any idea on this ? http://stackoverflow.com/questions/28604786/in-spree-how-to-set-status-active-inactive-for-the-product
[07:06:10] sargas: tamouse__ sivsushruth : webrick errors in the Gist https://gist.github.com/anonymous/04066739291e7e4bdda9
[07:06:35] tamouse__: "Perfection is attained not when there is not more to add, but when there is nothing more to take away." Antoine de St. Exupery
[07:06:44] basichash: sivsushruth: hmm should 'Rails.logger.debug "TESTING"' log to rails server console?
[07:07:01] sargas: could you see if the problem is evident from the errors? I can't pin-point the problem form the errors
[07:07:03] basichash: sivsushruth: i mean the function that code is in is definitely being called
[07:07:15] tamouse__: i don't see them, sargas
[07:07:49] sargas: tamouse__: Sorry here is the correct URL https://gist.github.com/andradei/a80a3e8cba43d323d563
[07:09:32] tamouse__: i don't know what's happening inside webrick. i'm not sure why you're worrying about it
[07:09:46] tamouse__: isn't the point your interrupting it to shut it down?
[07:10:53] sargas: tamouse__: I guess I'm worrying too much about having to press ctrl + C twice because it "freezes" on the first time
[07:11:07] tamouse__: it's still playing the audio, isn't it?
[07:12:29] basichash: I can call Rails.logger in my models and in rails console, but they're not showing up in rails server. How can i get this owkring?
[07:13:10] sivsushruth: basichash check the second link i sent, you can enable it in the config file
[07:13:30] sargas: tamouse__: it is playing now :) the audio controls on the browser are behaving weird though
[07:13:37] sargas: it works fine when I serve mp3
[07:13:49] sargas: but ogg seems a little crappy-loading still
[07:13:56] sargas: but that's progress
[07:14:00] sargas: tamouse__: thanks for the help
[07:16:37] basichash: sivsushruth: thanks again
[07:38:00] tbuehlmann: any idea how to let rails recognize /files/foo/bar/baz as the show action for `resources :files`?
[07:38:27] tbuehlmann: trying to stay with `resources`, I know `get` would work
[07:44:29] arup_r: sevenseacat: Any idea ? http://stackoverflow.com/questions/28604786/in-spree-how-to-set-status-active-inactive-for-the-product It made surprised us.. :-)
[07:45:12] sevenseacat: arup_r: the answer already answers it.
[07:45:31] arup_r: sevenseacat: No.. Please read the update we have given
[07:45:34] sevenseacat: adding an extra field is pointless.
[07:45:36] arup_r: How that also worked
[07:45:49] sevenseacat: now undo what you did.
[07:45:59] sevenseacat: and do what gmacdougall suggests.
[07:46:25] arup_r: When we added the field.. we were not aware of this way we could implement it.. :-)
[07:46:42] arup_r: sevenseacat: We wrote half code and things worked as expected.. :p
[07:47:48] arup_r: sevenseacat: downvoted ... someone why? no idea
[07:54:32] sevenseacat: you've added a field and now you're asking what to do with it, it shows zero research effort, you got an answer and are ignoring it
[07:58:02] arup_r: sevenseacat: Humm.. Cool!
[07:59:06] arup_r: sevenseacat: I researched and then thought that way.. But before completing code..it started working, there I got confused. I thought I'
[07:59:23] sevenseacat: completing *what* code? you havent shown any
[07:59:24] arup_r: ll add here one more where clause for the functionality https://github.com/spree/spree/blob/master/core/lib/spree/core/search/base.rb#L20
[07:59:39] sevenseacat: you've shown the declaration of a field and thats it
[07:59:48] arup_r: But before adding that.. things are functional.. And I got surprised
[08:00:21] arup_r: That's not me.. My stupid co-worked posted half way.. Damn!
[08:00:42] sevenseacat: then they deserve their downvote
[08:00:53] arup_r: Humm.. Give him one more ;)
[08:05:41] tagrudev: I need to set a url in my initializer based on the current env what's the smartest//correct way of doing that ?
[08:29:29] frojnd: Hi there.
[08:32:15] frojnd: I just renamed one of my columns from content to description using Rails migration FixColumnName and def change and ran db:migrate. If I go to console I can see new name is in use. However when running Rake test I get bunch of erros saying ActiveRecord::StatementInvalid: ActiveRecord::StatementInvalid: SQLite3::SQLException: table bumblebees has no column named content: INSERT INTO "bumblebees"
[08:32:17] frojnd: ("content", ...) Any ideas?
[08:33:14] cryo28: frojnd: Did you also update your code?
[08:33:35] frojnd: cryo28: yeah, I've :%s/content/description
[08:34:00] cryo28: frojnd: In what rails environment do you encounter this problem?
[08:34:45] cryo28: frojnd: If it is not development - you need to also restart rails server
[08:35:29] frojnd: cryo28: it's development
[08:35:32] cryo28: frojnd: And what rake task are you running?
[08:35:50] cryo28: sorry rake test...
[08:35:55] sevenseacat: are you running rails 3? if so, you need to rake db:test:prepare
[08:36:02] cryo28: I believe you need to recreate test db as well
[08:36:08] cryo28: run rake db:test:prepare once
[08:36:13] frojnd: cryo28: just rake test
[08:37:18] frojnd: cryo28: I did ran rake db:test:prepate but after running rake test again I still get those errors
[08:37:43] sevenseacat: do you have factories or tests that are still using the old column?
[08:37:49] frojnd: sevenseacat: 4.2.0.rc3
[08:38:12] frojnd: sevenseacat: I think not, I've greped for "content"
[08:38:19] frojnd: sevenseacat: but jsut to be sure I'll do it again
[08:38:33] sevenseacat: can you gist the full error?
[08:38:42] cryo28: frojnd: just a blind guess - try to restart spring
[08:39:14] sevenseacat: ooh good call
[08:39:36] cryo28: yeah. it is running in your console in background now
[08:39:47] cryo28: you can check it by running spring status
[08:40:01] frojnd: cryo28: not running
[08:40:36] cryo28: frojnd: show us the full error message then
[08:43:46] frojnd: cryo28: ok. Just a sec I'll try to install gist into vim to see how it works
[08:44:56] Macaveli: I hate it when you merge code
[08:45:01] Macaveli: and have to fix everything by hand
[08:45:07] Macaveli: 20 files of manual fixes -.-
[08:46:22] phikes: Hi, is it possible to pass in integer values for enum attributes with Rails 4?
[08:47:48] quazimodo: in mvc world we have a controller, people hit the controllers actions via their urls
[08:47:53] quazimodo: and the verb
[08:48:04] quazimodo: so, what is an object called if it calls the controllers?
[08:48:16] universa1: quazimodo: what?
[08:48:34] quazimodo: universa1: an object that calls the methods on a controller, passing in relevant data
[08:48:42] universa1: quazimodo: context?!
[08:49:03] frojnd: cryo28: https://gist.github.com/frojnd/1bb040f25bb62e24277a
[08:49:34] quazimodo: the controller spits the output out not to a browser, but to a file on some drive. We want to go through 10 'pages' of paginated links and have all that written to the drive. we want to do this programmatically.
[08:49:52] cryo28: quazimodo: hmmm. dispatcher?
[08:49:59] quazimodo: dispatcher makes sense
[08:50:29] quazimodo: universa1: get it?
[08:51:10] universa1: kinda, i don't see the naming problem though. so instead of people calling your app you've some program calling your app, not much of a conceptual difference imho.
[08:51:40] cryo28: frojnd: Unfortunally these error messages are not really helpful as the do not have backtraces :(
[08:51:59] universa1: phikes: !try
[08:51:59] helpa: phikes: Why don't you try it and find out for yourself?
[08:52:11] frojnd: cryo28: can I include backtraces?
[08:52:38] quazimodo: universa1: sure, what's the name of that 'pattern'?
[08:52:43] quazimodo: surely it must be done elsewhere
[08:52:45] quazimodo: it's very useful
[08:52:47] cryo28: frojnd: Looks like you are using Test::Unit which I am not familiar with. But yes, there must be some way to turn on backtrace output
[08:52:58] universa1: quazimodo: caching?
[08:53:21] phikes: universa1: Pardon?
[08:53:32] Macaveli: Is there a default variable for ""?
[08:53:35] universa1: phikes: open rails c, assign an integer and see if it works?
[08:53:39] universa1: Macaveli: what?
[08:53:44] Macaveli: now I'm returning an empty string but I think "" is ugly
[08:53:53] Macaveli: "" = empty string :)
[08:54:00] Macaveli: but is there a variabe like nil for example
[08:54:08] Macaveli: but nil >< ""
[08:54:08] universa1: Macaveli: nil is not a variable.
[08:54:14] phikes: Ah, well I should have asked differently: Is there a way to.... I already tried directly assigning and mass-assigning, both don't work
[08:54:19] Macaveli: variable is not exact right word
[08:54:23] universa1: <Macaveli> but is there a variabe like nil for example ...
[08:54:32] Macaveli: now I do this: return it.sap_id if it else ""
[08:54:37] Macaveli: but I think it's ugly
[08:54:44] cryo28: Macaveli: No, there are no such built-in variable. You can create a constant if you want to. However, this is not a common practise to return an empty string. I bet you want to return nil instead.
[08:54:56] universa1: Macaveli: no, there is no keyword that i know of for a an empty string.
[08:55:03] quazimodo: universa1: it's not strictly caching
[08:55:33] quazimodo: here i am reading about double dispatch, not getting it. Only te realise I have LISP code sitting on my hdd that I wrote using multiple dispatch :P
[08:55:43] frojnd: I'll just checkout git checkout -- and start over again
[08:56:03] phikes: universa1: Ah, well I should have asked differently: Is there a way to.... I already tried directly assigning and mass-assigning, both don't work
[08:56:28] universa1: frojnd: rm db/test.sqlite3
[08:56:29] universa1: frojnd: and run rake test again
[08:56:30] cryo28: frojnd: Sure. Watch out for some usages of content attribute, or spring running some old version of your code
[08:56:40] universa1: frojnd: are you using fixtures?
[08:57:40] universa1: phikes: assigning an integer works for me
[08:57:55] universa1: phikes: !code
[08:57:55] helpa: phikes: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[09:02:47] frojnd: universa1: yeah I'm using fixtures
[09:02:58] universa1: frojnd: gist your bumblebees fixtures file
[09:03:37] frojnd: universa1: ah, I just checkout `git ls-files -m` :s
[09:04:52] phikes: universa1: I figured its another problem, thanks for your help anyway. I have to dig deeper
[09:04:54] frojnd: how can I revert to the database so I'll have :content and not :description ? I tried db:rollback but it's not changing
[09:05:14] frojnd: I guess I'm asking how to list all the database versions of migrations
[09:05:30] universa1: frojnd: since you're developing anyways and won't have any important data in it: rm db/development.sqlite3; rake db:migrate
[09:07:33] frojnd: universa1: ok. And now I guess I have to edit source code from changing :content into :description ? Because I still have those errors
[09:07:52] artmann: When using sidekiq for imageuploads, how do you make sure the deamon is running?
[09:09:09] universa1: frojnd: you said you reverted all your changes...
[09:09:23] frojnd: universa1: yeah, but maybe I ran before db:migrate twice :)
[09:09:24] universa1: frojnd: ahh you kept your new migration ;)
[09:09:38] frojnd: universa1: unfortnatelly yeah
[09:09:42] universa1: frojnd: well
[09:09:55] universa1: frojnd: now have a look at your bumblebees fixture file
[09:11:31] frojnd: universa1: yeah, it's still :content also in other source files and now my databse have :description (new migration) :)
[09:11:43] frojnd: I can fix source files and see if helps
[09:12:09] universa1: frojnd: :-)
[09:12:37] cryo28: artmann: "daemon" being sidekiq workers ?
[09:13:16] frojnd: universa1: wouldn't db/migrate/schema.rb have to change by itself or do I have to change it manually?
[09:13:38] frojnd: Because I see version: datetime in this file
[09:14:05] universa1: frojnd: you should never manually touch db/schema.rb
[09:14:29] frojnd: universa1: ok then something went wrong when I tried to change column name in a table
[09:14:41] universa1: frojnd: if there is version: datetime, then your migration specifies it ;)
[09:15:00] frojnd: yeah and it's set 2 days behind :)
[09:15:59] artmann: cryo28: yeah
[09:16:53] cryo28: artmann: My sidekiq workers are run and monitored by upstart. But any other solutions should work equally well.
[09:17:25] artmann: Okey I've been running it through bundle
[09:17:39] artmann: RAILS_ENV=$ENV bundle exec sidekiq -C ./config/sidekiq.yml -d
[09:18:35] artmann: maybe something like this will work https://github.com/mperham/sidekiq/tree/master/examples/upstart/manage-one
[09:23:20] cryo28: artmann: bundle does not matter. You just need some tool to start and monitor your process. It can be upstart, systemd, runit or god.
[09:23:32] artmann: okey I'll give upstart a try
[09:24:01] cryo28: artmann: your link is just an example config file for upstart to manage sidekiq processes
[09:24:11] fabionl: Hello! In my app I have a period model which has a start and an end date. When an end date is reached, I want to send an automatic email to some users.. how should I do that? The only option I can see is a cron/sidekiq job that checks everyday if an end_date of any period is reached
[09:24:57] cryo28: artmann: so yeah it should work. You can also take a look at foreman gem to automatically generate configs for upstart or systemd
[09:25:19] cryo28: artmann: https://github.com/ddollar/foreman
[09:26:53] cryo28: F__i__L: cronjob or clockwork job looks good. Sidekiq worker won't be of much help as something will still have to schedule this nighly job. sidekiq has some built-in scheduling but it means that sidekiq worker process will be running idle during the whole day just to execute one nightly job
[09:28:53] artmann: cryo28: nice, I'm more of a init.d kind of guy so I'll have to do some reading on upstart
[09:29:49] cryo28: artmann: foremand can generate sysV-style init scripts as well. The only thing which I am not sure is whether the autogenerated scripts will monitor the child processes.
[09:31:24] frojnd: universa1: ok, I just ran console --sandbox and Bumblebee shows :content text so it's back to "original" But I don't know why it still shows those errors :)
[09:31:42] shmoon_: I get this error on executin bundle http://pastie.org/private/79s31xyz0799rmte6y9lq
[09:31:48] shmoon_: wonder whats wrong, am on Mac
[09:37:29] cryo28: shmoon_: I guess there is some mismatch in local openssl shared object (dylib) and ruby binary (which depends on openssl). I think you should either recompile ruby or restore openssl shared objects ruby expects
[09:37:50] cryo28: shmoon_: I cannot help any more as I am not a Mac user
[09:41:22] Pharaoh2: shmoon_: you updated your openssl but your ruby is linked to old version of openssl
[09:41:32] Pharaoh2: rebuild ruby
[09:42:54] sandelius: when updating a model and its has_many relation e.g @post.update(comment_ids: ids) a query is run to check if each comment exists. Is it possible to tell rails that each comment also needs to be associated to another model e.g blog ?
[09:42:58] neredsenvy: Is there an easy way to return an image instead of view in rails ?
[09:43:09] neredsenvy: Writing an API
[09:43:25] universa1: neredsenvy: send_file "path/to/file" ?
[09:43:37] sandelius: send_data open("#{Rails.root}/path/to/file.gif", "rb") { |f| f.read } .......
[09:44:09] universa1: sandelius: why the extra work with send_data ? ;)
[09:44:38] sandelius: universa1 if he needs to do stuff with the file before :) Extra complexity ftw :)
[09:44:45] universa1: sandelius: :-)
[09:44:53] sandelius: universa1 got it right
[09:45:17] universa1: yeah, you got it right if it's a "temp"/in memory file
[09:46:06] universa1: send_file has the added benefit that it can be passed on to the front-end server (nginx/apache) and that removes some work from your app
[09:49:24] syncn: hello, im trying my first switch from development to production application mode. i had some trouble with migrating the db and compiling assets, but iv got the app working by running commands with RAILS_ENV. im curios about these commands: are they setting bash environments? how can I print them to see what they're set to? print $RAILS_ENV prints an empty line.
[09:50:09] universa1: syncn: RAILS_ENV=production bundle exec rake db:migrate; just sets the env variable for the command being run. it is gone afterwards
[09:51:17] syncn: ah, I see.
[09:52:08] syncn: universa1: thanks for the help
[10:03:18] neredsenvy: Hm I seem to have a small problem I have a method that returns an image using send_image the route however is POST 'images/{apikey} because if I do a GET and put image name in the url the image name extension gets trimmed off. However using POST I get an error no route matches GET 'images/{apikey}' .. no I don't have a static images folder anywhere.
[10:03:24] neredsenvy: What am I missing here
[10:03:58] universa1: neredsenvy: apikey is your image name?!
[10:04:09] universa1: neredsenvy: !code
[10:04:09] helpa: neredsenvy: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[10:05:11] neredsenvy: universa1 No API key is required as first part of url as auth token https://gist.github.com/anonymous/f1a931c394a6ad5d1b2b the image name is in the post body
[10:06:39] universa1: neredsenvy: routes and error trace please.
[10:06:47] universa1: neredsenvy: also how are you making the request? curl?
[10:06:58] neredsenvy: using POSTman
[10:07:40] universa1: neredsenvy: add also the data from the log file for your request to the gist.
[10:09:41] neredsenvy: universa1 https://gist.github.com/anonymous/bb7a754acf727fee0329
[10:10:04] neredsenvy: The route is defined as post "images/:ssid" yet it get's over as GET ...
[10:10:05] universa1: neredsenvy: you can edit your original gist.
[10:10:16] universa1: neredsenvy: well then you're sending a get request.
[10:10:49] neredsenvy: POST /images/cdb2b6c0ba7223a15656954faa1c2ea3 HTTP/1.1
[10:10:59] universa1: https://gist.github.com/anonymous/bb7a754acf727fee0329#file-log-rb-L1
[10:11:33] universa1: neredsenvy: you're probably looking at the wrong section of the log file...
[10:11:40] universa1: neredsenvy: tail -f log/development.log
[10:11:43] neredsenvy: OMG I am so stupid
[10:11:44] universa1: neredsenvy: then send your request again.
[10:12:01] neredsenvy: I have been making requests at a wrong server
[10:12:27] helpa: http://youtu.be/kfVsfOSbJY0
[10:24:38] brazenbraden: howdy fellas. Strange "bug" popped up this morning out of nowhere. App was working fine then all of a sudden it started breaking with an "unitialized constant" error. Seems like the engine is forcing the namespace again when trying to call controllers and/or models. I have a gist here, let me know what else you want me to add to it. https://gist.github.com/brazenbraden/08370b77c233e522c1aa
[10:29:20] frojnd: universa1: I've just reversed everything with git
[10:29:51] frojnd: I would like to write a model test for sound should be present. I have no idea how to test this.
[10:30:33] frojnd: universa1: I fixed the problem of errors before to reverse to older commit in git and start over
[10:30:46] Thylacinelol: is there a library like Ladda.js but with IE8 support?
[10:31:06] universa1: frojnd: not sure about test unit, but: instance.sound = nil; deny instance.valid? (no clue about actual test::unit syntax, since i'm not using that)
[10:31:11] universa1: Thylacinelol: google? ;)
[10:31:37] Thylacinelol: didn't found anything similar :(
[10:31:58] brazenbraden: now im getting: NameError (wrong local variable name `#$!' for #<Binding:0x007f1cdf656460>):
[10:32:07] brazenbraden: what is #$! ? lol
[10:32:24] sandstrom: Can `filter_parameters` someone be used on a per-controller level?
[10:32:43] universa1: Thylacinelol: ie 8 is used by 2,7% of the users...
[10:33:20] universa1: Thylacinelol: unless you need to specifacally support ie 8 because of some legacy reasons i would drop support / only provide a basic fallback solution.
[10:38:34] Thylacinelol: universa1: thanks :)
[10:44:38] shmoon_: rubby 2.2.0p481 - what is p481 ?
[10:45:13] shmoon_: so the next is p482 p483 and so on...
[10:45:29] shmoon_: patchlevel is like bug fixes ? or could be new features too
[10:45:46] universa1: shmoon_: not necessarily, there isn't a "release" on every patch-level iirc.
[10:45:53] universa1: shmoon_: should be bug fixes only
[10:53:01] Scott2619: I have a search box with a select box and I want to get the params from the select box into another method other than the one the search form is pointing to, is this possible?
[10:57:14] sivsushruth: Scott2619 Yes
[10:57:33] sivsushruth: sivsushruth you can use js to send requests
[10:59:02] Scott2619: how would I do that?
[11:02:44] sami: Hi, I'm having a problem parsing a URI. For some reason this machine does not seem to think my URL is parsable. It works fine on my other machine iwth the same URL. Atm I'm just testing with a partial of the URL which seems to fail. Could someone else test this for me?
[11:02:48] sami: https://gist.github.com/samimb/68681d12b22ee85b2744
[11:03:17] sivsushruth: Scott2619 google "send requests using javascript"
[11:10:02] sami: Seems to break at "*"
[11:43:55] dawkirst: Hey guys, at http://stackoverflow.com/questions/19078044/disable-activerecord-for-rails-4 the accepted answer suggests requiring just the frameworks you'd use when you want to remove ActiveRecord from your app. Where can I see a list of frameworks and what each does?
[12:24:19] jokke: anyone here used https://github.com/schneems/puma_auto_tune
[12:24:37] jokke: i'm trying to set it up but it seems not to be running
[12:24:45] jokke: i get no log messages whatsoever
[12:25:26] jokke: i wrote this initializer: http://p.jreinert.com/0lTVIg/ruby
[12:25:30] latco: Maybe anyone using ReactJS? Would you recommend it over AngularJS for SPA in pretty big rails app?
[12:28:03] x44x45x41x4E: Hi. I have this code: https://gist.github.com/x44x45x41x4E/ae7ec849fb21881b484c I want to create a record when a user updates a certain field in another record that's associated to it. But the `instance.attribute_changed?` method seems to result to false always.
[12:28:55] x44x45x41x4E: Clueless as to what I'm doing wrong. I don't want to use .nil? method on params since it still creates the record even if it isn't updated.
[12:29:27] syngress: Hi there, i try to play a little with WebService's, and i have small problem with this:
[12:29:29] syngress: gist:815be73e03b75409a637
[12:29:35] x44x45x41x4E: jokke: Tried that gem too before but removed it recently as I didn't saw any improvements.
[12:29:36] syngress: https://gist.github.com/anonymous/815be73e03b75409a637
[12:29:59] jokke: x44x45x41x4E: hmm
[12:30:53] x44x45x41x4E: syngress: What line exactly is having that error?
[12:31:36] arrowcircle: hi! i trying to make images for opengraph and twitter cards with format png. Whats best way to cache them and persist on disk?
[12:31:40] syngress: [:state] key does not exist
[12:33:52] cryo28: arrowcircle: are you running the app on multiple VMs or just on one?
[12:34:49] arrowcircle: cryo28, ideally i want to put it in public/uploads and serve as static with nginx, and only generate if missing
[12:34:52] cryo28: arrowcircle: in this case the simplest thing is just create files in some subdirectory in public (I presume the pngs should be downloaded by users without any restrictions)
[12:35:24] cryo28: And then you'll need to setup some cron job to clean up the expired ones (i.e. with find -atime)
[12:35:46] arrowcircle: cryo28, i mean how to configure controller to send file and nginx to serve it if it exists
[12:35:48] x44x45x41x4E: syngress: .present? method should work, maybe you don't have a :state hash at all?
[12:35:55] cryo28: aaa got you.
[12:36:22] cryo28: just call "send_file(path_to_file)" from the controller and nginx will take care of it
[12:36:35] cryo28: via X_Accel_Redirect header
[12:36:49] syngress: Yep, when i put in input wrong ZipCODE i get "nil", so i assume that hash does not exist
[12:37:02] cryo28: arrowcircle: http://apidock.com/rails/ActionController/Streaming/send_file
[12:37:13] arrowcircle: cryo28, problem is this will hit rails stack all the time
[12:37:21] universa1: arrowcircle: then put it in public/
[12:37:31] universa1: arrowcircle: and configure nginx / apache to serve files from there
[12:37:47] x44x45x41x4E: Could you try !data[:state].nil? ?
[12:37:51] universa1: arrowcircle: this makes them publicly available though, so you can't enforce any kind of access control anymore
[12:38:08] syngress: x44x45x41x4E: Yep, when i put in input wrong ZipCODE i get "nil", so i assume that hash does not exist
[12:38:10] arrowcircle: universa1, problem is all uploads are in public/uploads, and url to image is /articles/1.png
[12:38:18] cryo28: arrowcircle: if you want to completely avoid hitting rails stack just link to the file by its url
[12:38:24] arrowcircle: universa1, i dont need any access control
[12:38:31] universa1: arrowcircle: well then create the correct link.
[12:38:32] cryo28: like <img href="/uploads/myimage.png" />
[12:38:58] universa1: arrowcircle: if you create a link which is handled by rails, it will hit the stack.
[12:39:22] universa1: though tbh i don't see a problem with that at your stage of app development.
[12:39:35] arrowcircle: universa1, cryo28, i want to hit rails and generate it only if image dont exist. if it exist it should be served as static
[12:39:52] universa1: arrowcircle: well, then you need to use what cryo28 said.
[12:40:02] cryo28: arrowcircle: in this case you need to setup nginx redirect (see location and try_files directive)
[12:40:24] universa1: i'd honestly would go witht he simplest solution for now, which is: use send_file
[12:41:10] cryo28: arrowcircle: the idea is that if a references file is available - nginx will server, if not - it should hit some rails endpoint which will accept filename, generate it, put into public/uploads, and also make send_file call. All subsequent requests for this file will be handled by nginx.
[12:41:19] arrowcircle: cryo28, universa1, problem is, when i generated image and want to serve it as static, it will be available in public/uplaods folder/, ie as /uploads/articles/1.png, and i want it to be available as static as /articles/1.png
[12:41:35] jrnkr: Hi is there a way to clone a particular layout? https://gist.github.com/holyxiaoxin/57cc8ec2101dead521b2
[12:41:46] cryo28: arrowcircle: then generate the file in public/articles/1.png
[12:41:48] universa1: arrowcircle: read what cryo28 wrote.
[12:42:17] cryo28: or you and rewrite urls as you want in nginx. But it is just a little bit harder to maintain.
[12:42:22] arrowcircle: cryo28, but link is to /articles/1.png, not to uploads
[12:42:27] universa1: arrowcircle: or just stop worrying about "performance" / uneccessary hits to the rails stack and just use the freaking show action with send_file
[12:42:51] universa1: arrowcircle: i'm 99% sure, that this will never be a bottleneck for you.
[12:43:07] jrnkr: Anyone could take a look at a small problem? https://gist.github.com/holyxiaoxin/57cc8ec2101dead521b2
[12:43:11] jrnkr: thanks. >< appreciate that!
[12:43:16] universa1: JR___: what is the problem?
[12:43:21] cryo28: /articles/1.png will look for a file at RAILS_ROOT/public/articles/1.png
[12:43:39] jrnkr: i used a @product.each do product to list my index
[12:43:40] arrowcircle: cryo28, and if this file is not available, will it hit rails to generate it?
[12:44:00] jrnkr: I need to add a product using jquery prepend.
[12:44:05] cryo28: arrowcircle: it won't, unless you setup nginx redirect
[12:44:09] jrnkr: but there is a template inside the gist
[12:44:20] x44x45x41x4E: Anyone knows how `_changed?` method works? Can't seem to figure out how it works in the docs. http://api.rubyonrails.org/classes/ActiveModel/Dirty.html
[12:44:31] jrnkr: is there anything in rails that would help jquery to copy and paste templates using prepend?
[12:44:38] arrowcircle: JR___, you can move you product code to partial, render partial inside js and put it before other products
[12:44:51] jrnkr: ok thanks i'll take a look at partials
[12:45:36] cryo28: arrowcircle: Actually it depends on your current nginx config. You current setup may route all request for missing files into rails
[12:45:38] jrnkr: arrowcircle: how do you render partial inside js, it's a rails server code right?
[12:45:42] jrnkr: js is a front end code.
[12:45:55] arrowcircle: JR___, see my comment in github
[12:45:59] universa1: x44x45x41x4E: what are you interested in?
[12:46:13] arrowcircle: cryo28, if all missing files go to rails, it will try to hit uploads
[12:46:38] universa1: arrowcircle: store your images in public/articles/:id.png
[12:46:54] universa1: arrowcircle: if that file is present nginx will serve it. if not, it will call the rails app.
[12:47:15] cryo28: arrowcircle: I second what universa1 said
[12:47:29] universa1: cryo28: i just summed up what you've been telling him ;)
[12:47:33] arrowcircle: universa1, and if i want to put them inside public/uploads/articles/1.png?
[12:48:17] universa1: arrowcircle: then you need to do get "/uploads/articles/:id", to: "articles#show"
[12:48:18] arrowcircle: universa1, problem is its not about only articles, its about all controllers. I should not add all them as shared folders
[12:48:24] cryo28: arrowcircle: your setup should be something like "location / { try_files $uri @rails }; location @rails { // here your current proxiy to rails app server setup }"
[12:48:30] jrnkr: arrowcircle: you can't just prepend a serverside code in javascript
[12:48:40] jrnkr: arrowcircle: it'll just appear as text
[12:48:45] universa1: JR___: you send that as the js response.
[12:49:13] universa1: JR___: if you're sending json back, add the rendered partial to the json, and extract that with jquery to prepend it.
[12:49:17] arrowcircle: JR___, you can make js-format request via link_to remote: true and response as js code
[12:49:27] x44x45x41x4E: universa1: I want to create a record when a specific attribute in another record has been updated by the user. _changed? method seems to end up as false always. Would you like a gists with my code?
[12:49:43] universa1: x44x45x41x4E: yes.
[12:49:56] cryo28: arrowcircle: it will make nginx to search for a file in public directory first (try_files $uri). If file is not found the request is routed to @rails location which will proxy it to you rails app server (unicorn/puma/thin whatever it is)
[12:49:59] x44x45x41x4E: universa1: Here you go: https://gist.github.com/x44x45x41x4E/ae7ec849fb21881b484c
[12:50:11] x44x45x41x4E: universa1: Pardon my ugly code thought.
[12:50:21] universa1: x44x45x41x4E: so what is not working?
[12:50:28] universa1: x44x45x41x4E: what is before that?
[12:50:35] arrowcircle: cryo28, problem is, that url is in public/uploads, not in public
[12:50:47] keksike: should I use the Model << OtherModel in the models controller or the model?
[12:50:55] universa1: keksike: what?
[12:51:02] mikecmpbll: looks like somebody wants to use papertrail
[12:51:17] keksike: universa1: should I do this in the model-file or the controller-file
[12:51:36] universa1: keksike: i'm sorry, your whatever makes absolutely zero sense.
[12:51:43] x44x45x41x4E: universa1: Updated the gist. Kindly check it. My conditions seem to result to false always so a new record won't be created.
[12:51:43] cryo28: arrowcircle: this is actually a current setup of some of my project (see http://minus.com/lbdODZIExFFDtx )
[12:51:54] universa1: keksike: what should a class appended to another class be?!
[12:52:18] mikecmpbll: x44x45x41x4E: you've not updated the @ticket object yet
[12:52:37] mikecmpbll: x44x45x41x4E: https://gist.github.com/x44x45x41x4E/ae7ec849fb21881b484c#file-update-rb-L28
[12:52:41] universa1: x44x45x41x4E: this!
[12:52:54] keksike: universa1: I have a calendars_controller, and a calendars.rb -modelfile. I wish to put a user into a calendar, so I am doing Calendar.find(1) << User.find(1), should I do this in the controller file, or should I call a method in the model-file which does this?
[12:52:56] cryo28: arrowcircle: /articles/1.png will look for a file in public/articles/1.png, /uploads/articles/1.png will look in public/uploads/articles/1.png
[12:53:30] universa1: keksike: there is usually no << method defined on an activerecord class.
[12:53:32] x44x45x41x4E: mikecmpbll: Alright, will move the block after it. Thanks.
[12:53:32] arrowcircle: cryo28, yes, but i need /articles/1.png to lookup /uploads/articles/1.png
[12:53:35] mikecmpbll: you should do that all in your model, too. also, there is a `changes` method that will give you a hash of changes that you can loop over, rather than that ugly code
[12:53:41] arrowcircle: cryo28, and if its missing - hit rails stack
[12:53:41] mikecmpbll: x44x45x41x4E: ^
[12:53:42] x44x45x41x4E: universa1: What do you mean by `this!`?
[12:53:44] universa1: keksike: so it still makes no sense.
[12:53:44] cryo28: arrowcircle: then add rewrite in nginx
[12:53:55] universa1: x44x45x41x4E: should have been ^^ this! ^^
[12:54:00] universa1: x44x45x41x4E: what mikecmpbll said
[12:54:09] keksike: universa1: oh okay, so in the controller then
[12:54:11] x44x45x41x4E: universa1: Oh I see. Haha. Thanks.
[12:54:16] arrowcircle: cryo28, will it change the url?
[12:54:22] universa1: keksike: o0
[12:54:39] arrowcircle: arrowcircle, or just serve file from different folder?
[12:54:42] universa1: keksike: no. you need to first supply valid code, then you can think about where to put it.
[12:54:57] universa1: keksike: because Calendar.first << User.first will just raise an error, no matter where you palc eit.
[12:55:12] mikecmpbll: x44x45x41x4E: something like: @ticket.changes.each { |attr, (old, new)| @ticket.ticket_action_logs.create!(log: "#{attr} was changed to #{new}", user_id: current_user.id) }
[12:55:14] cryo28: arrowcircle: it is up to you to setup how you want it to behave
[12:55:40] arrowcircle: cryo28, is it possible to work as i want?
[12:55:46] keksike: what I meant was @calendar = Calendar.find(params[:id]), user = User.find(params[user_id]), calendar.users << user
[12:56:01] universa1: keksike: this is SOMETHING COMPLETELY different.
[12:56:04] cryo28: arrowcircle: yes
[12:56:10] x44x45x41x4E: Hmmmnn. Still doesn't work.
[12:56:14] universa1: keksike: Model << OtherModel ?!
[12:56:20] mikecmpbll: x44x45x41x4E: !doesntwork
[12:56:22] arrowcircle: cryo28, ok, thanks a lot! will google nginx rewrites
[12:56:23] helpa: 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.
[12:56:23] universa1: keksike: isntance << other_isntance
[12:56:26] keksike: sorry I was very unclear
[12:56:32] cryo28: arrowcircle: read about nginx "location", "rewrite" and "try_files" configuration directives
[12:56:37] universa1: keksike: all stuff which is invalid.
[12:56:47] universa1: keksike: adding a record to an association on the other hand...
[12:56:50] cryo28: arrowcircles: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite
[12:57:10] universa1: x44x45x41x4E: new code.
[12:57:13] x44x45x41x4E: mikecmpbll universa1 I think it still resulted to false since a new record wasn't created.
[12:57:30] universa1: x44x45x41x4E: where is @ticket coming from?!
[12:57:37] universa1: x44x45x41x4E: FULL code.
[12:58:29] arrowcircle: cryo28, i think its possible to just use try_files
[13:00:27] x44x45x41x4E: universa1: I'm in the show form `http://localhost:3000/tickets/9` Do check the gist again. Updated it.
[13:01:19] x44x45x41x4E: universa1: I'm trying to log the actions done on the ticket.
[13:01:31] universa1: x44x45x41x4E: changes are between loading a record and saving it.
[13:01:48] x44x45x41x4E: universa1: So I can't do it on the update method?
[13:02:14] mikecmpbll: x44x45x41x4E: no, but that's ok because it shouldn't be there anyway
[13:02:29] universa1: x44x45x41x4E: so by doing update, you're erasing all traces of it.
[13:02:49] cryo28: arrowcircle: Yeah. try_files uploads/$uri @rails given /articles/1.png will look for a file in public/uploads/articles/1.png and will proxy to rails if files is not found, but rails will still receive a request for /articles/1.png
[13:03:10] universa1: x44x45x41x4E: so @ticket.attributes = ticket_params; if @ticket.valid?; ...; @ticket.save; end
[13:03:23] arrowcircle: cryo28, ok, thx, this will solve my problem
[13:03:36] cryo28: arrowcircle: if /articles/1.png should look for a file in public/uploads/1.png then try_files is not enough and you'll need some rewrite
[13:03:38] mikecmpbll: x44x45x41x4E: just put the code in an after_save :)
[13:03:56] x44x45x41x4E: x44x45x41x4E: In my model, you mean?
[13:04:01] arrowcircle: cryo28, no, it should be /public/uploads/articles/1.png
[13:04:02] universa1: or use one of the available gems for papertrails / auditing ;)
[13:04:08] arrowcircle: cryo28, so its ok
[13:04:08] x44x45x41x4E: mikecmpbll: ^
[13:04:11] mikecmpbll: yes, in your model
[13:04:13] cryo28: arrowcircle: also be careful to not look for all files according to the flow. Restrict the try_files directive for location /articles only
[13:04:28] x44x45x41x4E: mikecmpbll: In my model, you mean?
[13:04:48] mikecmpbll: x44x45x41x4E: [13:04:11] <mikecmpbll> yes, in your model
[13:04:57] x44x45x41x4E: universa1: Replace update method with that?
[13:05:16] universa1: x44x45x41x4E: nah, do what mikecmpbll said. he's giving better advice.
[13:05:32] x44x45x41x4E: mikecmpbll: Yep. I think that's better. Hehe.
[13:05:37] x44x45x41x4E: universa1: Thanks man.
[13:05:50] macmattias: Ok I am a noob??? :) I cant seem to solve this crazy easy problem, so I take the shame and ask you guys. https://gist.github.com/anonymous/a1c88fb7d371dfb7cac9
[13:05:50] x44x45x41x4E: universa1 mikecmpbll Thanks to both of you :)
[13:05:58] arrowcircle: cryo28, actually it should look for all url, because any page have this image
[13:06:10] universa1: macmattias: what problem are you trying to solve?
[13:06:15] x44x45x41x4E: macmattias: What's the error exactly?
[13:06:30] macmattias: universa1: Trying to get the form to be filled with the object I wanna edit.
[13:06:37] macmattias: x44x45x41x4E: to_key error.
[13:06:49] universa1: macmattias: well, you want to pass the form object to your form partial, not the model instance.
[13:07:09] macmattias: universa1: that sounds about right. What do I have to do?
[13:07:11] universa1: macmattias: render partial: "form", locals: {f: f}
[13:07:21] universa1: macmattias: read some basic guides ;)
[13:07:27] x44x45x41x4E: mikecmpbll: One question, can I use after_update? Or that won't do?
[13:07:28] macmattias: universa1: I have. Many times.
[13:07:43] universa1: x44x45x41x4E: !try ;-)
[13:07:43] helpa: x44x45x41x4E: Why don't you try it and find out for yourself?
[13:07:49] macmattias: universa1: I am stuck, code blind. Head ache. Done this so many times before.
[13:09:22] mikecmpbll: macmattias: !layouts it's in section 3.4.4.
[13:09:22] helpa: macmattias: The Layouts and Rendering Guide - http://guides.rubyonrails.org/layouts_and_rendering.html - Written by Mike Gunderloy
[13:09:27] macmattias: universa1: But the error comes before that. I have some error in my form_for line.
[13:09:39] universa1: macmattias: then add the error to the gist.
[13:09:42] macmattias: mikecmpbll: Thanks I will read it.
[13:10:53] x44x45x41x4E: universa1: Ooops. Sorry. I will. Thanks.
[13:11:58] macmattias: universa1: Here it is: https://gist.github.com/macmattias/68dfd45e613719cfdb88
[13:12:27] universa1: macmattias: what is @editmeal? code that sets it?
[13:12:58] macmattias: universa1: An instance varible from the controller.
[13:13:05] universa1: macmattias: show the code.
[13:13:38] macmattias: universa1: updated the gist with it
[13:14:03] universa1: Macaveli: that returns a relation, not a single instance, which you want for a form.
[13:14:13] universa1: Macaveli: you either want to add .first
[13:14:19] universa1: wrong highlight, sorry
[13:14:21] Macaveli: I didn't ask anything
[13:14:26] Macaveli: <3 I forgive you
[13:14:27] universa1: macmattias: see above
[13:14:41] universa1: macmattias: or do @editmeal = Meal.find params[:id])
[13:15:06] macmattias: universa1: Find instead? Ok. I will try.
[13:15:21] universa1: macmattias: the behavior of find is different to where(id: ..).first
[13:15:35] macmattias: universa1: I know that. :)
[13:17:01] macmattias: universa1: oh yeah! there the coin??? THANK YOU! Oh what a amateur I am from time to time. Have a great weekend.
[13:17:15] universa1: macmattias: yw :-) u2
[13:17:15] mikecmpbll: and just call it @meal pls
[13:17:23] mikecmpbll: ACTION is a pedant
[13:17:33] universa1: mikecmpbll: :-)
[13:20:01] umdstu: alright, how do i hide the debug(active record) log entries for a particular model. i have a model that I dont want to see the debug level mysql output in the logs. is this doable with the built in logger?
[13:36:34] jrnkr: I have a website that I need to analyse: http://products.kerncheh.me/
[13:36:54] jrnkr: How does this app create a new product and doesn't refresh
[13:36:58] Varun_krishna: Hi guys I am using geocoder gem for calculating the latitude and longitude. But I don't want to calculate the latitude and longitude when the user clicks on create new user. Instead when the user enters the value for the source and destination it should automatically calculate it. So how would I do that ?
[13:37:08] universa1: JR___: magic.
[13:37:29] jrnkr: universa1: anything that I should learn? I only know the basic rails scafolding
[13:37:54] Varun_krishna: JR___: If you are new for rails try rails for zombies @ code school
[13:37:56] jrnkr: universa1: should i be using rail's unostrusive jacascript?
[13:38:08] universa1: JR___: without having looked at it, it surely involves some kind of ajax, possibly even some front end js framework like ember, angularjs, ...
[13:38:16] jrnkr: Varun_Krishna: I am a rails backend developer but I don't know how this frontend works
[13:38:31] jrnkr: universa1: nope, it doesn't. it's pure rails
[13:38:32] universa1: JR___: you should learn and know about unobstrusive js
[13:38:32] Varun_krishna: JR___: Okay I am sorry.
[13:38:46] universa1: JR___: rails is a server application...
[13:38:51] jrnkr: universa1: ok.
[13:38:56] universa1: what you do on the client is of little to no concern to rails.
[13:39:16] jrnkr: seems like rails does full stack
[13:39:25] mlangenberg: I have a somewhat large coffeescript file, which I want to split into smaller files. Because coffescript compiles everything in a closure, this forces me to assign these helper classes to the window object. Is there anything I can do against that?
[13:40:02] mlangenberg: A the moment in the large file, only one class ???leaks??? out to window, the rest are anonymous classes.
[13:40:12] universa1: JR___: well, it provides a full stack, but it doesn't really care about what frontend libraries you use.
[13:40:41] universa1: JR___: so it's probably only plain jquery talking to the rails app via js/json requests.
[13:42:17] universa1: Varun_Krishna: hi
[13:42:26] Varun_krishna: universa1: So how are you doing ?
[13:42:59] universa1: allright, i think i gonna go home soon... ...being totally unproductive currently
[13:43:02] jrnkr: universa1: oh now i think i roughly got the idea
[13:43:19] jrnkr: universa1: but i don't want to just do a json request because that means that i couldn't do a js request
[13:43:31] jrnkr: universa1: could i do both a json request + js request?
[13:43:36] universa1: JR___: what?!
[13:43:47] universa1: JR___: i'm sorry, i can't follow you.
[13:43:51] DanBangWTFRajib: Subjective question, not a flame war... Rails or Sinatra for beginners in Ruby world?
[13:44:01] universa1: DanBangWTFRajib: both.
[13:44:04] Varun_krishna: universa1: I am somewat struggling to convert the city names to latitude and longitude , using the geocoder gem. But I want it to calculate it when the user enters the city name automaticall. How do I do that ?
[13:44:04] DanBangWTFRajib: Json is JS... are you missing the point?
[13:44:14] jrnkr: universa1: you see.. i need to hit the create controller, get the json response, check if I have a error on create, if there is an error, fill the errors div, if not, render the created partial
[13:44:34] jrnkr: universa1: my created partial is a server js code. i have no idea how i could hit that.
[13:44:35] universa1: JR___: well, there are different ways to do that.
[13:45:15] DanBangWTFRajib: JR___, if an API call and you get Json as response, then play with the incoming data... no use of JavaScript there
[13:45:15] jrnkr: universa1: if i have jquery ajax post, how do i call a js.erb?
[13:45:41] universa1: JR___: you could have very little client-side code, and "do it all" in rails views, or have more client side code, ...
[13:45:51] jrnkr: universa1: mmm. i get what you mean.....
[13:45:58] universa1: JR___: well, by naming it appropriately...
[13:46:05] universa1: JR___: and rails will automatically use it.
[13:46:09] jrnkr: universa1: guess i will just do more client side code.
[13:46:15] DanBangWTFRajib: putting business logic in client side is shooting on your own feet
[13:46:36] universa1: JR___: http://www.gotealeaf.com/blog/the-detailed-guide-on-how-ajax-works-with-ruby-on-rails
[13:46:48] universa1: DanBangWTFRajib: so using angular-js is shooting on your own feet?
[13:46:49] jrnkr: universa1: btw, is there an elegant way to render html in javascript?
[13:47:02] universa1: JR___: look at the tutorial i just linked...
[13:47:14] fluxsource: DanBangWTFRajib: putting business logic in client side is shooting on your own feet <--- with a poisoned bullet
[13:47:15] universa1: JR___: better, follow it and implement it yourself.
[13:47:41] universa1: fluxsource: same question to you ;)
[13:47:44] Varun_krishna: universa1: will that tutorial help me to learn how to make ajax calls in rails ?
[13:47:51] universa1: Varun_Krishna: yes.
[13:48:03] fluxsource: universa1: no. That's quite a leap to suggest that
[13:48:14] Varun_krishna: universa1: Yes thatnk you. But what is the best way to do the geocoding thing ?
[13:48:19] jrnkr: universa1: cool, i've just saw respond_to
[13:48:23] universa1: Varun_Krishna: no fucking clue...
[13:48:40] jrnkr: universa1: if i make a json request, does it mean that i can render the js + json?
[13:48:48] universa1: Varun_Krishna: so overwrite the setter method, add a before_validation hook, ...
[13:48:58] universa1: JR___: o0... please just do the tutorial first.
[13:49:09] universa1: JR___: it will hopefully clear things up for you.
[13:49:49] universa1: fluxsource: well, what is angular-js then, if not putting business logic into the client side? ;)
[13:52:15] Varun_krishna: universa1: Ok no problem. Oh my ohmy ,b efore saving the lat and long to the database table, I should show the markers on the map in the create action.
[13:52:52] universa1: Varun_Krishna: i haven't used that, but can't you use the gmaps stuff directly?!
[13:54:28] Varun_krishna: Yes, as a beginner what I thought was using geocoder and gmaps4rails gem will be easier for me .
[14:01:28] mwlang: seeking opinions: I???m rewriting an old Rails 2 app where there are several thousand LoC in rake tasks. Its mostly business logic and I???m moving some of that into AR models as it makes sense. But some of this stuff doesn???t strictly belong in an AR model???s class as it breaks single purpose principle. How do you organize these supporting models for use with rake tasks and other external scripts to utilize so the main app/models
[14:01:28] mwlang: folder isn???t cluttered?
[14:03:26] mwlang: I vaguely recall a project that had an app/workers folder, but IIRC, that was because that project used background job or some such gem that encouraged that convention.
[14:03:34] mikecmpbll: mwlang: you're going to have to provide some example..
[14:03:47] mikecmpbll: you can define any subdirectory of app/ to suit your needs.
[14:04:14] mwlang: The other common convention I???ve seen is stashing this stuff in the lib/ folder, but I am disliking that approach more and more these days.
[14:04:53] mikecmpbll: for classes that solely support rake tasks, in my projects i have them in lib
[14:04:58] mwlang: mikecmpbll: yeah, I know I can. I???m just asking what others do and why???what???s your position on how you choose to organize things?
[14:05:43] mikecmpbll: for example, i have a bunch of rake tasks for running various data imports, in different formats. most the tasks are one liners that hand off to import classes that I keep in lib/imports/
[14:05:49] mwlang: ah. So to expand on my dislike of the lib/ convention, it just seems like this folder becomes a vast dumping ground in larger projects.
[14:06:00] mikecmpbll: nothing vast or dumping ground about it
[14:06:07] mikecmpbll: it's just a directory.
[14:06:49] mwlang: do you further organize the lib into sub-folders to group things?
[14:07:35] mwlang: that???s what I don???t see very often with the lib folder, hence why I call it a dumping ground for many projects.
[14:09:13] mwlang: in many cases, just about anything is all together in that one folder???initializers, rake task logic, utility classes that are used to extend common logic elsewhere, and so on.
[14:10:12] mikecmpbll: but what's that got to do with what you choose to do?
[14:11:34] mikecmpbll: the only thing to be aware of between lib and a directory under app/ is that it's not part of rails autoloading.
[14:13:17] mwlang: mikecmpbll: what I???m trying to do is decide on a better approach that I can consistently apply to these large migration projects I???ve been tackling lately. if the lib folder is organized, it???ll work fine. Just stating my thoughts above made me realize it wasn???t the lib folder itself I dislike, its the flat disorganization of that folder that I dislike. But I can spin off sub-folders as needed to further organize.
[14:14:15] mwlang: mikecmpbll: right. that was the other part of why I wasn???t sure I liked the lib folder???its just one line in the config to get it autoloading, but still felt a little like going against the rails grain rather than with.
[14:14:27] mikecmpbll: yeah, don't autoload lib
[14:14:33] mikecmpbll: it's stupid. i don't know why people do that.
[14:15:17] mwlang: mikecmpbll: most are doing it to get those utility classes that are included in the rails models auto-loading and refreshing during development.
[14:15:39] gaussblurinc1: hi! I have question about rails history. I have a project with rails version 3.2.14. I see many constructions with attr_accessible in this project. This ability refer to protected_attributes gems. But.. previous rubist doesn't omit this gem in gemfile (this project come from late 2013). Is this gem (protected_attributes) was installed in rails 3.2.14 by default?
[14:15:39] mikecmpbll: i know. if they're developing lib classes against their app though, they shouldn't be in the lib folder.
[14:15:40] mwlang: (instead of TDD???ing it, that is)
[14:16:40] gaussblurinc1: *'previous rubyst doesn't specify it in gemfile'
[14:17:13] mikecmpbll: gaussblurinc1: yep, it was part of rails before rails 4
[14:17:38] mikecmpbll: gaussblurinc1: it was extracted in to a gem in favour of the considerably better modern implementation, "strong params"
[14:19:56] mikecmpbll: mwlang: to come back to my point, if you're being inconvenienced by the fact that lib isn't autoloaded, it's a good sign that you should be developing that code in app/**
[14:19:58] mwlang: mikecmpbll: that???s actually a refined way to think of the lib folder. good point there.
[14:22:51] mwlang: mikecmpbll: ok, I???m starting to break things down a little more here???I can see only a little of these rake tasks going into a lib folder ??? mostly utility methods, but most of this needs to go into PORO???s in the app/models folder.
[14:24:15] mikecmpbll: mwlang: impossible to provide an opinion without an example
[14:25:14] mwlang: mikecmpbll: that???s ok, sometimes talking out loud helps greatly and in this case, it did.
[14:25:23] mikecmpbll: fwiw, i prefer to keep app/models mostly for AR descendants.
[14:27:19] gaussblurinc1: mikecmpbll: how to get list of compatible gems with specific rails version?
[14:27:56] mwlang: mikecmpbll: that???s generally my position, but I???m kinda opening up to questioning how much is rails dogma vs. what makes most sense to the project at hand.
[14:27:56] mikecmpbll: gaussblurinc1: refer to the specific gem docs.
[14:28:52] mwlang: gaussblurinc1: set up a Gemfile for each rails version you???re interested in and bundle install it. Review the Gemfile.lock file for versions of the gems that were dependent.
[14:29:40] mikecmpbll: mwlang: tbh there's little dogma, at least officially. (beyond the autoloading naming conventions). it's open for you to do pretty much what you like.
[14:31:26] mwlang: mikecmpbll: publicly, true, but with the various teams I encounter and work with, they often have very strong stances???a lot of it misunderstanding of what rails opinionated development is really all about.
[14:31:43] mikecmpbll: fair enough.
[14:34:32] crankharder: why would I be getting "You're missing the 'debugger' gem" when I have byebug in my bundle, not in a group and starting rails server w/ -u ?
[14:34:48] crankharder: ruby 2.1.5, rails 4.1.9
[14:35:59] mikecmpbll: crankharder: what's byebug got to do with it?
[14:37:22] crankharder: beats me, not on top of the nuances of what debugger gem works this week :/
[14:37:32] mikecmpbll: me neither, was a genuine question. heh
[14:37:50] crankharder: read the readme... need to drop 'byebug' instead of 'debugger'
[14:37:53] crankharder: and not use -u
[14:38:10] crankharder: rails should drop the -u flag since debugger isn't officially supported in 2.x
[14:42:05] x44x45x41x4E: mikecmpbll: Hey man. So, I tried it in the model and it worked. Thanks again. But could I bother for you another 5 minutes?
[14:42:41] mikecmpbll: x44x45x41x4E: if you just ask, if i don't know then someone else probably will ;)
[14:43:08] x44x45x41x4E: mikecmpbll: The only problem now is, I can't seem to pass the id of the current_user in the model. After some googling, I found out the helpers can't be accessed in the model.
[14:45:12] x44x45x41x4E: mikecmpbll: Okay thanks. I'll ask away then. Hehe.
[14:45:56] mikecmpbll: x44x45x41x4E: in that case, it might be a nicer idea to just move that code from the after_update to a instance method
[14:46:09] mikecmpbll: and then you can do @ticket.create_audits!(current_user)
[14:46:16] mikecmpbll: in your controller.
[14:47:30] mikecmpbll: the other alternative would be that you create a virtual attribute on the ticket class and store the current_user in it, but i don't much like that style.
[14:48:36] x44x45x41x4E: Why so? Because it could be nil at times and the app would be break?
[14:49:07] x44x45x41x4E: mikecmpbll: ^
[14:49:12] mikecmpbll: x44x45x41x4E: not really, i just don't like the indirection.
[14:50:09] x44x45x41x4E: mikecmpbll: I see. Is there some style guide would consult for this kind of coding decisions?
[14:50:24] mikecmpbll: x44x45x41x4E: heh, no, you have to make some decisions as a programmer, y'know.
[14:51:42] x44x45x41x4E: x44x45x41x4E: I see. Cool. But as a newbie to this and like any other place where I'm trying to learn about coding, there's just this culture of adhering to the "best" practices.
[14:52:03] x44x45x41x4E: mikecmpbll: Curious, how long have you been coding?
[14:52:12] mikecmpbll: ruby? or in general?
[14:52:53] x44x45x41x4E: mikecmpbll: In general. I always wanted to pick brains of great programmers like you guys. Hehe. But sadly, I can't seem to find someone willing or available.
[14:52:56] mikecmpbll: conventions are helpful, but they only get you so far. you just need to think for yourself sometimes and decide which is your preferred approach :)
[14:53:26] mikecmpbll: about 17 years i spose.
[14:53:56] oddover: Hi all. I have a question relating to one from yesterday, in case anyone was here for that discussion. Here's the situation: I have a Person, which has_many LifeEvents. LifeEvents can be many things, including Birth, Death, Marriage, etc. Is there a way to restrict that "has_many LifeEvents" so that the Person only has one birth, and one death?
[14:54:54] mikecmpbll: oddover: write a validation to check
[14:54:57] BLuEGoD: if I want to mount a Sinatra app inside a rails app, how do you 'require' or reference the sinatra code ?
[14:55:18] x44x45x41x4E: mikecmpbll: Wow. I guess I've got a long way to go.
[14:55:51] oddover: mikecmpbll: alright. another question. How do I access that single Birth from the Person? (eg if I wanted to find the person's birthdate
[14:55:59] shortCircuit__: https://gist.github.com/kares/1024726 why is that class_eval used?
[14:56:27] mikecmpbll: def birth; life_events.where(type: "birth"); end
[14:57:05] x44x45x41x4E: mikecmpbll: Brb, hope I could pick your brain more later or on another time. Thanks for being kind. :D
[14:57:14] oddover: mikecmpbll: what about birth.date= ?
[14:57:14] mikecmpbll: x44x45x41x4E: np :)
[14:57:24] mikecmpbll: oddover: what about it?
[14:57:44] oddover: mikecmpbll: oh...nvm. That would just work then..
[14:58:17] oddover: the only reason I'd need a setter would be for birth=. Which I'm not sure I need
[14:58:20] mikecmpbll: you'll probs want find_by instead of where tho.
[14:58:46] oddover: alright, I'll try that. Thanks!
[15:00:39] oddover: mikecmpbll: why find_by vs where?
[15:00:59] mikecmpbll: where returns a relation, find_by returns a single instance
[15:01:44] oddover: would life_events.find_by(type: "birth") work, or do I need to use LifeEvents.find_by?
[15:03:48] mikecmpbll: oddover: if it's in an instance method on the Person model, the life_events is calling @person.life_events
[15:03:59] mikecmpbll: which will return just the LifeEvents for that person
[15:04:02] jokke: i'm trying to set up custom metrics for newrelic in my rails app
[15:04:11] pghale: BLuEGoD: you have it setup like `mount MySinatraApp.new => '/sinatra'` ? if you need to share code between the rails app and sinatra, the best solution kinda depends on what you need to share. is it layouts, authentication code, business logic...
[15:04:13] jokke: maybe someone here can help me out
[15:04:19] oddover: mikecmpbll: gotcha
[15:04:23] oddover: mikecmpbll: thanks
[15:04:32] jokke: i use puma_auto_tune which is loaded before any rails app code
[15:04:45] jokke: i can define hooks which are called when a worker has been spawned and get the memory used etc.
[15:04:51] jokke: here i want to send a metric to newrelic
[15:05:21] jokke: but nothing appears in the frontend when i try to add the metric to a chart in custom dashboards @ newrelic
[15:05:37] jokke: so i'm guessing nothing gets sent to newrelic
[15:05:43] mikecmpbll: jokke: do you have a subscription?
[15:05:46] BLuEGoD: pghale: I understand that, but in order for rails to understand "MySinatraApp.new", MySinatraApp needs to be required first? Just wondering if it needs to be in the form of a package or something instead of requiring the module using relative / absolute paths that may change depending on the environment, etc
[15:06:11] mikecmpbll: jokke: might be worth asking NR support then, unless anyone here has specific knowledge of the custom metrics.
[15:06:28] mikecmpbll: i use new relic but never used the custom metrics.
[15:06:56] jokke: yeah i just wanted to send the memory used by the puma workers and the workers count
[15:07:04] pghale: BLuEGoD: ah okay. I'm not sure then.... why would the releative path change depending on environment?
[15:08:55] BLuEGoD: /my/home/sinatra-app/app.rb vs /my/server/var/sinatras/sinatra-app/app.rb and the rails app located in other place, etc... Also that won't coincide in different development environments (if we are like 10 devs using the same codebase). I can add an ENV variable I guess, but was wondering if there are other options in order to include the sinatra code
[15:09:10] xibalba: anyone here use instagram's api and have experienced the two post issue to your callback ? http://stackoverflow.com/questions/23507954/how-can-i-stop-the-instagram-from-sending-two-post-requests-or-how-could-i-filt
[15:12:36] pghale: BLuEGoD: maybe make the sinatra app a submodule and have your deploy script sort it out. or turn the sinatra app into a gem.
[15:14:34] pghale: BLuEGoD: i'd be inclined to gemify the sinatra app, but haven't ever done this so pinch of salt etc :)
[15:17:05] BLuEGoD: pghale: that's fine, just wanted to make sure I wasn't doing something wrong just including the path... I may use an env variable or make it a gem
[15:17:39] Advocation: Anyone able to shed some light on what I???m doing wrong with this? https://gist.github.com/Advocation/5d83ca64fc02618ddc50
[15:18:01] elben: I want a subset of my models to use a different database (Rails 3.2). But I also want Rails to handle migrations and schema dumps/loads for this secondary db. I???ve implemented ideas from http://stackoverflow.com/a/28505159 which handles migrations/rollbacks, but not dumps. Do you know if using engines could solve this? It seems that most docs on engines assume a singular db shared across your app.
[15:25:34] JyZyXEL: how do i see the SQL queries that the rails server does?
[15:25:50] JyZyXEL: i wanna see how many sql queries it takes to load each page
[15:27:50] pghale: ActiveRecord::Base.logger = Logger.new('log/development_sql.log')
[15:28:07] JyZyXEL: where should i put that?
[15:28:57] pghale: JyZyXEL: in application.rb, config.active_record.logger = Logger.new....
[15:30:34] pghale: JyZyXEL: i use bullet for this though
[15:30:47] pghale: JyZyXEL: pretty cool gem
[15:31:11] ChristianDC: If I have a user model->profile->dob is it possible to test that profile exists and then dob rather than if user.profile.present? && user.profile.dob.present?
[15:31:40] ChristianDC: so maybe user.profile.dob.present? if user.profile doesnt exist it errors out
[15:37:16] odigity: from the guides: "...Rails provides a less verbose alternative: options_from_collection_for_select" -- anyone see the irony in that?
[15:40:18] pghale: Advocation: maybe 'login' should be '/login'?
[15:40:54] Advocation: pghale: makes no difference :(
[15:41:02] pghale: Advocation: yeah didn't think it would
[15:45:18] pghale: ChristianDC: there might be more direct solutions, but you could avoid the LoD violations by having a method on user to get whatever you want from profile, that handles when profile is nil. so like instead of asking the user to ask the profile for the dob, just ask the user for the profile_dob.
[15:45:53] pghale: ChristianDC: user.profile.try(:dob) *ducks*
[15:47:27] irit: Hi. Using Rspec with capybara and databasecleaner. But, after a sucessful execution of all the tests, the next time it fails. Because it says migrations are pending
[15:47:55] irit: If i try to migrate, it fails because it says the tables already exists
[15:48:29] irit: My question is: How does Rails determine if there are pending migrations?
[15:49:12] pghale: irit: iirc, there's a table that stores a list of migration versions, which are the timestamps you see on the migration files.
[15:49:29] pghale: irit: schema_migrations
[15:50:21] ChristianDC: pghale: ok thanks
[15:50:43] irit: Ah, okay. So I figure that the databasecleaner gem somehoes cleans that
[15:51:33] irit: My DatabaseCleaner config is: http://pastebin.com/pSYNA2qC
[15:52:32] irit: Oh, sorry -> http://pastie.org/9966133 Old habbits die hard :)
[15:53:55] rushed: irit: running tests shouldn't rollback migrations you performed previously
[15:55:01] irit: Hmm, okay. Then I need to dig deepter into why bundle exec rspec only can run once
[15:56:16] mikecmpbll: irit: is database cleaner truncating your schema_migrations table or something?
[15:56:27] mikecmpbll: (never used db cleaner but would assume it wouldn't do that..)
[15:56:37] pghale: oh wait that sounds familiar
[15:56:42] irit: According to the docs, it says it never will.
[15:57:03] mikecmpbll: okidokes. and literally does it, though?
[15:57:12] mikecmpbll: i mean, just look at that table. see if there's anything in it :)
[15:58:51] pghale: irit: what version of db cleaner are you running? there's a bug report here: https://github.com/DatabaseCleaner/database_cleaner/issues/317
[15:59:15] mikecmpbll: pghale: good find.
[15:59:24] irit: Oh, you're right. It actually does delete it
[15:59:41] irit: pghale: 1.4.0 - I'll check the link
[16:00:16] mikecmpbll: "While we work on a solution to this, I see two workarounds: Either: DatabaseCleaner.strategy = :truncation, {except: %w[public.schema_migrations]} or downgrade to 1.3.0"
[16:00:49] daveomcd: when I start my rails console I'm getting the following message "#<ArgumentError: :attributes cannot be blank>" what steps can I track down to find what is causing this as this is the only thing that's displayed?
[16:00:52] irit: Let me try that - just a sec.
[16:01:56] mikecmpbll: daveomcd: you type rails console, and then you get one line of output which is "#<ArgumentError: :attributes cannot be blank>" ?
[16:02:31] daveomcd: mikecmpbll, rails console production -- but yes
[16:02:42] daveomcd: it still goes to console but that's shown before hand
[16:03:47] rushed: daveomcd: only when you start the console, or everything else as well?
[16:04:59] irit: pghale: That was the cause! :-) Now it works like a charm
[16:05:06] daveomcd: rushed, just rails console production from what i can see... like even doing rails console -- w/o production it doesn't show it
[16:05:13] rushed: daveomcd: doing anything interesting with any models that have presence validation on startup?
[16:05:20] mikecmpbll: daveomcd: gist your production.rb ?
[16:05:26] mikecmpbll: oh, production
[16:05:34] mikecmpbll: so it's loading your classes
[16:06:28] daveomcd: mikecmpbll, i'll check for validates_presence_of ... let me see
[16:08:39] mikecmpbll: daveomcd: could be a validates_with
[16:11:46] daveomcd: hmmm i guess i'll look through each commenting out blocks to narrow down.
[16:15:36] rushed: daveomcd: you might consider editing your local gem version to throw an error when it's producing that error so you get a stack trace
[16:16:19] oddover: mikecmpbll: you still around?
[16:16:22] daveomcd: rushed, ok i'll look into that thanks!
[16:16:25] mikecmpbll: oddover: yup
[16:16:50] oddover: mikecmpbll: turns out I do need a birth= method. How would I implement that?
[16:16:54] exadeci: Hello, I would like to create an item and at the same time create a related item on another model but simple_fields_for doesn't load the related inputs https://gist.github.com/exadeci/0a5b22f00485e9ae9881
[16:17:03] mikecmpbll: oddover: is birth an attribute on your model?
[16:17:28] mikecmpbll: oddover: oh nvm, birth was the life event
[16:17:36] oddover: mikecmpbll: yep. sorry
[16:17:41] mikecmpbll: what do you intend birth= to do?
[16:18:07] oddover: create a new Birth model to assign to the Person
[16:18:51] mikecmpbll: person.life_events << LifeEvent.new(...)
[16:19:19] mikecmpbll: you can make that in to a `birth=` method if you want.
[16:20:36] oddover: cool. I think that'll work
[16:21:22] pghale: mikecmpbll: just read your post about Hash#get_nested_keys ... does that work when the hash includes arrays? (and like, the array elements are hashes as well..)
[16:21:29] mikecmpbll: if you want to change the birth life event, you'd be better off modifying the life event, not replacing it
[16:21:45] mikecmpbll: oddover: so, @person.life_event.update(date: ...) for example.
[16:22:02] oddover: mikecmpbll: Yea. I don't think I need to update, but I'll keep that code in mind, just in case
[16:22:36] mikecmpbll: pghale: :) it ignores anything that isn't a hash
[16:23:50] pghale: mikecmpbll: mm okay. i had a load of trouble parsing such a hash....and ended up converting it to json and then using regex, and parsing the string back to a ruby hash. which is...awful, right?
[16:24:03] rushed: pghale: :(
[16:24:08] pghale: rushed: lol. yeah
[16:27:22] pghale: Hardware: Fuck it, duct tape. Development: Fuck it, regex. Design: Fuck it, modal dialog.
[16:28:22] rushed: pghale: you might consider, you know, not doing that
[16:28:27] tubbo: pghale: s/modal dialog/tabs/
[16:29:31] mikecmpbll: pghale: sounds pretty awful :D. i was storing some processed data in a big ol' nested hash and regenerating it every now and again. needed to know what had been added to hash since it was last generated.
[16:29:38] mikecmpbll: so i wrote that so i could compare it for two different nested hashes
[16:30:49] naftilos76: Hi everyone, is there anything in linux that can help me keep track of changes i do in my rails source code but using my NAS or a local storage device?
[16:30:59] mordocai: Hello! So I noticed that when writing rspec tests to hit my various endpoints that the "deep munging" of json that normally happens before parameters get to the controller isn't happening. Things like {"test-data": []} becoming {"test-data": nil}. Is there anyway to make this happen in specs? I'm still on rails 3.2.21 unfortunately, so looking for a way to do it in 3.2.
[16:31:03] rushed: naftilos76: git
[16:32:28] naftilos76: rushed: I know git but i do not know what exactly it can do. Can i use git to do that locally or on a local network location?
[16:32:37] pghale: mikecmpbll: i have to compare two different nested hashed too, but they're config files. tbh maybe i don't even need to compare them. I think i'll have to revisit the original requirements / constraints which led to the regex-ocalypse, and see if there's a beter way.
[16:32:48] rushed: naftilos76: yes
[16:33:10] exadeci: Still can't find how to create a model and a related association on the same time any idea ? https://gist.github.com/exadeci/0a5b22f00485e9ae9881
[16:33:20] mikecmpbll: pghale: there's some good existing gems for diffing nested hash/array structures, but they went further than what i needed and compared right to the leaf node
[16:33:21] naftilos76: ok thanks a lot, i ll go read more about this
[16:33:36] mikecmpbll: pghale: i only needed to compare the tree of hash keys.
[16:33:45] rushed: naftilos76: https://www.codeschool.com/courses/try-git
[16:34:50] pghale: mikecmpbll: okay so in a way, all i care about are the hash keys as well. i was trying to generate a unique field label for each value in the hash. so i don't really care about the values in the hash, only the path you take to identify them.
[16:35:14] mikecmpbll: pghale: might be applicable then :)
[16:36:16] pghale: mikecmpbll: :) yeah. the regex-thing is dangerous because the code is incredibly simple, and it currenty works. parsing the nested hash requires a lot more thought, and the outcome isn't as good. no excuse though.
[16:36:57] oddover: has anyone here used the hstore_accessor gem?
[16:43:02] oddover: ok, more general question: is there a way to do a Model.where() on methods, rather than attributes?
[16:43:57] rushed: oddover: Model.all.select{ |m| m.include_me? }
[16:44:28] tfitts: oddover: and where.not is .reject
[16:44:40] rushed: oddover: realize you're then pulling everything into ruby and working with it, so depending on what you data looks like that could be a terrible idea
[16:45:45] mordocai: Alright, I'll try rephrasing: Rails 3.2.21 request specs are not doing the "deep munging" on JSON requests like actual production requests do. Is there a way to make them do it? Or do I need to ditch using the rails test framework for my API specs?
[16:46:34] oddover: rushed: yea, so I have a Birth model, that is using hstore_accessor. basically, there's a postgres hstore field, containing some attributes. I'm trying to find the births with a given father_id field in there.
[16:46:36] tubbo: mordocai: !gist one of the req specs that are failing (due to the problem you stated), you might need an ActiveSupport method to accomplish what you're thinking..
[16:46:36] helpa: mordocai: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[16:47:07] mordocai: I can try to make a minimal example but i'm not allowed to just post production code on the internet
[16:47:15] rushed: oddover: postgres can query hstore
[16:47:36] rushed: oddover: you can even index it if it's going to be common
[16:47:52] diegoviola: hey guys, I'm trying to bring up some rails app on my dev environment, and I get this: missing required :bucket option (some issue with paperclip), I've not experienced with it and I tried to google it, but still no results, any ideas?
[16:48:02] diegoviola: I'm trying to find a way to configure paperclip in such a way that it doesn't have to upload to s3
[16:48:11] diegoviola: since I'm testing the app offline
[16:48:27] rushed: diegoviola: sounds like you haven't done that yet then (bucket is a common aws config setting)
[16:48:38] oddover: rushed: here's the code I had before I started rewriting this: children_ids = Birth.where(:father_id => id).map {|elt| elt.child_id}
[16:48:59] diegoviola: rushed: but isn't that the default in paperclip? to upload it *not* to s3?
[16:49:21] rushed: diegoviola: so look at your initilizers? :)
[16:49:29] oddover: rushed: when I run that, I get a pg error about life_events (the parent model of birth) not having father_id
[16:49:32] rushed: * initializers
[16:49:41] oddover: rushed: because father_id is in the hstore column
[16:49:50] pghale: (oddover: we had a look at hstore recently but preferred the look of jsonb)
[16:50:12] oddover: pghale: any specific reason?
[16:50:12] rushed: oddover: I didn't say postgres can query hstore *using the exact same syntax you use for everything else* I said it can query hstore :P
[16:50:23] oddover: :P I figured
[16:50:30] oddover: just trying to get the right syntax
[16:50:48] pghale: oddover: we were storing more than simple key/value pairs
[16:51:08] oddover: pghale: ah. yea, for now I'm just using k/v pairs, so I should be okay
[16:51:16] oddover: pghale: but thanks for mentioning it
[16:53:40] diegoviola: rushed: ok yeah, the default is to save it to the local hard drive, so I just commented the config.paperclip_defaults = {} and that seems to work
[16:54:11] rushed: oddover: find yourself a reference, but generally you're looking for syntax that looks like .where("properties::hstore->father_id = ?", search_id.to_s)
[16:54:31] rushed: oddover: where "properties" is the hstore field in that example
[16:54:40] oddover: rushed: lol, just found that.
[16:54:58] oddover: rushed: I forgot that hstore_accessor was a wrapper around activerecord-postgres-hstore
[16:55:15] rushed: oddover: ...
[16:56:11] mordocai: Alright, here is a gist that should show the issue. Like I said, can't post our actual code cause business but this should explain the issue. https://gist.github.com/mordocai/c478533cbde679d275a2
[16:56:56] Pupeno: I have a hypothetical question: if you had to set up an office dashboard displaying a rotation of Google Analytics, New Relic and some custom made pages that require log in, how would you go about it?
[16:57:29] smathy: mordocai, what does 'items:=[]' mean?
[16:57:39] tfitts: Pupeno: you're saying you wouldn't require login to see GA or New Relic?
[16:58:01] s2013: sup folks
[16:58:12] s2013: sup blahwoop
[16:58:14] Pupeno: tfitts: no, this is a big screen sitting on the wall broadcasting that information for the whole team.
[16:58:26] blahwoop: not much. just messin with rails
[16:58:35] s2013: what did rails ever do to you man? pick on someone your own size
[16:58:58] jrgriffiniii: Hello Everyone
[16:59:22] tfitts: Pupeno: we have something like that we call a scoreboard in our shipping area, I just do it with http refreshes, though I wrote it years ago so I maybe would just do javascript to switch tabs or something.
[16:59:53] Pupeno: tfitts: what do you mean by http refreshes, how do you render the pages?
[17:00:11] blahwoop: rails messed with me first
[17:00:25] s2013: any one has questions regarding rails that they are too embarassed to ask? now is stupid question hour. go
[17:00:28] Advocation: Anyone familiar with Devise? I have a weird issue - https://gist.github.com/Advocation/5d83ca64fc02618ddc50
[17:00:35] jrgriffiniii: Quick question: where might I find help for error messages related to the table "content_blocks"?
[17:01:01] blahwoop: can i send a link through pm?
[17:01:06] tuelz: is rails really funded by ISIS?
[17:01:14] s2013: sure blahwoop
[17:01:17] s2013: yes tuelz
[17:01:32] tuelz: s2013: why do I feel judged anyways....
[17:01:38] tfitts: Pupeno: what do you mean how do you render the page? I just have the http refresh redirect to the next page in the loop
[17:01:54] s2013: you arent
[17:01:56] s2013: or maybe you are
[17:02:00] tfitts: and you create the view to be what you would want it if you were looking at it in a browser
[17:02:05] Pupeno: tfitts: oh, are all of these custom web pages?
[17:02:30] daveomcd: how can i validate a attribute to be within various ranges... like the following is incorrect but i feel it shows what im attempting to do: validates :height, :numericality => { in: { 5020..5028, 5030..5038, 5040..5048 } }
[17:02:32] tfitts: yeah, but you could also just render each part in a different tab and have some js that switches tabs and refreshes the data
[17:02:34] s2013: Advocation, you need to probably add devise_for :user
[17:02:45] tfitts: or not do them in tabs, just refresh it and show/hide divs
[17:02:59] tfitts: lots of ways to do it.
[17:03:05] tuelz: hmm, have any of you ever had problems with your rails console not wanting to start up?
[17:03:13] tuelz: server run just fine...
[17:03:47] tfitts: tuelz: sometimes, but it usually throws a pretty obvious error.
[17:03:54] tfitts: yours just won't start?
[17:03:58] Pupeno: tfitts: how would you keep it secure so someone can't plug in a keyboard and a mouse on that computer and have access to all those web sites that you are logged in?
[17:04:24] mordocai: smathy: Sorry, was on a call. It is httpie
[17:04:32] Advocation: s2013: yeah, already got that. Sorry, that should have been in the gist - updating now
[17:04:40] mordocai: smathy: Results in json that looks like {"results": []}
[17:04:40] tuelz: is there a verbose when running rails console? It's justhaning until I sigint it
[17:04:54] mordocai: smathy: Ugh, items not results
[17:04:56] s2013: also should be devise_scope :user
[17:05:01] s2013: singular, im pretty sure
[17:05:03] s2013: but i might be wrong
[17:05:13] tuelz: and on sigint it just tells me spring stuff got interuptted
[17:05:54] tfitts: Pupeno: you could pull the data through httparty or something into your server so that the browser isn't actually logged in to GA and they wouldn't have access to anything except what you wanted to show, you could use APIs, you could fire people who plug in a keyboard or mouse.
[17:07:20] Advocation: s2013: https://gist.github.com/Advocation/5d83ca64fc02618ddc50 <= that???s what I???m working with now
[17:07:23] Advocation: and still producing the same error :(
[17:07:31] s2013: did you restart?
[17:07:44] s2013: i said devise_for :users
[17:07:48] s2013: and devise_scope :user
[17:08:39] Advocation: Yup, that hasn???t worked
[17:08:58] Pupeno: tfitts: the reason why I'm asking this is because I build a product that solves all of these problem, but I don't know how to market, I don't know what people search for to find this product. What would you search for if you knew this product exists?
[17:10:28] tfitts: well, one question I was going to ask before those was why would you want to show GA or new relic data to a team and not let them have access to it?
[17:10:46] mordocai: It might help with helping me with my issue that this pull request is why I wouldn't have to worry about it in latest rails: https://github.com/rails/rails/pull/16924
[17:10:47] tfitts: anyway, I'd search for limited access reporting data or something like that
[17:11:30] Pupeno: tfitts: oh... the team has access to it on their locked/encrypted computers... I don't want to have a wall mounted computer logged in into new relic, I don't want a visitor or someone that broke into the office to have access to new relic, ga, linode, etc. It would be like giving my company away.
[17:12:46] tfitts: well, it sounds like an novel solution to perhaps someone's problem.
[17:13:33] tfitts: I would think most dev houses that have that much interest in New Relic data would probably write their own solution for that problem, but the GA part might have a more general market
[17:14:35] s2013: Advocation, also shouldnt it be => 'devise/sessions#new'
[17:15:26] smathy: mordocai, the way Rails creates an array is to set: items[]= not items=[]
[17:16:03] mordocai: smathy: I'm not using syntax like that in rails?
[17:16:29] tuelz: hmm so I reverted to a known workin branch of my project and rails console is still hanging giving me no error....thoughts?
[17:16:45] tuelz: I can start the server no problem and app runs fine
[17:16:52] Advocation: s2013: that results in ???uninitialized constant App::Devise???
[17:17:30] bricker: tuelz: check spring
[17:18:02] tuelz: bricker: I have no idea how spring works, but I guess there's no time like the present to learn
[17:18:19] smathy: mordocai, in the form side of Rails, the way it creates an array, so that the controller side of Rails will treat it like an array is.... items[]= NOT items=[]
[17:18:43] smathy: mordocai, ie. that's what will be sent to Rails in the POST/GET query string.
[17:18:45] s2013: Advocation, https://github.com/plataformatec/devise/issues/1424 you might have seen it but this is what if ound
[17:19:07] smathy: mordocai, ie. that's what you need to reproduce in any curl/httpie/etc. post.
[17:19:37] tuelz: spring says the server was started an hour ago and the app 1 second ago in dev mode.
[17:19:44] smathy: mordocai, the fact that you're using the := which is for "when sending JSON" would also be something I'd change.
[17:19:51] bricker: tuelz: just kill spring
[17:19:55] bricker: tuelz: and preferably remove it from your app
[17:20:04] smathy: Spring is awesome.
[17:20:08] bricker: smathy: except when it's not
[17:20:15] tuelz: bricker: yep that worked
[17:20:16] smathy: Spring and Turbolinks are awesome.
[17:20:27] tuelz: I love them both when I love them
[17:20:42] smathy: bricker, sometimes you have to restart webrick, does that make it also worth removing from your app?
[17:20:45] tfitts: Turbolinks sometimes causes my JS to do funnt things
[17:21:01] smathy: tfitts, yeah, you have to be aware of it's nuances.
[17:21:11] Advocation: s2013: thanks, that???s similar, but I???ve done the devise_for :users before the devise_scope :user, so I???m not sure that fits.
[17:21:22] bricker: smathy: while pondering your argument, do you want me to ignore the fact that Rails doesn't include any web servers, including Webrick, into your app by default?
[17:21:39] Advocation: s2013: I might post it as an issue on Github and see if they have any ideas or if it is a bug due to running it in a namespace
[17:21:44] tuelz: smathy: an app server is a necessary evil. There's nothing wrong with tubrolinks and I presume spring, but they add a lot of complexity that people many not feel is justified by their functionality.
[17:21:52] smathy: (and I totally agree that the Rails communications needed to make the gotchas way more public/obvious when they defaulted to turbolinks and spring)
[17:22:02] bricker: smathy: and that webrick almost never causes your app to silently and mysteriously hang
[17:22:21] tuelz: the best code is the code you didn't have to write and the best dependencies are the ones you don't have to use imho
[17:22:46] s2013: yeah try it
[17:23:03] bricker: smathy: yeah. turbolinks and spring and two unnecessary things that make development more difficult for new rails devs.
[17:23:10] bricker: they should be opt-ins, not opt-outs
[17:23:24] bricker: like, no question.
[17:24:02] tuelz: if you learn turbolinks and it's edge cases it's pretty darn cool, but I don't want to do that.
[17:24:34] smathy: bricker, I've not had "silently and mysteriously hang" with spring either, only "not reload changed files"
[17:24:42] smathy: (which is the same thing you get with webrick sometimes)
[17:24:51] tuelz: smathy: just happened to me three minutes ago :p
[17:25:17] tuelz: no error messages, no logs I can find, checked 'spring status' everything was fine it said
[17:25:17] smathy: tuelz, not saying it's never happened, but is anyone saying that webrick has never hung for anyone either?
[17:25:19] bricker: smathy: for a new dev having to kill a background process to make your app work isn't impressive workflow.
[17:25:40] tuelz: smathy: honestly I've never had webrick break and not give me a reason and give me all indications that it's working
[17:25:42] bricker: smathy: and 99% of the time someone comes in here with a hung boot-up, it's because of spring
[17:26:17] smathy: tuelz, depends what you mean for "break", not reloading a changed file is broken AFAIC
[17:26:39] bricker: spring is one of those things that was supposed to "just work", but doesn't. An extra burden on the developer.
[17:26:44] smathy: bricker, yeah, I'm not saying there aren't gotchas, but once you know them, the fixes are simple.
[17:26:50] tuelz: smathy: never had that happen before either *shrug*
[17:26:56] smathy: Like I said, I think the gotchas should have been communicated better when spring became the default.
[17:27:10] bricker: smathy: dunno, I would rather just write an app that boots up quickly. spring feels like a crutch to me.
[17:27:10] smathy: ...but to just remove it from your app is throwing the baby out with the bathwater.
[17:27:15] bricker: same with turbolinks
[17:27:39] smathy: To rewrite what turbolinks does means you'd have the same issues that people have with turbolinks.
[17:27:53] mordocai: smathy: If anything needs to change it is the tests. The way I'm sending it via httpie is the way our clients send it. If the problem is that the way the tests are written send it differently then that is what I need to change.
[17:28:07] smathy: Again, once you know the peculiarities of it, you approach it it's no differently than you do to to anything that loads ajax.
[17:28:08] jerry_tao: i always remove turbolinks but spring save a lot of times in total.
[17:28:46] smathy: mordocai, so they're sending JSON to your app which is an API, not responding with HTML? Maybe it's your example which needs fixing :)
[17:29:09] smathy: bricker, you'll never be able to write an app that boots as quickly as one that's already in memory.
[17:29:44] smathy: I've never known anyone who, once they understand the spring gotchas, can't work with it perfectly well.
[17:30:38] sivsushruth: https://en.wikipedia.org/wiki/2002_Tampa_plane_crash :|
[17:31:02] mordocai: smathy: Either way, the underlying issue is the results of my tests don't match the results in production because for whatever reason deep_munging (described https://github.com/rails/rails/issues/13420) doesn't happen in my tests. The tests are written the same way as the example. From what you said, I probably need to change to tests to get them to actually send JSON.
[17:33:03] tuelz: smathy: so what was the gotcha that caused spring to hang up and report to be running fine?
[17:33:04] mdan: i'm having a problem on 3.2 with asset precompilation...is there any way I can specify my engine asset paths in the engine config as opposed to the parent app?
[17:33:43] mdan: i have an initializer that says "app.config.assets.precompile += %w(application.js)" which only works in development :/
[17:33:54] smathy: tuelz, I've never investigated, but as soon as you know "if starting my server causes a total hang then I just kill spring and try again" then you're golden.
[17:34:05] mdan: or rather, it's for later versions ..
[17:34:52] smathy: mordocai, right, and they won't if your test isn't written in a way that reproduces how your app is used in production.
[17:35:05] smathy: mordocai, this is why it's so difficult to debug something with not the actual code.
[17:35:47] smathy: mordocai, if you still need help, create a new blank app, and reproduce the problem you're having there - so you can share actual code that demonstrates the same issue as your real app.
[17:36:03] mordocai: smathy: IMO the issue is apparent with the code example I gave. What the API returns is not part of the test. It is how the parameters are being processed by rails.
[17:36:11] xibalba: how would i go about converting a page into a PDF. I created a view to render out a page with css for the @print/media stuff, and i want to create a PDF of that doc
[17:36:20] smathy: mordocai, noted.
[17:37:12] jerry_tao: xibalba: wkhtmltopdf maybe this will help
[17:37:19] xibalba: cool i jusdt found that one too
[17:37:21] xibalba: thanks jerry_tao
[17:37:37] tfitts: xibalba: wickedpdf is good, I think it uses wkhtmltopdf
[17:37:42] xibalba: how about pdfkit?
[17:38:10] pipework: There's also phantomjs
[17:38:10] xibalba: does wicked_pdf work with rails4?
[17:38:20] xibalba: i read that sentence wrong :|
[17:38:22] tfitts: xibalba: yeah, I use it with 4.1.6
[17:39:51] markalanevans: Hey guys, question about managing environment variables. I know there are multiple gems (Figaro, .dotenv, etc) that help manage variables. But typically it's recommend to ignore them in your git repo.
[17:40:18] markalanevans: So what is the recommend place and way to store the production or other environment level variables.
[17:40:38] markalanevans: Where do they get stored and how do they get "deployed"
[17:42:05] pipework: markalanevans: So, I use Figaro, but never reference the constant. I commit them to my repo, but I never use it for production data. I set production environment variables at /etc/default/<app_name> during deploy time.
[17:43:01] markalanevans: pipework: so where do you store the producution files?
[17:43:26] markalanevans: do you have some other repo that has configs?
[17:43:55] markalanevans: Which your deployment process has access to , pulls down and then copies to /etc/defualt/app ?
[17:43:58] pipework: markalanevans: At work we use puppet and use their storage mechanism for that data. We try to generate secrets on-disk of the server without having to commit things.
[17:44:13] Scriptonaut: hey guys, I have this migration that changes a column. Would it be bad of me to edit that migration and change the default value it sets to that column? Or should I make a new migration for this
[17:44:32] centrx: Scriptonaut, Have you pushed your migration to the central repo yet?
[17:44:39] Scriptonaut: yes, it's an old one
[17:44:43] centrx: Scriptonaut, make a new one
[17:45:05] Scriptonaut: would this fall under a change_column? I'm only changing the default value, nothing else about the column
[17:45:06] pipework: Scriptonaut: Actually, the right question is has the migration been ran in any environments that are non-local?
[17:45:12] Scriptonaut: is there some special change_default or something
[17:45:19] Scriptonaut: pipework: yep
[17:45:21] Scriptonaut: it's a very old migration
[17:45:25] Scriptonaut: been in production for a year +
[17:45:27] pipework: Scriptonaut: Then yes.
[17:45:31] pipework: Make a new migration.
[17:45:34] markalanevans: pipework: so if you need a new env variable for your app. Where do you go to add it so that puppet knows about it?
[17:46:00] Scriptonaut: one last thing, should the migration be identical to the old one with just a different default value, or is there a change_default, rather than change_column, or something along those lines
[17:46:05] markalanevans: is it just some config file on your deployment server?
[17:46:11] pipework: markalanevans: If it can't be generated on disk?
[17:46:24] mordocai: smathy: So yeah, this is the fix. https://gist.github.com/mordocai/c478533cbde679d275a2. As you noted, the tests weren't actually sending JSON (whoever originally wrote them obviously thought they were, and I didn't know better).
[17:46:32] rhizome: Scriptonaut: no change_default. only the stuff in the right column: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements
[17:46:32] markalanevans: pipework: so i'm talking about api secrets, db username pw etc
[17:46:44] markalanevans: pipework: so what are you refereing to when you mean genrated on disk
[17:46:58] pipework: markalanevans: API secrets can be generated on the server at provision time.
[17:46:59] rhizome: woopsy. change_column_default
[17:47:07] Scriptonaut: change_column_default?
[17:47:08] pipework: Then not overridden unless you explicitly want to change the secret.
[17:47:28] markalanevans: pipework: I mean like third party api secrets
[17:47:32] markalanevans: i can't "generate" those
[17:47:38] markalanevans: they are provided to me and i need to store them
[17:47:43] rhizome: Scriptonaut: be sure to read the comments for that method
[17:47:54] markalanevans: same for database credentails,
[17:47:55] Scriptonaut: will do , thanks
[17:48:03] pipework: markalanevans: Ah, some people use hiera, or a pp manifest that they pass in from their trusted machine to puppet on a puppet run.
[17:48:12] smathy: mordocai, cool. So, just a takeaeway for you, the sample Controller code you show makes no mention of the fact that it's an API endpoint, so that whole JSON avenue was something that I only accidentally noticed because I took the time to ask about the ":="
[17:48:35] markalanevans: pipework: I want to read more about this process, but i'm not sure what to google for
[17:48:48] markalanevans: all i end up finding are docs for tools to use env variables
[17:48:52] smathy: mordocai, you might want to lead with that next time ;)
[17:48:54] markalanevans: but not how ot manage and deploy them
[17:49:13] pipework: markalanevans: Whale, deployment and provisioning gets real deep. I'd suggest you look into salt and maybe ansible.
[17:49:50] mordocai: smathy: Yeah, will do. Sorry about that and thank you!
[17:50:36] smathy: mordocai, you're welcome.
[17:51:05] markalanevans: pipework: ok. So usually these deployment processes have a method for dealing with this
[17:51:45] pipework: markalanevans: Yeah. Most have methods of handling secrets and they tend to vary.
[17:51:58] pipework: markalanevans: http://docs.ansible.com/playbooks_vault.html
[17:53:41] jerry_tao: does chef do the same thing?
[17:53:57] mdan: i just want my gem's assets precompiled from whatever app includes it--is that so much to ask?
[17:54:00] jerry_tao: i really don???t know it well.
[17:54:25] bricker: jerry_tao: chef and ansible fill the same role
[17:54:27] markalanevans: thanks pipework
[17:54:52] pipework: jerry_tao: chef most definitely has support for secrets.
[17:55:21] bricker: I misunderstood his question I think
[17:56:06] jerry_tao: lol i have no questions, just learn sth.
[17:57:01] JyZyXEL: is it possible to check the Rails.cache items age?
[17:58:59] jamgood96: I need to generate a form for adding/removing and updating relationships in a has_many through relationship. I currently have it working where I can update and remove the relationship and data, but have no idea how to create a form for adding
[17:59:45] JyZyXEL: how do i make a Cache.write that does not execute the database command unless the older cache has timed out?
[18:00:23] pipework: JyZyXEL: I'd guess with ruby.
[18:00:42] pipework: Consider making a store that you can set as your cache_store in rails. google that.
[18:00:42] JyZyXEL: well how do i check the age of a cache entry then?
[18:01:00] pipework: JyZyXEL: Probably by inserting the time that the entry was added to the entry?
[18:01:29] JyZyXEL: what about using the expiry in the Rails.cache itself?
[18:01:42] ellisTAA: i???m working through hartl???s tutorial and in chapter 5 when i create a scss file and add @import ???bootstrap???; it raises an error when i try to load the webpage. this is the error: wrong number of arguments (2 for 1) for `asset-url' ???anyone know whats going on?
[18:01:47] pipework: Just look into custom cache stores in rails.
[18:02:31] JyZyXEL: but this is not custom
[18:02:46] JyZyXEL: its just a very basic time based expiry
[18:03:22] JyZyXEL: so the database command only gets executed if the last entry in the cache is older than 10 minutes
[18:03:31] pipework: Sounds like you either need to insert the time you add the data or you need a custom store.
[18:04:01] pipework: Look into the source of the existing cache store, and if it doesn't do what you want or let you insert time into the entry, you will have to do it yourself or write your own store.
[18:04:14] JyZyXEL: but Rails.cache already has some expiry features
[18:04:26] pipework: I have to go drink now.
[18:04:31] JyZyXEL: timeToIdle, tti
[18:04:34] JyZyXEL: timeToLive, ttl, expires_in
[18:04:53] JyZyXEL: can i use those?
[18:05:01] pipework: You tell me.
[18:05:07] helpa: Why don't you try it and find out for yourself?
[18:05:07] JyZyXEL: well i don't know
[18:05:09] momomomomo: JyZyXEL: pipework that can be done with cache
[18:05:24] momomomomo: i.e. if (some condition) go get the new value
[18:05:26] momomomomo: else use the cache
[18:05:28] pipework: Put some effort into ti!
[18:05:54] JyZyXEL: momomomomo: the condition is to check if the last entry in the cache is more than 10 minutes old
[18:06:09] JyZyXEL: but how do you check that in practice?
[18:06:13] momomomomo: http://railscasts.com/episodes/115-model-caching-revised
[18:06:23] momomomomo: it???s really simple, actually
[18:06:45] JyZyXEL: it would be if there is a method that allows me to get the age of the cache entry
[18:06:57] Scriptonaut: rhizome: the comments in change_column_default are saying to just use change_column, and to make sure to specify the correct datatype. Does anyone here have a clue what is wrong with change_column_default?
[18:07:01] Scriptonaut: it looks better imo
[18:07:03] momomomomo: uh, JyZyXEL that???s part of the simplicity
[18:07:10] Scriptonaut: (for changing just the default, not the datatype or anything else)
[18:07:21] momomomomo: easy to do, just do a bit more research and watch that railscast
[18:07:33] JyZyXEL: momomomomo: the railscast link doesn't work
[18:07:36] AirNest: Good afternoon gentleman, I have a quick question: I have a @random_record = Record.random that is used in a partial, and in multiple controllers, where should I put this query for my app to be dry ?
[18:07:46] JyZyXEL: requires some kind of subscription
[18:08:56] waseem_: AirNest: A method in application controller.
[18:09:05] bricker: AirNest: make a private method in ApplicationController and call it as a before filter wherever you need it
[18:09:29] JyZyXEL: momomomomo: i just need to know the name of the method or the variable that contains the age of the cache entry
[18:09:33] JyZyXEL: then i can write this thing
[18:09:35] pipework: JyZyXEL: Spend two minutes researching: https://github.com/rails/rails/blob/7f937914576c65a01f3a9528d1728720c6c400c5/actionpack/lib/action_controller/caching.rb#L78
[18:09:37] AirNest: bricker, got it, laravel has something called view composer, I thought maybe rails had soemthing similar.
[18:09:50] AirNest: Thanks for the tip waseem_, bricker !
[18:10:11] pipework: JyZyXEL: Think more about your problem. It's extremely trivial, but you need to think about it. Look at the source of the caching methods, read more, think about it.
[18:12:18] pipework: You have two questions: 1) How do I cache something for n units of time? 2) How do I use the cache until that data is expired, and only if it is, make a database query and possibly cache that result for n units of time also?
[18:12:21] JyZyXEL: pipework: this is essentially what needs to happen: Rails.cache.write("top 5 score", Score.top(5)) if Rails.cache.read "top 5 score".nil? or data_in_cache_too_old
[18:12:41] pipework: JyZyXEL: Please look at the source I linked you.
[18:12:44] JyZyXEL: checking the caches age is the final piece to the puzzle
[18:13:14] pipework: It's actually the first piece.
[18:13:34] pipework: Why are you caching data for longer than you want to use the cache? Why not cache it for as long as you want to use the cache?
[18:14:02] JyZyXEL: but i need to make sure the database queries are not executed every time
[18:14:12] JyZyXEL: otherwise the cache serves no purpose
[18:14:17] bricker: AirNest: Rails has view helpers, but you generally don't want to build database queries in view helpers.
[18:14:34] JyZyXEL: if i just do: Rails.cache.write("top 5 score", Score.top(5))
[18:14:41] pipework: JyZyXEL: Please dear god, read the damn source or stop talking. :)
[18:14:42] JyZyXEL: then the database command is executed every time
[18:15:02] pipework: Did you read it though? Like really read it?
[18:15:13] JyZyXEL: what little i understand
[18:15:16] JyZyXEL: which is not much
[18:15:33] jerry_tao: Try assign it to a var first.
[18:15:45] jerry_tao: ( i never used it just a guess.
[18:16:19] joelbrewer: JyZyXEL: learning how to read documentation is key to becoming a good dev. I suggest you spend some time leveling up that skill.
[18:16:42] JyZyXEL: i can't find any decent documentation for Rails.cache
[18:17:05] joelbrewer: JyZyXEL: Ahh. Is this source code? Well, learning how to read source code is key too ;)
[18:17:11] bricker: JyZyXEL: !g Rails.cache
[18:17:27] pipework: JyZyXEL: https://github.com/rails/rails/blob/7f937914576c65a01f3a9528d1728720c6c400c5/activesupport/lib/active_support/cache.rb#L179-L305
[18:17:38] pipework: Miaow go read that. Your questions should all be answered.
[18:17:43] bricker: http://guides.rubyonrails.org/caching_with_rails.html http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
[18:18:03] pipework: Also, consider leveling up your code spelunking skills.
[18:18:05] bricker: JyZyXEL: Rails.cache offers a way to set TTL on a cache key, you will want to use that.
[18:18:06] JyZyXEL: ok so you are suggesting i need to use the .fetch
[18:18:28] JyZyXEL: fetch seems to be doing the things i need
[18:18:38] joelbrewer: binding.pry ftw!
[18:20:59] bricker: jamgood96: (from #ruby) unfortunately that's no trivial task. Look at a gem called Cocoon (it's the only one I know of but I never had luck with it) or look into building it yourself.
[18:21:43] JyZyXEL: pipework: so it would be: Rails.cache.fetch("top 5 score", expires_in:10.minutes) do Score.top(5) end
[18:21:57] pipework: You tell me.
[18:21:59] helpa: Why don't you try it and find out for yourself?
[18:22:22] jamgood96: How do I modify the code in HABTM Checkboxes video (http://railscasts.com/episodes/17-habtm-checkboxes) to work with a has_many through relationship?
[18:23:10] joelbrewer: ACTION wonders how many SO and IRC questions could be avoided if people learned how to read documentation
[18:23:41] bricker: jamgood96: show us the actual code that you have tried so far
[18:24:36] ellisTAA: anyone know who this: <%= stylesheet_link_tag "application", media: "all" %> is giving me this error: wrong number of arguments (2 for 1) for `asset-url'
[18:25:06] JyZyXEL: pipework: something is still wrong with it
[18:25:31] JyZyXEL: pipework: i assume the Score.top(5) needs to be saved somehow
[18:26:10] JyZyXEL: like this: Rails.cache.fetch("top 5 score", expires_in:10.minutes) do Rails.cache.write("top 5 score", Score.top(5))
[18:26:39] jamgood96: bricker: Here's the snippet from the form I have so far
[18:26:41] jamgood96: https://gist.github.com/jamesgoodhouse/a18e7c1a3356dbaadaca
[18:26:51] JyZyXEL: damn it, it doesn't work still
[18:27:49] Synthead: if I have a Person model with has_many :orders, can't I do Person.create(order: order_object) ?
[18:28:14] jamgood96: bricker: What I have so far allows for me to edit existing relationships (campaign_locations), but I to show *all* available locations along with ones that are currently selected
[18:28:48] bricker: JyZyXEL: what doesn't work? Are you in development mode? Have you enabled caching in your environment? (It's disabled by default in development)
[18:29:09] JyZyXEL: bricker: i also needed to assign the return value from .fetch
[18:29:30] Synthead: oh wait, never mind, pebkac
[18:29:35] bricker: JyZyXEL: eh?
[18:29:55] JyZyXEL: bricker: @top_score = Rails.cache.fetch....
[18:30:01] bricker: jamgood96: I see. That's easier than what I thought you were trying to do
[18:30:25] bricker: JyZyXEL: it's not working?
[18:30:33] JyZyXEL: now it is probably
[18:30:36] bricker: JyZyXEL: oh
[18:30:49] JyZyXEL: im still testing if it has the performance benefit im expecting
[18:31:15] bricker: JyZyXEL: make sure cache is enabled in your environment (config.action_controller.perform_caching = true)
[18:32:04] bricker: jamgood96: it should work the same as the HABTM checkboxes, although I am a little rusty as I let Simple Form handle all that for me these days
[18:35:08] jamgood96: bricker: that's what i like to hear
[18:35:25] jamgood96: bricker: where do i start for implementing it?
[18:40:57] ellisTAA: anyone know who this: <%= stylesheet_link_tag "application", media: "all" %> is giving me this error: wrong number of arguments (2 for 1) for `asset-url'
[18:42:52] rushed: ellisTAA: you might be using the asset url helper wrong in your css templates somewhere
[18:43:45] JyZyXEL: its still wrong
[18:43:48] ellisTAA: rushed: what is the asset url helper?
[18:43:53] JyZyXEL: @top_score gets the value true
[18:44:00] JyZyXEL: i think its coming from Rails.cache.write
[18:44:28] rushed: ellisTAA: is this not your app?
[18:44:36] bricker: ellisTAA: search the project for 'asset-url'. In Rails 3 it took a URL and a type, now the type is inferred.
[18:44:40] ellisTAA: rushed: i???m just following along with hartl???s tutorial
[18:45:00] rushed: ellisTAA: are you using the right versions of everything for the tutorial you're following?
[18:45:09] ellisTAA: rushed: i dont think so :\
[18:45:52] rushed: ellisTAA: probably want to find the latest version of a tutorial that will cover the latest versions :)
[18:46:28] bricker: JyZyXEL: Rails.cache.fetch returns the cached value, or the return value of block. Either you're using it wrong or one of those two things is returning `true`
[18:46:45] rushed: ellisTAA: or if you want to get a flavor for things without installing anything you might like http://railsforzombies.org
[18:47:28] JyZyXEL: bricker: how do i make the Rails.cache.write inside the do...end block return the cached value instead of true?
[18:47:45] ellisTAA: rushed: where do u think asset url might be?
[18:48:09] JyZyXEL: i guess i can just add another @top_score = Rails.cache.read... after it
[18:48:10] rushed: ellisTAA: it doesn't matter, there is no point trying to fix something that is expecting a different version`
[18:48:10] bricker: JyZyXEL: You don't. You're using Rails.cache.fetch incorrectly. Please read the documentation for fetch http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch
[18:48:31] JyZyXEL: bricker: i did read exactly that
[18:48:36] ellisTAA: rushed: so far everything has worked so might have the right version ???
[18:48:40] JyZyXEL: but i cannot figure out a better way
[18:48:43] bricker: JyZyXEL: Read it more carefully. fetch is a wrapper around write, you don't need both.
[18:49:11] bricker: Rails.cache.fetch("your-key") { "Your Return Value" }
[18:49:55] JyZyXEL: bricker: so you are saying @top_score = Rails.cache.fetch("top 5 score", expires_in:10.minutes) do Score.top(5) end
[18:50:05] bricker: JyZyXEL: yep
[18:51:40] JyZyXEL: still it got the value: true
[18:52:14] JyZyXEL: how can it be returning that
[18:52:42] JyZyXEL: Score.top(5) returns a hash when i try it
[18:54:40] JyZyXEL: bricker: i think it still requires @top_score = Rails.cache.read .... after the fetch
[18:54:40] Synthead: is there a way I can do (python) [a[key] for key in ("a", "b", "c")] in ruby?
[18:54:58] JyZyXEL: there doesn't seem to be any way around it
[18:55:10] JyZyXEL: Rails.cache.fetch just doesn't return the right thing
[18:56:03] jamgood96: bricker: did you have any insight into the has_many through form?
[18:57:24] rushed: Synthead: that blows up in the only python repl I have around, do you have example input & output?
[18:58:09] bricker: jamgood96: what's not working currently?
[18:58:36] bricker: JyZyXEL: probably because the cached value is stale
[18:58:42] bricker: JyZyXEL: like, it cached the wrong value before
[18:58:46] jamgood96: bricker: the form I has is working, however I want to include not only the selected locations, but all locations and be able to check a box next to them and add that relationship
[18:58:53] bricker: JyZyXEL: and now you changed the block but didn't clear out the cached value
[18:58:57] bricker: JyZyXEL: you know... cache.
[18:59:04] Synthead: rushed: sure: a = {a: 1, b: 2, c: 3, d: 4, e: 5}, result {a: 1, b: 2, c: 3}
[18:59:16] JyZyXEL: bricker: so there is no way around it really
[18:59:23] bricker: JyZyXEL: Clear yor cache.
[18:59:28] bricker: And try again
[19:00:27] JyZyXEL: bricker: your right, after Rails.cache.clear it seems to work
[19:00:41] JyZyXEL: really weird
[19:01:04] bricker: jamgood96: You'll need to get all values and loop through them, and set `checked=true` where necessary
[19:01:11] bricker: JyZyXEL: how is it weird??
[19:01:14] rushed: Synthead: a.select{ |k| %i{a b c}.include?(k) }
[19:01:16] bricker: JyZyXEL: You wrote "true" into cache
[19:01:29] bricker: JyZyXEL: So when you asked Rails to fetch that value for you, it returned "true"
[19:01:37] bricker: it was working exactly as intended
[19:01:41] JyZyXEL: it would have started to work after 10 minutes :))
[19:01:52] rushed: Synthead: is one of a large number of ways you might do that
[19:02:33] Synthead: rushed: what is %i?
[19:02:42] pipework: Synthead: List of symbols
[19:02:49] pipework: Synthead: !g ruby percent syntax
[19:04:34] jamgood96: bricker: I guess I'm at a loss on how to loop through them given the code I have currently (https://gist.github.com/jamesgoodhouse/a18e7c1a3356dbaadaca) and still make it fully submitable (i.e., that it updates/destroys the relationships I already had and that it adds the new ones)
[19:06:03] Synthead: is there a way to do dine_or_create_by to just create a new model object without saving it to the db (to run save! later?)
[19:06:12] Synthead: find_or_create_by
[19:06:41] Synthead: oh! just found it: find_or_initialize_by
[19:09:03] xibalba: any of you guys know if `wkhtmltopdf` can render SVG? I think it's only for specific items, e.g, --checkbox-checked-svg <path> Use this SVG file when rendering checked checkboxes
[19:09:10] xibalba: Doesn't seem to be rendering my SVG
[19:12:34] tubbo: pow users...any way to get the tmp/always_restart.txt functionality to not *actually* restart every time? what i mean is...it takes FOREVER because it seems to be restarting on every request which includes some dynamic (generated) asset requests
[19:12:44] tubbo: so if i visit a page it's actually making a few bg requests
[19:12:55] tubbo: i just want it to restart on the first visit, not on every subsequent restart
[19:13:32] rushed: tubbo: so you don't want always_restart to... always restart?
[19:13:53] rushed: tubbo: have you considered not using always_restart? :P
[19:14:02] blahwoop: i'm having issues with trying to setup my api. it always returns no route matches. https://gist.github.com/iRichLau/7ff2ba950d618378d4c6
[19:14:05] tubbo: rushed: :D well...i'd like it to restart when i actually hit enter in my browser. but that's the only time.
[19:14:20] tubbo: rushed: also, i could potentially *not* use the world's shittiest rails server
[19:14:23] blahwoop: i haven't done much to it. its the initial set up. im sure the routes are right. not sure whats wrong
[19:14:45] tubbo: blahwoop: no route matches what?
[19:14:53] blahwoop: get "/tags"
[19:15:05] tubbo: blahwoop: you haven't shown where the actual code you're trying to use is. or are you just trying to go to localhost:3000/tags in your browser?
[19:15:35] blahwoop: yeah i tried curl api.localhost:3000/tags
[19:15:42] rushed: blahwoop: api/tags
[19:16:06] blahwoop: i named spaced it so it doesn't need api/tags
[19:16:24] tubbo: blahwoop: run `rake routes` and see what the generated URL is
[19:16:37] tubbo: blahwoop: that's not what a namespace does
[19:16:37] blahwoop: it's '/tags'
[19:16:57] bricker: jamgood96: you should be able to just use collection_check_boxes: http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes
[19:16:59] tubbo: blahwoop: i think you might want a subdomain constraint there instead...
[19:17:05] tubbo: oh wait n/m :D
[19:17:18] tubbo: blahwoop: yeah i think you just want to add that `constraints:` onto the resources, get rid of the namespace
[19:17:32] tubbo: blahwoop: your route is going to be api.whatever.com:3000/api/tags if you do it this way.
[19:18:20] syngress: Hi, anyone can help me with that ?
[19:18:24] syngress: https://gist.github.com/syngressnetwork/8a145607e460e0781129
[19:19:00] blahwoop: so don't do path '/'
[19:19:30] tubbo: blahwoop: try getting rid of the namespace declaration and move the subddomain constraint to resources :tags
[19:19:37] Deithrian: Oh God I need help :( can you please recommend a book or video tutorial on rails that teaches Rails? I tried two video tutorials one of them was a lesson on how to write "tests" and 1% rails, the other one was "Type this and it works! Yey!" but doesn't explain Why >:( is there something that teaches bloody Rails out there?
[19:19:40] rushed: syngress: params[:zip][:zip]
[19:20:10] tubbo: Deithrian: did you try railstutorial.org ?
[19:20:19] Deithrian: that's the test guy >_>
[19:20:43] Deithrian: "And now we will run some tests" 2h videos with tests
[19:20:54] rushed: Deithrian: testing is usually a pretty central component of Rails development
[19:21:26] Deithrian: 11 videos in total, each with 2h, at video 6 the guy was still teaching CSS and no rails :( wtf
[19:21:26] syngress: rushed: undefined method `[]' for nil:NilClass
[19:21:31] blahwoop: still a no routes match
[19:22:10] Deithrian: what's the point of testing something you don't understand?!
[19:22:19] rushed: syngress: what did you post (the params will be in the console log)
[19:23:20] syngress: rushed: i'v got only NoMethodError (undefined method `[]' for nil:NilClass):
[19:23:27] EminenceHC: Deithrian: Hands down my favorite tutorial to learn rails with: https://www.railstutorial.org/
[19:23:34] rushed: Deithrian: you're being sarcastic, but pragmatically if the tests pass you may not need to understand it :)
[19:23:57] rushed: syngress: right, that suggests params[:zip] is nil
[19:24:04] jamgood96: bricker: collection_check_boxes works, but seems to be only for HABTM relationships, not has_many through... so I don't have a way to modify/add the additional fields stored in the join model
[19:24:37] syngress: i try one more thing
[19:24:45] syngress: rushed: thankyou
[19:28:10] Deithrian: Your hands down favorite tutorial is doing RegEx on video 7 out of 11 with no Rails for 7 lessons 2h each....
[19:28:36] Deithrian: RegEx 7 lessons in
[19:29:54] rushed: Deithrian: not *my* favorite, but if you know regex/css/whatever, you might consider skimming over sections dedicated to regex/css/whatever
[19:31:02] rushed: Deithrian: if you want a more feature based approach you might enjoy browsing http://railscasts.com (although some are out of date at this point)
[19:32:03] Deithrian: thanks rushed, I'll take a look, probably just go with the Rails guide :/
[19:32:10] rushed: Deithrian: or if you want a more there is no speed limit kind of approach pick something open source built in Rails and start reading
[19:35:39] tubbo: is there any way to use Guard with Rails without having to include it in your Gemfile
[19:36:00] pipework: tubbo: I think so, yeah.
[19:36:10] tubbo: how...it gives me errors
[19:36:13] pipework: You just need to have guard call bundle exec on shit instead.
[19:36:31] pipework: tubbo: My suggestion though is to eval a Gemfile.personal into your Gemfile for ease.
[19:36:40] tubbo: https://gist.github.com/tubbo/d9641b9ff0831cd892a3 is what i get when i run `guard init`
[19:37:01] tubbo: nah, i'll just add it to Gemfile and hope my tech lead doesn't notice :P
[19:37:02] pipework: tubbo: https://github.com/rails/rails/blob/master/Gemfile#L55-L57
[19:37:06] pipework: Just do that.
[19:40:00] jamgood96: bricker: i keep getting disconnected and likely missing some of your messages regarding HABTM forms
[19:40:30] rushed: jamgood96: http://logs.ryanbigg.com/RubyOnRails
[19:41:27] jamgood96: rushed: thanks!
[19:41:58] jamgood96: how would one do something like `collection_check_boxes` for a has_many through relationship?
[19:50:16] yoshie902a: Does anyone know mechanize well?
[19:50:55] smathy: jamgood96, basically exactly like the example in the docs, but instead of `Author.all` you want to put the association collection method there, like `@post.authors` (bastardizing the example in the docs)
[19:52:32] ellisTAA: put your thumb on your front teeth and swipe left or right, it makes the same sound when someone sends you a message
[19:52:35] tubbo: pipework: can't do the local Gemfile thing...as much as i'd like to...we commit Gemfile.lock on this project
[19:52:50] pipework: tubbo: That's easy to fix.
[19:52:59] tubbo: pipework: no it's not
[19:53:39] pipework: tubbo: sure it is. Add your Gemfile changes, bundle, commit, add your personal gemfile, bundle, work, remove your personal gemfile (mv Gemfile.personal{,.moved}, bundle, commit.
[19:53:59] pipework: Don't forget running test suites the slow way when personal gemfile is out of the way.
[19:56:42] syngress: rushed: are you there
[20:01:26] syngress: Anyone can help me with that: https://gist.github.com/syngressnetwork/ec67872a4076ba7a7e18
[20:05:01] jamgood96: smathy: how would i handle editing the additional fields associated with a has_many through join table?
[20:05:26] smathy: jamgood96, fields_for
[20:09:57] momomomomo: syngress: !ask
[20:09:57] helpa: syngress: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[20:16:02] Deithrian: Here we go again :)
[20:16:10] Deithrian: Why is this "In the Blog application, you will now create a new resource. A resource is the term used for a collection of similar objects, such as articles, people or animals. You can create, read, update and destroy items for a resource and these operations are referred to as CRUD operations."
[20:16:34] Deithrian: better than this "Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index, show, new, edit, create, update and destroy actions, a resourceful route declares them in a single line of code."
[20:17:03] Deithrian: A recourse is a term used for a collection of similar objects... :)
[20:17:06] centrx: For one, it defines what is a "resource"
[20:17:52] Deithrian: I'm teaching you a new language and in that language there's the word "Blazugaba", "Blazugaba" is a similar object to "people, animals and elephants"
[20:18:04] Deithrian: wow I totally know what the unknown word means
[20:18:08] xibalba: any users of wicked_pdf gem herE? having trouble with my PDF showing my SVG. When I use debug=1 mode, the SVG shows fine, I save the file and manually run it through wkhtmltopdf, and voila the SVG graphic shows up. Through the gem though it does not, and the flags look fine.
[20:18:13] centrx: What's an elephant
[20:18:25] syngress: Anyone can help me with that: https://gist.github.com/syngressnetwork/ec67872a4076ba7a7e18
[20:19:44] Deithrian: Instead of explaining that a resource helps you define a bunch of stuff like attr_accessors, or using the actual definition of that word for Rails, the "Getting started" guide choses to talk about "animals and people and the moon and pink"
[20:20:59] Deithrian: " A resource is the term used for a collection of similar objects, such as articles, people or animals" just wow :)
[20:22:09] centrx: syngress, What does the log show as the actual Parameters being sent?
[20:22:30] sivsushruth: syngress also post your stack trace
[20:22:56] weaksauce: Deithrian what would you like them to say?
[20:24:00] Deithrian: weaksauce, they have written the definition "Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index, show, new, edit, create, update and destroy actions, a resourceful route declares them in a single line of code."
[20:24:55] Deithrian: Why does "The letter "X" is a collection of similar objects like popcorn, wind and dancing" make sense to anyone?!
[20:25:13] syngress: centrx: NoMethodError (undefined method `[]' for nil:NilClass) i try with -> rvnumber = params[:zip][:zip]
[20:25:30] sivsushruth: syngress post the stack trace on gist
[20:25:43] weaksauce: Deithrian https://en.wikipedia.org/wiki/Resource-oriented_architecture
[20:26:05] weaksauce: it's opensource... come up with a better way to phrase it and submit a pull request
[20:27:03] syngress: sivsushruth: https://gist.github.com/anonymous/d101e522e84a7a7a42b0
[20:27:22] sivsushruth: h/o started dota2 game, let me get back
[20:27:46] Deithrian: weaksauce, there already is a better way of phrasing it, which I quoted to you from the same website, http://guides.rubyonrails.org/routing.html#resource-routing-the-rails-default
[20:28:13] pontiki: I just joined, but now I'm waiting to hear how someone makes popcorn, wind, and dancing similar without resorting tortured analogies
[20:29:49] pontiki: ACTION dances a bit in her chair in anticipation, munching some popcorn and waiting for the winds of conversation to bring enlightenment
[20:30:10] centrx: We were promised popcorn, wind, and other resources
[20:30:28] Deithrian: I guess someone was more keen on showing how many top notch buzz words he knows in the Rails getting started tutorial instead of teaching what the bloody thing does
[20:31:10] pontiki: ad hominem
[20:33:00] blitz: is there any downside to "return Model.save!"
[20:33:11] blitz: as opposed to "Model.save!; return Model"
[20:33:26] centrx: I assume you mean instance not Model
[20:33:34] blitz: yes, it's an instance ofa model
[20:33:51] pontiki: Model is the class, though, not the instance
[20:33:55] weaksauce: Deithrian that's resource routing which is different than resources just
[20:34:25] weaksauce: you can still have a resource and not use the resource routing
[20:34:50] centrx: blitz, If you're using save!, you may want to catch the exception
[20:35:12] centrx: blitz, but the two examples you have writtent are semantically equivalent
[20:35:13] blitz: symantically, it's the same
[20:35:16] Deithrian: weaksauce, when you do "resources :articles" in routes.rb you're not "Resource routing allows you to quickly declare all of the common routes for a given resourceful controller...."?
[20:35:20] blitz: semantically*
[20:36:01] weaksauce: Deithrian not sure what you are asking
[20:36:58] weaksauce: article is a resource. but it can exist without routing to it
[20:38:33] Deithrian: weaksauce, I'm following this http://guides.rubyonrails.org/getting_started.html
[20:38:44] Deithrian: When you reach "5 Getting Up and Running"
[20:38:57] Deithrian: They introduce resources :articles
[20:39:20] Deithrian: And they explain it with "A resource is the term used for a collection of similar objects, such as articles, people or animals"
[20:39:57] Deithrian: to someone who doesn't know what "recourses" does in Rails, this makes zero sense, articles?! people? Animals?! what?!
[20:40:15] Deithrian: but they do have a meaningful explanation at http://guides.rubyonrails.org/routing.html#resource-routing-the-rails-default
[20:41:10] Deithrian: Which says that "recourses :articles" is supposed to create stuff for accessing this recourse just like "attr_accessor" would for a class
[20:42:03] Deithrian: I am not asking anything, I was able to find the better definition for what they introduce in that step on their website.
[20:42:28] Deithrian: I am just expressing my frustration that someone prefers to use buzz words instead of explaining the functionality of what they have introduced for the first time
[20:42:48] weaksauce: what buzz words are they using?
[20:42:54] Deithrian: in which line do you see "resources :articles" explained in the getting started tutorial?
[20:43:02] Deithrian: http://guides.rubyonrails.org/getting_started.html
[20:43:18] weaksauce: > Rails provides a resources method which can be used to declare a standard REST resource. You need to add the article resource to the config/routes.rb as follows:
[20:43:29] weaksauce: the next paragraph
[20:43:35] Deithrian: Where does it say that this line of code creates code for you that has functionality of A,B and C
[20:43:49] weaksauce: the next paragraph
[20:43:52] weaksauce: > If you run rake routes, you'll see that it has defined routes for all the standard RESTful actions. The meaning of the prefix column (and other columns) will be seen later, but for now notice that Rails has inferred the singular form article and makes meaningful use of the distinction
[20:44:52] Deithrian: rake routes explains "recourses :articles"?
[20:45:27] Deithrian: bundle install explain "gem 'sqlite3'?
[20:45:45] Deithrian: I mean XD just...
[20:45:46] jimbow: rails sucks dick and if you don't use django you're a cock sucking faggot
[20:45:47] Deithrian: forget it..
[20:46:17] weaksauce: Deithrian perhaps the rails getting started guide isn't for you
[20:46:30] weaksauce: try radar's book or something else maybe
[20:46:41] jimbow: try using a real framework
[20:46:44] jimbow: rails is for faggots
[20:47:09] Deithrian: Yes, I should turn to railstutorial for 14 hours of writing 3 lines of HTML, testing 3 lines of HTML, then some CSS and RegEx XD
[20:47:11] jimbow: everyone i know that uses rails likes dick up their ass... fact
[20:47:27] weaksauce: Deithrian never said that. I don't particularly like that site
[20:47:32] centrx: How do you know?
[20:47:57] jimbow: also don't be a fucking nigger
[20:47:59] weaksauce: but you also can't have it both ways. you either get brevity and terseness or you get something like hartl's tutorial that is too slow and over explains
[20:48:18] weaksauce: nothing will be perfectly matched to your level of knowledge
[20:49:46] Deithrian: Actually I'm pretty sure that a knowledgeable Rails developer will be capable of explaining the framework in 30 minutes. The reason people fail to explain how something works is because they don't know how it works. Hopefully there's a tutorial out there from someone who knows Rails.
[20:51:00] Deithrian: Or that other guy who was like "Write this in this file! Now type that here! Voila it works!" and never explains why or how it worked, and that's for how Rails communicates with the database and what the keywords he used actually do
[20:57:03] blahwoop: if i want a subdomain to work on localhost should i be modifying my hosts file to api.localhost
[20:57:17] blahwoop: or should it be something else?
[20:57:39] blahwoop: i cant seem to get my constraints api sub domain to work
[20:58:27] tubbo: Deithrian: if that was true, then why would anyone pay a rails developer ever?
[20:58:28] fakam: Hello, I'm using <%= time_ago_in_words(movie.released_on) %> ago I get this error: undefined method `>' for nil:NilClass
[20:58:36] tubbo: surely anything that can be completely taught in a half-hour does not have much value
[20:58:46] sivsushruth: blahwoop https://stackoverflow.com/questions/18793883/how-to-make-subdomain-on-my-localhost
[20:59:26] blahwoop: looks like im doing it right
[20:59:38] sivsushruth: fakam post a gist please
[20:59:49] blahwoop: keep getting a no route matches
[21:00:18] weaksauce: Deithrian you are blaming the authors, but really it's just like anything else that is highly technical, you are going to need to put in the time and look up things that don't make sense to you.
[21:00:24] Deithrian: tubbo, you mean there's more than half an hour of explaining Rails so that you can replicate the process for most projects you will encounter?
[21:00:54] sivsushruth: blahwoop watch this http://railscasts.com/episodes/123-subdomains-revised
[21:00:57] weaksauce: you keep pointing out that they didn't define resources correctly and keep pointing to the definition of a resourceful routing when they are two different concepts
[21:01:13] towski_: I am trying to use a single redis caching server, but if it goes down it takes the site down
[21:01:36] towski_: what is a good way to failover to file caching if the redis server times out?
[21:01:38] bricker: towski_: Today is the day you learn about HA
[21:01:57] bricker: towski_: and you should also learn about Redis Sentinel, it's great and provides HA for redis
[21:02:21] towski_: yeah I read about redis sentinel
[21:02:25] fakam: https://gist.github.com/iheartkode/8747bbef8245a0896caa
[21:02:33] towski_: seemed too complicated for what I need
[21:02:46] bricker: towski_: you need HA for redis
[21:02:48] towski_: also since it's just caching, I don't have a master- slave
[21:03:12] bricker: towski_: you set it up, redis makes it pretty easy
[21:03:34] towski_: well another issue is that
[21:03:41] Deithrian: weaksauce, even if I'm pointing to something incorrect, that doesn't make the way they explained a "new term" introduced for the first time in their tutorial with "it is similar to articles, people, animals"?!
[21:03:43] towski_: if I can't talk to any redis servers
[21:03:47] towski_: I have the same problem right?
[21:03:59] towski_: I just want it to ignore caching in that case
[21:04:17] Deithrian: Then they run a command that shows what that line of code actually did
[21:04:24] bricker: towski_: then you'll have to monkey-patch the redis ruby client to rescue from and ignore errors
[21:05:15] fakam: Anyone see my gist?
[21:05:17] towski_: bricker: thanks yeah that's what I leaning towards
[21:05:21] bricker: towski_: with a HA of two redis servers and sentinel managing them, it's unlikely that your app will be unable to talk to at least one of them. The only cause would be network problems, but in that case your website would probably be down too.
[21:05:38] sivsushruth: fakam your movie.released_on might be nil, so use time_ago_in_words(movie.released_on) unless movie.released_on.blank?
[21:06:09] fakam: Ahh I will add a time see if that works
[21:06:13] towski_: yeah we had networking problems just between redis and the site
[21:06:17] tubbo: Deithrian: there are all kinds of tutorials for rails. a lot of people watching these tutorials aren't complete beginners, they may have some prior knowledge and just want to find a quick little example for what they want to do. i know that's how i learned a lot of how rails works.
[21:06:19] bricker: towski_: I think ignoring errors is a bad idea.
[21:06:48] towski_: bricker: I would probably report them to getsentry, I just don't want it taking the site down
[21:06:48] weaksauce: Deithrian at the end of the day it's just a starter guide to get you through a basic site. you are going to need to supplement your knowledge quite a bit from those guides
[21:07:10] towski_: if the site was bigger, yeah it wouldn't run without redis
[21:07:16] Deithrian: weaksauce, in a Ruby tutorial someone would explain "attr_accessor" with "It creates getters and setters. It writes this code for you blabla" and you know what the line does. I never saw someone explaining "attr_accessor" with "It is similar to balloons, red, cucumber"
[21:07:31] tubbo: Deithrian: but yeah, we're here if you have any questions...to answer your initial question `resources` just defines RESTful routes for a given object, like a model. so `resources` means "RESTful Resource"`, and if you don't know what a RESTful resource is, you should just look that up.
[21:07:37] tubbo: because that's basic knowledge at this point
[21:07:44] bricker: towski_: *shrug* at least I don't have to deal with it :) (hopefully)
[21:08:31] tubbo: Deithrian: you mis-read the guide...it said "A resource is the term used for a collection of similar objects, such as articles, people or animals", it didn't say "a resource is an article/people/animals"
[21:08:40] tubbo: Deithrian: which means, at least to me, a "
[21:08:50] tubbo: a "resource" is just the route to an object's API
[21:09:56] tubbo: Deithrian: however, i do think you deserve a bit more explanation as to what `resources` actually does....so i invite you to, when going through the tutorial to actually make a `resources :objects` block and run `rake routes` to see the exact URLs generated from that line of code.
[21:10:04] Deithrian: Yes I know what it does because I googled "recourses Rails" and it took me to the routing recourse explanation which you say is incorrect, but correctly describes what the line of code did and what rake routes shows
[21:11:24] Deithrian: I may be wrong but I guess it will create routes for objects new, edit, update and so on
[21:11:30] tubbo: Deithrian: you got it
[21:11:42] tubbo: because 99% of the time those are the routes you want, and nothing more
[21:12:40] Deithrian: tubbo, well just like attr_accessor does for getters and setters for classes
[21:13:18] tubbo: Deithrian: yeah...sometimes you'll hear those class methods that are meant to be called in the class definition itself referred to as "macros"
[21:15:37] cleopatra: hello people
[21:25:54] pipework: Deithrian: The people who call those macros are wrong and need to be taught right.
[21:26:04] pipework: Because they aren't macros as traditionally understood.
[21:28:11] tubbo: they're not even close to macros
[21:28:43] Deithrian: I really don't care how something is called as long as I understand what it does.
[21:29:18] Deithrian: I don't care if it's a method or a function or apple juice, If it's explained what it doe.
[21:30:28] Deithrian: I'm complaining about the tutorial because instead of using 4 lines of explaining what that line of code does, they compare it to things that are not guaranteed that everyone knows about.
[21:30:49] Deithrian: Anyway, sorry for ranting for so long, I apologize.
[21:31:18] Deithrian: I'll take weaksauce advise and supplement my ignorance with google
[21:33:33] xar-: what's Deithrian's issue? lol
[21:33:51] xar-: ACTION doesn't feel like scrolling :D
[21:34:33] Deithrian: xar-, issue is resolved :)
[21:35:51] pipework: Deithrian: Whale, it's often best not to use terms incorrectly, that just confuses people with what they do.
[21:37:00] zorak8: hi, how do i know in what enviroment im working?
[21:37:19] pipework: Also, put your alcohol down and look around you.
[21:37:35] rhizome: I've experienced Deithrian's frustration as a self-taught and don't know underlying concepts
[21:38:26] zorak8: there is a may to check that from the console
[21:38:35] pipework: zorak8: So, my frienemesis. How do you like running into a spaceghost? (/whois pipework)
[21:38:46] zorak8: something like rails -v to check the version
[21:39:06] pipework: zorak8: What do you mean?
[21:39:27] pipework: When the process isn't running, there is no rails environment to be in.
[21:39:50] Deithrian: pipework, completely agree.
[21:39:56] zorak8: i was messing around with the enviroments and need to check that im in dev to feel safe
[21:40:14] pipework: zorak8: If your process isn't running, you aren't in an environment.
[21:40:21] pipework: zorak8: Are you trying to use rails console or something?
[21:40:42] pipework: You can pass RAILS_ENV=development into any commands that load rails if you want.
[21:40:45] zorak8: try to do rails.env in irb but dont work
[21:40:53] pipework: zorak8: irb isn't rails.
[21:41:07] zorak8: Rails.env works neither
[21:41:09] pipework: irb is ruby's REPL. Rails is a ruby library that has to be loaded into the ruby runtime.
[21:41:16] smathy: zorak8, run `rails console` the first line will tell you what it's running as.
[21:41:29] pipework: `rails runner "puts Rails.env"`
[21:41:35] zorak8: ok, perfect
[21:41:50] zorak8: something like this that was i want
[21:42:05] zorak8: >zorak8: So, my frienemesis. How do you like running into a spaceghost? (/whois pipework)
[21:42:30] pipework: zorak8: You know who Zorak is, right?
[21:42:40] smathy: zorak8, `rails s` also tells you which environment it's in when it starts.
[21:43:18] rien: what's an admittedly dirty way to make a basic auth username, that I receive in my application controller, globally available across the application? rails 4 here
[21:43:24] zorak8: the piano guy from the space ghost
[21:43:37] zorak8: there is where i get my nick
[21:43:46] rien: have you watched Cartoon Planet?
[21:43:57] rien: it's a funnier more surreal version of Space Coast coast to coast
[21:43:57] pipework: zorak8: And have you ran /whois pipework yet?
[21:44:36] zorak8: yes, there something from spaceghostc2c
[21:44:59] pipework: The math practically does itself.
[21:45:07] rien: space ghost C2c was interviews
[21:45:21] zorak8: but i dont get that of frienemies, i dont remember anyone called pipework in the show
[21:45:22] rien: cartoon planet is just the characters talking to each other, reading letters, singing songs
[21:46:23] pipework: zorak8: My username is spaceghostc2c. Zorak was an enemy of zorak in the original show, but are miaow not as enemy as the show.
[21:46:31] pipework: The talk show was an interesting thing.
[21:47:11] zorak8: i didn't remember about cartoon planet!!!!!
[21:48:14] zorak8: i though that both was spaceghost c2c
[21:48:27] pipework: Spaceghost is the original, coast-to-coast was the talkshow.
[21:48:39] tubbo: cartoon planet was like C2C except not as good also more Brak
[21:48:47] tubbo: brak was the shit fwiw
[21:49:25] zorak8: never see spaceghost dont think my parent has meet in that moment
[21:50:21] tubbo: the original show was boring as shit
[21:50:24] zorak8: and i have blur memories about c2c
[21:51:06] tubbo: C2C was actually the first show by the guys who would eventually go on to make Aqua Teen Hunger Force
[21:51:10] zorak8: have a torrent with all c2c but there are so many things to see/play and so few time to
[21:51:31] tubbo: in fact, Space Ghost C2C was the "beta" of ATHF's idea...which is to super-impose premade animation on top of premade sets
[21:51:44] Doddlin: c2c is also a great band!
[21:51:49] bashusr: can you mixin modules from other modules? ie. use include Other::Module from a module?
[21:52:02] ddd: pipework, you wouldn't know anything about SpaceGhostC2C now would you?
[21:52:27] tubbo: those shows were all audio, the entire cartoon was just stitched together from shit that TBS had lying around (which was all the Hanna Barbera stuff)
[21:52:40] tubbo: bashusr: sure
[21:53:49] rien: how do I make a variable global in rails 4 that I only get to have in application controller?
[21:54:02] zorak8: thanks for the help, gonna keep studing so i can finally land a job in rails development
[21:54:54] pipework: ddd: !pipework
[21:54:54] helpa: ddd: is a dick
[21:55:03] pipework: SpaceghostC2C: !pipework
[21:55:03] helpa: SpaceghostC2C: is a dick
[21:55:09] pipework: That's more like it.
[21:57:28] tubbo: rien: you don't, you make a method in ApplicationController and by the power of inheritance, as well as the beard of Zeus, that method shall be available everywhere in the view and controller layer.
[21:58:38] pipework: rien: Helpers
[22:02:59] rien: tubbo: I know the "official" answer. I'm looking for the dirty , unofficial answer
[22:03:40] Deithrian: Anyone using RubyMine?
[22:03:55] rien: pipework: helpers won't work for me
[22:04:01] tubbo: rien: !dw
[22:04:01] helpa: rien: 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.
[22:04:03] pipework: rien: They're modules!
[22:04:05] rien: pipework: I need some data available not just in controllers or views
[22:04:06] joelbrewer: is it possible to have two #index endpoints for the same resource? Here's what I want: 1) /locations (This endpoint would return all locations) 2) /users/:id/locations (This endpoint would return all locations belonging to the given user)
[22:04:22] bricker: rien: you want a global variable that's not global?
[22:04:24] pipework: rien: It's a module! Just use a module correctly!
[22:04:25] tubbo: rien: you can set a constant in an initializer...
[22:04:43] bricker: joelbrewer: sure
[22:04:46] tubbo: rien: but yeah, use a module correctly. you shouldn't put configuration in an initializer.
[22:04:48] pipework: bricker: globally scoped private to just one class global variable
[22:04:48] joelbrewer: Or perhaps there is a better way to achieve this? Not sure what the "preferred" method is
[22:04:49] rien: tubbo: I want a reference to a place in RAM that I can refer to from: 1. my initializers, 2. my application_controller, 3. my controllers, 4. my non-controller lib files
[22:05:05] pipework: rien: You're using the wrong language or wanting the wrong things.
[22:05:06] bricker: pipework: that statement made my hair fall our
[22:05:08] rien: not looking for design advice
[22:05:08] tubbo: rien: what do you need this for?
[22:05:22] tubbo: rien: like what is this data?
[22:05:30] pipework: Ruby is not a language you use if you want certain data in a certain place in memory.
[22:05:58] rien: ENV seems to do that
[22:06:02] rien: I just want a better ENV
[22:06:03] tubbo: he could want application-specific configuration :)
[22:06:08] rien: not tied to environment variables
[22:06:22] rien: what I want could be accomplished by stuffing ENV
[22:06:25] pipework: tubbo: It's a shame he refuses to divulge what he's doing.
[22:06:32] rien: so I just want a solution that is easy like ENV but not ENV stuffing
[22:06:48] pipework: But ENV is available everywhere.
[22:06:55] rien: that's what I want
[22:06:55] tubbo: rien: oh, well you're asking the wrong question. you should have asked "is there a way to have global configuration in my rails app"? the answer is "yes". you can either use Figaro to load from .env/yaml/in-memory, or you could build it yourself by just setting a constant in config/initializers/whatever.rb to the results of a YAML file, or wherever the source of your config comes from.
[22:06:58] bricker: lololololloloo
[22:07:07] bricker: rien: what does application controller have to do with it?
[22:07:11] pipework: I don't know if he's trolling us, him, or both.
[22:07:13] tubbo: rien: btw ENV is *supposed* to come from the actual UNIX environment
[22:07:31] tubbo: rien: so stuffing ENV with your own data is usually a bad idea (i know test_helper.rb does it that's not relevant though)
[22:07:34] rien: tubbo: the problem is even though this global can be constant, it can only be constant *after* application controller is done initializing, logging people in through basic auth, etc
[22:08:01] rien: bricker: that's where I get the username and password for basic auth
[22:08:06] pipework: So it's not constant, but it's constant?
[22:08:07] rien: that I need globally avialable
[22:08:18] tubbo: rien: ah, so you really want a field in a DB somewhere, that way it will be persisted in case the app crashes
[22:08:20] rien: pipework: it doesn't change after it's been assigned
[22:08:24] tubbo: or you need to scale out to multiple app servers/threads/whatever
[22:08:26] bricker: rien: use a database
[22:08:37] pipework: rien: I wish you'd explain the full thing you're trying to do.
[22:08:39] tubbo: rien: my advice would be to use Redis or Memcached, whatever you use to store your cache.
[22:08:41] rien: bricker: that's overkill. I'd stuff ENV before using a DB
[22:08:41] joelbrewer: bricker: do you think I should have two separate endpoints.. or should I pass a hash or something? Just trying to figure out what the standard way of doing this is.
[22:08:42] helpa: rien: http://mywiki.wooledge.org/XyProblem
[22:08:54] tubbo: rien: well what you're doing right now is stupid, it's going to break in the future.
[22:08:55] bricker: rien: as far as you are concerned, nothing in ruby is persisted, if you change some global config in a running process it will be thrown away
[22:08:58] rien: pipework: but then we'll go into tangets. I don't want alternatives.
[22:09:16] bricker: joelbrewer: separate endpoints for sure.
[22:09:29] pontiki: need some advice. i have a model, where part of the validation for it on create has a side effect of saving (vaulting) a credit card in a payment gateway. the effect is to validate the card and vaulting makes it useful for follow-on use.
[22:09:33] tubbo: rien: have you taken a look at any of the rails configuration gems out there on ruby-toolbox.com?
[22:09:33] pipework: rien: If you want to do something stupid, I'll leave you to it, but won't advise you on how to accomplish it. I wouldn't be able to stomach sleeping with myself, let alone tubbo's mom.
[22:09:43] tubbo: ^ i seen him
[22:09:50] pipework: pontiki: Use a transaction in a service object.
[22:09:50] pontiki: is that kosher to do in a model validation?
[22:10:08] pontiki: the actual vaulting happens in a service object
[22:10:09] pipework: That'd probably be nicer, since it sounds like a behaviour that might be separate from your user model itself.
[22:10:27] rien: clearly the RAM is shared by all methods called in rails. I just want a place ABOVE the methods and controllers. a place devoid of OO where I can put things.
[22:10:36] rien: like ENV
[22:10:42] pontiki: it's okay that the validation call out to the service object tho?
[22:10:42] pipework: rien: Go for it.
[22:10:43] rien: but not tied to the unix env vars
[22:10:46] rien: where is it?
[22:11:06] pipework: You have constants, globals, and bad ideas. Mix them all together into one nasty cocktail of future regret and hatred.
[22:11:20] pipework: Also, as long as you use ruby, forget thinking about where things are in memory.
[22:11:22] joelbrewer: bricker: gotcha. is there a standardized name for those methods? They both seem like "index" methods.. but obviously I can't have two index methods in the same controller
[22:11:22] rien: why is it a bad idea to have a constant-after-assignment globally available everywhere?
[22:11:27] tubbo: rien: fwiw when I say "DB" I really mean a key/value store in RAM, which is the same thing as saving a value in Ruby...it's just a different RAM
[22:11:29] rien: it's like an ENV VAR
[22:11:30] pontiki: live like the rest of us!
[22:11:35] rien: except I only know it after a request is done
[22:11:43] pipework: rien: Because you're not explaining what you want, and there are likely much better and cleaner ways of handling what you want.
[22:11:56] rien: pipework: I want to make my basic auth username globally available
[22:11:58] pipework: But without knowing, you'll probably cause yourself pain, especially with threading.
[22:12:02] rien: not just to controllers and views, globally
[22:12:10] rien: it's constant so it'll cause no problems
[22:12:31] pipework: rien: Then create an object that is assigned to the CURRENT_USER constant at the top level namespace. But mind that it'll not be threadsafe.
[22:13:01] pipework: You could have a CurrentUserLocator class that has the logic for storing and finding the current user per-thread or just fuck threads and holds it.
[22:13:12] rien: forget threads
[22:13:17] pipework: bad idea chum
[22:13:27] pipework: Then wherever you handle your authentication, set the value on that thing.
[22:13:31] pipework: Pretty simple stuff.
[22:13:45] Moeh: Hey, say I want to store a big json in a database field and afterwards easily access and update specific fields in the JSON, what would be the best practice to do that? I tried serializing it as a Hash however updating the values via a form is somewhat strange, I tried virtual attributes and ActiveRecord store yet nothing feels "right".
[22:14:09] joelbrewer: Moeh: postgresql has native support for json
[22:14:49] tubbo: rien: btw the reason we are kind-of steering you away from thinking about "a value in RAM" is because Ruby itself doesn't give a shit about your RAM. it could potentially garbage-collect that value eventually
[22:14:56] pipework: Moeh: If you don't want to query by those fields or have data integrity, just serialize to and from JSON.
[22:15:02] Moeh: joelbrewer: Okay, but how would I then update one specific field in the json? Would entity.field = new_value work?
[22:15:34] tubbo: rien: so to set a value in RAM and then just leave it there for, say, months...and not use it...might cause some problems because Ruby has dealloc'ed the memory and doesn't know your value anymore
[22:15:56] tubbo: rien: which is why i suggested using an in-RAM key/value store because you get the same read/write speeds but you don't have to worry about Ruby's GC
[22:16:04] rien: tubbo: yes I understand and listen I appreciate how much you folks here help the new guys but I'm an old-timer and the way I'm using rails is not kosher admittedly. however the whole team where I works likes the way I did it because we barely have to write tests (they get written automatically) and documentation (also automatic) because of the way I did things.
[22:16:18] pipework: But you could just wrap it all behind an interface.
[22:16:33] rien: tubbo: so I'm weary of "but what do you want to do" when I know folks will just try to give me an alternative.
[22:16:37] tubbo: rien: if you're an old-timer you should already know how to do this. :)
[22:16:47] pipework: rien: If tests get written automatically, they don't fail when the application isn't written correctly. At best they fail when someone changes things.
[22:16:50] rien: ruby might not care about RAM but it exists and the fact it doesn't let me manipulate it is asinine
[22:16:59] tubbo: rien: because if you really knew what you were doing you wouldn't be in here at all.
[22:17:00] rien: pipework: you don't know my application so best not to speak of it
[22:17:01] tubbo: no offense...
[22:17:02] pipework: rien: Not really. 3rd generation programming languages, bud!
[22:17:07] joelbrewer: Moeh: not entirely sure how updating json fields work. I would read through the postgres documentation.
[22:17:10] pipework: rien: I don't have to to understand testing. :)
[22:17:33] tubbo: rien: you'd just use a $global and call it a day :)
[22:17:38] pipework: Your tooling can, at best, provide a regression/change suite that can be generated. They can't validate you write the right code.
[22:17:40] rien: tubbo: what months, dude? I want a global that dies with the request
[22:17:56] pipework: rien: Then you want a request_local thread variable.
[22:17:58] rien: tubbo: I'm not a rails old-timer, I'm a lisper
[22:18:02] pipework: See that's info we need to know.
[22:18:30] pipework: rien: Look into request_store by steveklabnik.
[22:18:34] pipework: That's what you need.
[22:19:30] pipework: I'm glad the people you work with make it fairly enjoyable to do it your way.
[22:19:35] rien: I see that I should have said that ahead of time. I never thought my request would be interpreted as global to the memory-resident application. clearly rails is to serve requests. I want the username for the basic-auth'ed request available globally for the time the requet is alive. when the request dies, obvviously I don't need it anymore.
[22:19:36] pipework: I'd have a hell of a time with it.
[22:19:40] rien: pipework: thanks I'll check it out.
[22:19:54] pipework: rien: cheers.
[22:20:00] rien: pipework: they like it because there's less work for everyone
[22:20:04] rien: pipework: thanks again!
[22:21:38] epochwolf: rien: have you looked at thread local variables?
[22:21:47] pipework: epochwolf: He's already on it.
[22:21:51] tubbo: rien: i haven't been able to build an "automated test writer", and kinda stopped when i realized that most of the tests i typically write are pretty specific to the use case.
[22:22:03] epochwolf: Nevermind then. :)
[22:22:07] pipework: request_store handles thread locals and cleanup.
[22:22:14] tubbo: rien: how are you accomplishing this?
[22:22:20] rien: tubbo: my application is a request broker. I translate requests and pass them on. I can automatically write tests based on the request transformation specification
[22:22:38] rien: tubbo: requests come with json payloads, but all out of place. I organize it and pass it along
[22:22:52] pipework: But I'm 6000% sure that I might be able to get my company to pay me to make a request store that works when requests use multiple threads.
[22:22:55] pipework: Just timing.
[22:23:06] rien: pipework: I'd donate for that
[22:23:21] rien: anything that helps us be free of the OO stronghold lol
[22:23:23] pipework: rien: I think it's pretty ridiculous that we don't have that.
[22:23:30] rien: pipework: indeedy
[22:23:38] rien: that's the sort of stuff I expect from a framework
[22:23:50] rien: not helping me handle authentication
[22:23:53] rien: but to each his own
[22:24:10] tubbo: rien: ah, i see. i've had to deal with something like that as well. it was a rails app that parsed email messages (sent over http with sendgrid's parse api)
[22:24:34] pipework: rien: What authentication libraries/approach are you using? Middleware, before_filters, something before ruby?
[22:24:39] tubbo: rien: i had to combine some NLP with a shitload of regex to pick out what i wanted in each email...each lead provider had different syntax for the emails...some of them were in XML...it was a nightmare!
[22:25:07] rien: tubbo: hahaha, sounds similar though I don't have to do that much regexing
[22:25:11] rien: though I love regexing
[22:25:17] tubbo: rien: you should probably be using javascript if that's what you want out of a framework! ;)
[22:25:22] pipework: You're a sick person, you know that, rien? :D
[22:25:25] tubbo: </react-flux-troll>
[22:25:41] rien: pipework: nope, pretty barren in that regard. I only use basic_auth. my layer has no DB (so no models) and no views either
[22:25:51] pipework: The only way I can stomach regexen is with Ruby's Regexp.uinion
[22:26:00] rien: pipework: when I receive a request I need to authenticate with other services before I pass the transformed request along
[22:26:07] pipework: rien: But where do you do the basic auth handling?
[22:26:18] pipework: In rack, in rails somewhere, or elsewhere?
[22:26:25] pipework: Up in the webserver?
[22:26:29] rien: pipework: lol my coworkers tell me that. they say they've never seen a rails app that looks so much like a bunch of spreadsheets lol
[22:26:43] pipework: Life is a realtime spreadsheet game.
[22:26:54] rien: pipework: inside application_controller in a before_action called authenticate
[22:27:06] rien: I have to authenticate with 3scale among other proprietary services
[22:27:20] pipework: rien: Ah. See, cool people will actually just use a middleware that handles it, sets the current user in the rack env hash, and then you're done.
[22:27:39] pipework: Then you just need a way to get a handle of the current request in your system and you can have the user associated to it.
[22:27:54] pipework: It gets cleaned up automatically when the request instance is over.
[22:28:50] rien: I think I see what you're suggesting. I just have trouble picturing the order of events. when I get a request it comes with headers. middleware have access to headers, so ok. then I'd get the username and password from the header and stuff ENV from my middleware?
[22:29:02] pipework: rien: You can put the middleware inside rails middleware stack before your app or just ahead of rails entirely. There's even a nice rack library for http basic auth stuff, IIRC.
[22:29:17] rien: tubbo: javascript makes a schemer cry :)
[22:29:46] rien: pipework: yeah I get that but the var would be available where? in E?NV?
[22:30:17] pipework: rien: Yeah, the request comes in. In rack the whole request is represented in a ruby hash. You find what you need when they auth, set some hash key with the value you want to indicate the user, and you're done. Miaow, optionally you also make a reference to that hash available through an interface like I suggested before. It'll grab the hash and present the user out of it.
[22:30:26] pipework: rien: In the Rack env hash of the request.
[22:31:25] pipework: Requests through rack are represented as an 'env' which is a hash containing all the information about the current http request.
[22:31:36] pipework: It's not ENV, but an environment so to speak.
[22:32:05] rien: and how is that available globally in rails? what's the reference name? rack.env ?
[22:33:01] mikecmpbll: env["rack.session"] yo
[22:33:21] pipework: rien: That's where, in your auth middleware, you'd use Thread.current or RequestStore to store a reference to the hash by wrapping the hash reference in an object that just returns the user, unless you don't mind just returning the whole env hash.
[22:35:13] Radar: Good morning.
[22:35:45] rien: pipework: I see. well, thanks for the tip, I'll implement this on Monday because the day is over now :)
[22:35:59] pipework: rien: The idea is to let the rack env hash handle storage and cleanup, but have your middleware provide an object that can be accessed in the context of the request in a thread-friendly manner.
[22:37:15] rien: pipework: that makes sense and sounds clean enough. i like it. but if I can avoid middleware for now I will, so I hope request_store doesn't need it
[22:37:21] rien: if it does I'll pay the price as it's worth it
[22:37:58] pipework: rien: The benefit of middleware is that you pay the cost to use it and get to rails, but you can use it to avoid getting to rails if the conditions the middleware enforces aren't met.
[22:38:11] pipework: Like if auth fails, you don't need to get to rails and spend any more time.
[22:38:30] JosephAustin: Ugh, I don't understand why deploying a rails app to an existing host is so hard
[22:38:31] rien: pipework: hmmm that's a very good point I had overlooked.
[22:38:44] pipework: JosephAustin: It's super easy if you do it really badly.
[22:39:02] JosephAustin: i have these guys doing a startup and i did a little heroku test for a website but ive never done server stuff before. then they're like 'here's access to the server, put it there'
[22:39:14] rien: pipework: have a good weekend and thanks for the patience
[22:39:17] JosephAustin: i feel like im going to break the internet
[22:39:34] pipework: rien: Have yourself a merry little weekend.
[22:39:50] sivsushruth: JosephAustin just google for good blogs on setting up the server, follow it to the word. as time passes you will be able to do it on your own
[22:39:58] pipework: JosephAustin: Or just ask for help.
[22:40:04] pipework: From the people you're working with.
[22:40:25] JosephAustin: id like to know why hostgator's ruby is 1.8.7 and rails 2.3.18
[22:40:28] JosephAustin: that seems a bit rough
[22:40:31] pipework: JosephAustin: Oh god.
[22:40:37] pipework: run the fuck away.
[22:40:48] JosephAustin: "unfortunately at this time we dont support 3.0"
[22:41:04] pipework: JosephAustin: In that case, maybe free heroku is best.
[22:41:06] JosephAustin: also i cant seem to get root access.
[22:41:09] sivsushruth: hostgator is shit
[22:41:16] sivsushruth: your are fucked
[22:41:19] pipework: Don't even bother with hostgator.
[22:41:27] sivsushruth: JosephAustin try digitalocean
[22:41:32] pipework: They might actually literally employ satan.
[22:41:40] sivsushruth: it is fucking cheap and you have full control over the server
[22:41:42] JosephAustin: i even followed their 'get started on rails' guide and it gave me an error log
[22:41:52] pipework: JosephAustin: It's for a version of rails that no one supports for years.
[22:41:56] pipework: And ruby 1.8.7 is EOL
[22:42:09] pipework: They're essentially hosting rails from a time gone by.
[22:42:28] pipework: era more like
[22:42:28] JosephAustin: well im glad my annoyance is not without basis
[22:42:41] JosephAustin: thing is i dont own the host. these guys are doing a startup and kind of fumbling in the dark
[22:42:43] pipework: JosephAustin: What version of ruby and rails is your app?
[22:42:50] tubbo: JosephAustin: most likely because most rails developers have dissed hostgator and they hate us ;)
[22:42:51] JosephAustin: i was like 'hey ive been doing rails, it seems good'
[22:43:04] tubbo: THEY HATE US CUZ THEY AINT US
[22:43:05] pipework: Rails, it's what you do.
[22:43:10] JosephAustin: well i used their DEFAULT rails app they make on the fly
[22:43:14] JosephAustin: and it crashed so
[22:43:30] sivsushruth: JosephAustin no tech guy in the startup ? If no, you get the server and ask them to reimburse you
[22:43:33] JosephAustin: "Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112."
[22:44:03] sivsushruth: try digital ocean or heroku now
[22:44:03] JosephAustin: we'd have to migrate the emails and stuff but its doable
[22:44:07] JosephAustin: well see, i like heroku
[22:44:24] sivsushruth: http://weblog.rubyonrails.org/2015/2/20/Rails-4-2-1-rc1-and-4-1-10-rc1-have-been-released/
[22:44:54] pipework: JosephAustin: It's great if your project doesn't survive the month or you have money to pay for their expensive shared hosting system.
[22:45:40] JosephAustin: i thought it was free but scaled for you
[22:45:59] JosephAustin: though i noticed it scales quite fast
[22:46:00] pipework: It's got a free tier with one worker.
[22:46:19] JosephAustin: so, digital ocean hmm
[22:46:19] pipework: They will gladly scale it up and charge you for it though.
[22:47:32] mikecmpbll: ew heroku :p.
[22:48:05] JosephAustin: these guys might nix using rails if i tell them this, since they were already developing straight static things on the host
[22:48:13] JosephAustin: and i think they were using some php
[22:48:15] mikecmpbll: digital ocean isn't the only vps provider, too. i recently got a server with them cus you can't go 5 mins without hearing about them, but they aint all that imo.
[22:48:38] JosephAustin: plus they got emails all set up through hostgator
[22:48:40] sivsushruth: mikecmpbll true, but they are cheap and intuitive for beginners.
[22:48:47] pipework: JosephAustin: Yeah, if they are basing their business on what a host that they'll inevitably outgrow if they get remotely successful supports.... oh dear.
[22:48:48] mikecmpbll: slow upgrades, not even that cheap
[22:48:52] pipework: Maybe you ought to not play with them.
[22:49:03] sivsushruth: mikecmpbll any alternatives sir ?
[22:49:11] mikecmpbll: they offer a cheap bottom tier, but when you look at it the higher spec servers aren't cheaper than some alternatives
[22:49:22] pipework: JosephAustin: You can host an app somewhere else and leave email there.
[22:49:24] sivsushruth: mikecmpbll that is true
[22:49:31] JosephAustin: so the general feel here is hostgator is a POS
[22:50:19] blahwoop: if i make a route like get 'tag/:entity_name/:entity_id', to: 'tags#show'
[22:50:21] pipework: JosephAustin: Yeah. Use a host that you can grow with or use tools regardless of whether some host supports them. Find a VPS if you need. shared hosts are nice to start out ideas when you don't have all the skills.
[22:50:37] mikecmpbll: i've had vps here in the uk with memset for years and their prices are comparable to DO.
[22:50:38] blahwoop: can i pass in somethinglike localhost:3000/product/1
[22:50:51] sivsushruth: blahwoop please read up on routes
[22:50:58] pipework: blahwoop: Try it.
[22:51:02] helpa: http://guides.rubyonrails.org/routing.html
[22:51:06] blahwoop: it didn't work
[22:51:10] mikecmpbll: and they offer great personable customer service, fast upgrades with hardly any downtime.
[22:51:11] JosephAustin: You guys are very helpful, thanks.
[22:51:13] pipework: Then it didn't work.
[22:51:17] pipework: JosephAustin: Cheers.
[22:51:35] sivsushruth: blahwoop Yeah, so read why it did not work and how to make it work. Read the link that pipework sent thoroughly
[22:51:35] JosephAustin: I'll look at digital ocean
[22:51:57] pipework: sivsushruth: I'd suggest talking with them to pick technology first.
[22:51:57] sivsushruth: JosephAustin Good luck
[22:52:09] pipework: Err JosephAustin.
[22:53:13] JosephAustin: these guys are also going to be doing a web-based app platform so hostgator will probably ruin them
[22:55:08] bricker: real men use AppEngine *flexes biceps*
[22:55:34] mikecmpbll: i'm a real boy.
[22:56:20] pipework: bricker is quite the classy lady
[22:58:59] mikecmpbll: so what sort of speed up am i likely to achieve by switching to jruby for a CPU intensive threaded task
[22:59:08] JosephAustin: This startup has good ideas, several people involved, and a building donated to them, but sometimes they seem to be fumbling around. Also, no money yet, so I have limited amounts of personal exertion I can part with
[22:59:14] mikecmpbll: 8x if i have 8 cpu?
[22:59:22] pipework: mikecmpbll: Mmm, probably a lot of it's parallelizable.
[22:59:29] JosephAustin: its sort of 'web tech practice' for me right now until i see $
[22:59:49] mikecmpbll: pipework: 'tis.
[22:59:52] pipework: A whole building?
[22:59:57] JosephAustin: apparently yeah.
[23:00:09] sivsushruth: do they have a website ?
[23:00:10] JosephAustin: i havent seen it yet but we're supposed to check it out soon.
[23:00:20] pipework: mikecmpbll: I'd imagine there's a upper ceiling of possible speed increase, but I don't know what it is.
[23:00:22] JosephAustin: Just the static landing page http://fathomonline.org/
[23:00:46] JosephAustin: said building is apparently a fixer upper. needs an AC unit
[23:00:52] pipework: A whole building for a static landing page? Shit.
[23:01:09] JosephAustin: main dude works his butt off for connections
[23:01:26] pipework: What a bruv.
[23:01:33] sivsushruth: that is usually the case with founders
[23:01:36] pipework: better than a garage.
[23:01:57] JosephAustin: No matter what one might say about the guy, he lives and breaths his ideals
[23:02:34] JosephAustin: which is probably the personality of every spectacular success and every spectacular flop. I'd love to see the former.
[23:02:45] sivsushruth: are they paying you or are they going to give you some mythical "stake" ?
[23:03:08] JosephAustin: everyone in the company, including him, is doing this on donated time at the present.
[23:03:16] JosephAustin: which is why i said im only giving so much of myself to it
[23:03:49] rhizome: donated time, donated building...
[23:03:51] JosephAustin: he wants to get investments and a kickstarter, then get right to paying people
[23:04:04] rhizome: why no donated money? :)
[23:04:17] JosephAustin: well i mean... money has to come from somewhere xD
[23:04:29] JosephAustin: thats the plan :)
[23:04:37] pipework: Money doesn't manifest itself, don't you know.
[23:04:50] JosephAustin: i wish it did. but only for me.
[23:05:04] sivsushruth: JosephAustin Good luck, tough times ahead
[23:05:22] centrx: Are you talking about the global warming
[23:05:53] JosephAustin: there is some stuff in there about sustainable living, i think.
[23:06:04] rhizome: hey if the guy can manifest contributor time and a whole building, money shouldn't be too hard
[23:06:08] JosephAustin: he's targeting the hipster/millineal generation and the buzz words they like
[23:06:19] sivsushruth: rhizome not true
[23:06:30] JosephAustin: i mean as a demographic
[23:06:32] JosephAustin: not like a missile
[23:06:33] mikecmpbll: money schmoney.
[23:07:09] centrx: take out all the hipsters in one ironic explosion
[23:07:10] JosephAustin: the overview pdf is terrible, i told them right away to cut down on buzz words
[23:07:37] rhizome: i have a lot of thoughts on this apparently, so i'll just shut up so i don't look grumpy.
[23:07:43] JosephAustin: "aims of garnering youth empowerment via creative entrepreneurial solutions" god.
[23:07:49] blahwoop: ok got it to work
[23:08:12] JosephAustin: buzz words are fun
[23:08:33] JosephAustin: Im gonna make a user-focused interface to true turnkey solutions on the cloud
[23:08:59] sivsushruth: ^again buzzwords
[23:09:15] JosephAustin: ACTION knows
[23:09:51] JosephAustin: they basically want to do a sort of facebook that is partnered with schools towards credit-earning and entrepeneureal stuff. Which could be cool, and the schools like the idea.
[23:10:13] mikecmpbll: sounds incredible. lifechanging.
[23:10:56] JosephAustin: eh, who knows? Its my chance to learn a bit about web programming since i cant find a single application-oriented job in tennessee
[23:11:01] centrx: Our startup is partnering Snapchat with schools
[23:11:07] tubbo: > he's targeting the hipster/millineal generation and the buzz words they like
[23:11:20] tubbo: and fail.
[23:11:26] JosephAustin: you know, 'sustainable communities', 'healthy living', etc
[23:11:37] centrx: "green programming"
[23:11:38] JosephAustin: words that make them moan and clutch their fedoras
[23:11:51] sivsushruth: centrx how is it beneficial to the schools ? Your startup name ?
[23:11:58] pipework: JosephAustin: You know, I started in web development by doing it for fun.
[23:12:01] tubbo: that's such a shitty idea
[23:12:20] pipework: tubbo: I don't know, youth outreach is pretty useful.
[23:12:24] mikecmpbll: pipework: get out of here.
[23:12:25] sivsushruth: I started with making a website for my cousing
[23:12:28] JosephAustin: yeah well, im unemployed, so anything that -could- make me money
[23:12:30] pipework: It's kinda of like a drug.
[23:12:39] JosephAustin: until someone freaking hires me
[23:12:39] pipework: mikecmpbll: But then you might miss me, we wouldn't want that.
[23:12:51] tubbo: well there ya go, could be fun to see how you'd do something like that
[23:12:55] pipework: JosephAustin: Your best bet is to build open source stuff and publish it on github.
[23:13:08] JosephAustin: i got a real wakeup call, too. Went around, applied at a million places, and everyone ws like 'so, what databases have you worked with'
[23:13:08] centrx: sivsushruth, Schools want to keep track of what every student is doing. We are going to help them take Snapchats of everything that happens in the school. Analyze the data using buzz words and see what comes out the poop
[23:13:13] pipework: But if this thing excites you, go with it.
[23:13:18] JosephAustin: um... none? i made applications in c++ for windows and linux...?
[23:13:23] tubbo: JosephAustin: hah...yeah data matters mang
[23:13:32] JosephAustin: tubbo: learned that darned fast
[23:13:38] tubbo: they don't want to have to teach you SQL/relational databases
[23:13:42] tubbo: because it's a bitch
[23:13:50] pipework: Some day you won't even be able to get a date or a dinner reservation without some serious database knowledge.
[23:13:56] sivsushruth: centrx Right, but i am a bit confused though. Do you have a website ?
[23:13:59] JosephAustin: for every job around here that makes actual computer programs there are like a hundred database and web oriented ones
[23:14:14] pipework: I prefer inactual computer programs myself.
[23:14:15] mikecmpbll: sooner that day comes, the sooner i'll get a date.
[23:14:28] centrx: sivsushruth, it's a stealth startup, no website
[23:14:34] mikecmpbll: bring on the apocalyse.
[23:14:38] sivsushruth: centrx ah, cool. Good luck
[23:14:44] mikecmpbll: but spelt correctly.
[23:14:48] JosephAustin: im one of those losers that wants dearly to make video games :P
[23:14:56] JosephAustin: but, i will also go where money is
[23:15:02] tubbo: JosephAustin: move
[23:15:06] pipework: mikecmpbll: I hope there'll be a startup about stealth tech called 'stealth startup'
[23:15:07] tubbo: you're not going to make any video games in TN
[23:15:08] sivsushruth: however what i dont get is, how do stealth startups validate ideas. Do they just take a tiny sample ?
[23:15:24] tubbo: sivsushruth: they don't.
[23:15:26] tubbo: they hope for the bets.
[23:15:28] JosephAustin: that actually may not be true, a new company has opened here. however, that is a consideration... but a difficult one
[23:15:30] tubbo: like the "old days" :P
[23:15:42] pipework: Stealth startups are beliebers.
[23:15:53] sivsushruth: tubbo pretty risky
[23:15:54] JosephAustin: I will admit that moving out of tennessee has more benefits than that
[23:15:55] odigity: Does anyone here like to redirect after a form submission so that hitting refresh never results in a POST, which causes an annoying browser prompt?
[23:16:02] tubbo: JosephAustin: well what i mean is, if that's *really* what you want to do, there's a lot more opportunity on the west coast and in the southwest for game dev studios
[23:16:05] pipework: They sell a special brand of dog food that is only available at the company store, if you know what I mean.
[23:16:11] tubbo: there are a lot in colorado, arizona, and california...last i checked
[23:16:22] JosephAustin: tubbo: yes, i know. also better region to live in general
[23:16:24] pipework: A lot of them are about 'disrupting'.
[23:16:35] JosephAustin: at least if you're a city person like me
[23:16:43] pipework: In other words, having an idea that everyone else will pounce on two minutes after they release their idea.
[23:16:44] odigity: sivsushruth, when you redirect after a form submission, how do you report errors on the object (like failed validations) when you no longer have access to the model you attempted to create/update/destroy?
[23:16:55] tubbo: pipework: i'm about to "disrupt" your mom's rectum
[23:17:13] tubbo: JosephAustin: do you live in memphis?
[23:17:23] tubbo: ahhh even better
[23:17:31] JosephAustin: straightup downtown
[23:17:34] tubbo: i've never been but i hear it's great...especially if you like country
[23:17:35] sivsushruth: odigity usually flash messages
[23:17:48] sivsushruth: tubbo when coming to Goa ?
[23:17:51] JosephAustin: ... yeah, if you like country, its ... got country
[23:17:55] pipework: tubbo: My mom told me to tell you that if you lube up your leg next time, she might not point out how small your dick is.
[23:17:59] odigity: sivsushruth, that works, but you lose some precision, since the messages are no longer associated with a particular field
[23:18:09] JosephAustin: ACTION dies at pipework
[23:18:12] tubbo: sivsushruth: maybe when my startup gets bought by google
[23:18:21] tubbo: pipework: <3
[23:18:25] mikecmpbll: lol@startups.
[23:18:47] mikecmpbll: first time i've ever heard the term stealth startup
[23:18:50] sivsushruth: fellow rails irc member has started a tutorial, https://www.youtube.com/watch?v=h0wgey_-x8M&feature=youtu.be&a
[23:18:51] mikecmpbll: isn't that just ... a company?
[23:19:03] sivsushruth: mikecmpbll a startup no one knows about
[23:19:07] sivsushruth: they have no beta, alpha
[23:19:12] pipework: We need to disrupt the startup space with something completely different. A stopdown.
[23:19:13] mikecmpbll: yeah, just a normal company
[23:19:15] mikecmpbll: with a product
[23:19:16] sivsushruth: they have full scale production launch
[23:19:31] JosephAustin: There is a small uprising of games here, im trying to get on with a FUNDED startup games company, and we have a couple of indie communities. If all this falls apart ill have to consider moving eventually. though first ill need a job to like, bootstrap doing so.
[23:20:05] JosephAustin: Everyone should stop making data stuff and focus on games darn it. Moar gamesssss
[23:20:22] mikecmpbll: all this startup shit is so stupid. don't people have any endeavour anymore.
[23:20:25] tubbo: JosephAustin: nashville happens to be 1 of 2 places in america you can make money *just* composing original (not commissioned) music
[23:20:35] tubbo: the other place is los angeles
[23:20:41] JosephAustin: tubbo: thats true.
[23:20:47] sivsushruth: JosephAustin http://www.vvisions.com/ : my uncle's company (creator of guitar hero and skylanders etc..) let me know if i can put you in touch with him
[23:20:51] JosephAustin: too bad i like metal and jrock
[23:21:14] JosephAustin: woah, those are some big guys
[23:21:18] JosephAustin: success wise i mean
[23:21:28] sivsushruth: yes, activision bought them
[23:21:36] JosephAustin: ACTION flails
[23:21:49] bricker: I program for Disney Infinity and I'm a composer in Los Angeles, this conversation is highly relevant to my life
[23:22:00] bricker: ACTION has nothing else to say
[23:22:07] JosephAustin: darn you, you being-able-to-make-games people
[23:22:30] centrx: Tic-Tac-Bro
[23:22:30] sivsushruth: try https://www.kongregate.com
[23:22:36] centrx: take it, take that idea and run with it
[23:22:48] sivsushruth: you can make own games and post them there. You get a share of ad money
[23:23:02] JosephAustin: hmm not a bad idea. i thought about that
[23:23:30] JosephAustin: there's actually a dude right here in nashville who makes his living making mobile games. I dont even know what games he's made
[23:23:40] pipework: bricker: Do you get any cool disney lewt?
[23:23:51] JosephAustin: but he's super indie, like, he doesn't believe in big companies and treats it politically
[23:24:18] mikecmpbll: tonight is hilarious in here. you guys are outdoing yourselves.
[23:24:29] JosephAustin: we had a producer come to our indie meetups and he stopped coming because she's an infiltrator
[23:24:30] bricker: pipework: constantly
[23:24:37] pipework: bricker: Neat.
[23:24:51] JosephAustin: but i guess you can make money just making quick phone apps
[23:24:59] sivsushruth: mikecmpbll I thought you were a core guy. I remember a lot of PRs
[23:25:07] sivsushruth: some other mike ?
[23:25:37] mikecmpbll: i'm core, but not rails core.
[23:26:10] mikecmpbll: i make a pr on rails every now and then just to give them something to do, they get lonely.
[23:26:32] bricker: yeah they don't have enough issues/PRs to go through
[23:27:38] sivsushruth: ACTION is eager to see what project ideas rails has for this gsoc
[23:27:43] Scriptonaut: anyone here who uses heroku use process scheduler? If so how long after you make changes in the scheduler does it take to apply?
[23:28:06] Scriptonaut: I upped the dynos to 15 in the scheduler, wondering how long it will take for the main heroku app page to reflect that
[23:28:55] JosephAustin: Welp I gotta go everyone. Thanks for the tips and amusement
[23:29:25] mikecmpbll: oh, not dragons den.
[23:30:08] vasilakisFiL: hey.. I am building an API with rails.. is there any advantage of having the authentication method inside a warden middleware instead of the API's base controller ?
[23:30:18] vasilakisFiL: I am using devise
[23:31:11] ddd: iirc, the middlwware is loaded before the controller(s) so your authentication mechanisms will be available sooner, letting you wrap your controllers early
[23:32:08] xibalba: vasilakisfil, have you looked at grape?
[23:32:25] vasilakisFiL: xibalba yes but I don't understand why so much hipe with grape
[23:32:53] vasilakisFiL: I like the OPTIONS/HEAD methods out of the box but apart from that I am fine with rails
[23:33:00] pipework: xibalba: What does grape have to do with it?
[23:33:22] pipework: vasilakisfil: A middleware lets you handle auth earlier than rails and end the request quicker before reaching rails if you want.
[23:33:39] pipework: The down side to it is that you need to go through that middleware each time you make a request, even if it does nothing.
[23:34:47] ddd: which in itself isn't bad, other than the slight delay (nano to miliseconds) before the request if forwarded through the auth layer.
[23:34:56] ddd: err is forwarded
[23:36:23] ddd: now if the authentication layer breaks for whatever reason, rails itself of course will never be reached so you need to pay close attention to where, and what, breaks. may be stating the obvious but sometimes the obvious gets missed in the mental concept
[23:38:18] vasilakisFiL: hmm I think I will keep it in the api's base controller for now.. thanks guys!
[23:56:56] luckyruby: Is there a way to not have Rails logger output I, [2015-02-20T18:48:40.349115 #7784] INFO -- : ?
[23:58:36] pipework: luckyruby: Change the logger.
[23:58:37] pipework: Rails.logger