« Back to channel list

#RubyOnRails - 03 April 2015

« Back 1 day Forward 1 day »
[00:12:16] Scriptonaut: does anyone know how I can submit a remote get request to one of my actions with jquery (or vanilla JS)? I thought I had it figured out, and was gonna use $.get, but then I remembered that $.get wants a callback and to handle it itself. I'd rather just render some js from my action and have that take care of it. I could wrap my little thing (it's a single checkbox) in a form and force it to submit with JS, but I a
[00:18:40] aguynamedben: I have a little admin menu in the middle of a bunch of content I want to cache with fragment caching... is there a way to exclude a pieces of HTML from the cache and have Rails populate it dynamically... so cache the HTML around a small dynamic div, and have ERB know to still render the little div, but pull from the cache instead of rending the surrounding content?
[00:22:23] bricker: Scriptonaut: use "script" dataType, the response will be evalulated as javascript
[00:22:52] w0bni: for some reason I have to reload the page in order to get certain css styles working (specifically, the chosen-rails gem) - any ideas as to what could cause this?
[00:24:08] w0bni: hmm - it seems the issue only occurs when I visit the page through a link
[00:24:41] Scriptonaut: thanks bricker
[00:25:15] w0bni: is this turbolinks pranking me again..
[00:35:12] capin: i'm gonna put this http://stackoverflow.com/questions/29419389 here
[00:38:10] silverdust: I have a view being fetched with ajax on another view. Is there a way to make a layout false for it when fetched from another page and leave it with layout when accessed directly
[00:38:59] silverdust: Because with layouts set, my JS loads twice. also my CSS but JS is more concern as it raises errors
[00:47:26] whatasunnyday: Heya, I have a user that has many cards and has many transactions. The transaction belongs to a user and a card. The card belongs to a user and has many transactions. Is there anything built into Rails that will automatically validate that the card belongs to a user when creating a new transaction? Whew, that was a mouthful. Hopefully it was clear.
[00:56:54] _blizzy_: so, I'm trying to use react-rails. I have put my js.jsx file in app/assets/javascripts/components, but it is still not rendering to the components.js file.
[00:58:39] _blizzy_: eh nvm I'll use angular.
[01:00:43] fryguy: whatasunnyday: you'll probably be best off writing a private method in the transaction model, and then calling validate :private_method_name to do it. I'm not sure of a way to do what you want using built-in rails validations
[01:01:35] woop: is there a way to tell rspec that you *don't* want it to set up db fixtures?
[01:01:58] woop: I've got a test that doesn't even touch the DB that's failing because rspec is setting up fixtures for every single db connection defined
[01:03:59] ackpacket: I have Users and Courses, and I'd like to keep track of a user's roles in certain courses (teacher in one class, student in another) through an Enrollments table. Does this sound proper?
[01:04:36] fryguy: ackpacket: seems reasonable
[01:05:08] ackpacket: fryguy: If that's the case, do I need an Enrollments model? Or is a table enough for that bookkeeping
[01:05:36] fryguy: ackpacket: you'll need an Enrollments model
[01:05:44] fryguy: you'll also want to do has_many :through instead of habtm
[01:06:02] ackpacket: fryguy: Sounds good, ty
[01:23:33] whatasunnyday: fryguy, thanks. pretty easy, just wanted to keep it dry :)
[01:25:47] kiki_lamb: is there non-hideous way of accessing view helper methods from JS?
[01:31:42] Radar: kiki_lamb: Time to rewrite all your views in JS
[01:32:30] rhizome: to be sure, it depends what you mean by "non-hideous" "accessing" "methods" and "from JS"
[01:36:54] kiki_lamb: rhizome: yeh, that still sounds closer to a 'no'.
[01:37:11] kiki_lamb: k, if there's no pretty way i guess i'll figure out an ugly way
[01:37:28] fryguy: the code is running on 2 different machines...
[01:39:16] woop: this sounds like the X-Y problem
[01:39:24] woop: you're trying to solve X by sharing view helper methods
[01:39:36] woop: where Y is "How do I share view helper methods to JS?"
[01:39:43] woop: what's X?
[01:40:51] rhizome: presumably the helpers are already written, though
[01:42:01] woop: but why would you ever want to call them from JS?
[01:42:07] woop: just pass the helped data to JS
[01:43:07] woop: mostly kiki_lamb
[01:58:14] nahtnam: Anyone know a dockerfile I can use for hosting my rails app?
[01:58:47] fryguy: nahtnam: https://robots.thoughtbot.com/rails-on-docker
[01:59:11] nahtnam: fryguy: Thanks, ill check it out
[01:59:44] fryguy: nahtnam: https://registry.hub.docker.com/_/rails/
[02:26:33] Anthony2015: Hello, I have what is probably a pretty noobish question
[02:26:38] Anthony2015: is this the forum for that?
[02:27:21] Anthony2015: I think I want an explanation for why stuff is going wrong as opposed to just an answer
[02:27:24] sevenseacat: if its to do with rails, sure :)
[02:28:01] Anthony2015: I'm getting the No route matches [POST] "/model/new" error on my rails app
[02:28:31] Anthony2015: from what I can see, I have route that matches that, but it's a [GET] verb
[02:28:42] sevenseacat: and what code do you have for your form that is generating that error
[02:28:57] sevenseacat: right, GET /model/new is the URL that renders the form to create a new model object
[02:29:27] Anthony2015: is there a good way to post the form code?
[02:29:37] Anthony2015: or just copy/paste?
[02:29:58] sevenseacat: rails has a concept called restful routing, which defines a bunch of default URLs and routes, seen here - http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
[02:30:11] sevenseacat: if you copy and paste the code into a gist (http://gist.github.com) that would be great
[02:30:20] sevenseacat: (and paste the URL here afterwards)
[02:32:31] Anthony2015: https://gist.github.com/063be0ba0d7a58c544be.git
[02:32:43] Anthony2015: also checking out resful routing
[02:33:08] sevenseacat: interesting, typically you would have something like `form_for @monster`, specifying the object that the form is actually for
[02:33:36] woop: weird... that's totally blank to me
[02:33:52] sevenseacat: woop: remove the .git from the url :)
[02:34:03] Anthony2015: I was following this tutorial http://guides.rubyonrails.org/getting_started.html
[02:34:15] Anthony2015: it uses the symbol syntax
[02:34:56] sevenseacat: it does, but then it also specifies the url further down the page in section 5.2
[02:35:03] sevenseacat: because it's bypassing rails' defaults for some reason
[02:35:42] sevenseacat: they have to specify the URL, because doing `form_for :article` isnt how we would typically do it
[02:35:57] Anthony2015: let me switch over to @syntax and see if the magic works
[02:36:44] sevenseacat: it should - rails will then inspect the @monster variable to determine what it should use for the destination url
[02:37:04] sevenseacat: if @monster is a new record, it will know to submit to the URL for the create action, and if its an existing record, it will know to submit to the URL for the update action
[02:37:15] Anthony2015: yep, totally worked
[02:37:28] sevenseacat: it'll use the right HTTP verbs and everything
[02:37:58] sevenseacat: thats what we like to hear :)
[02:38:08] Anthony2015: that's great. It's so hard to figure out what Rails does automagically and what you have to specify
[02:38:22] sevenseacat: true, and when the tutorials are a bit bodgy it doesnt help
[02:38:36] Anthony2015: well thank you guys so much
[02:38:54] sevenseacat: we're not all guys here :)
[02:39:11] Anthony2015: well thank you gender unspecified persons so much***
[02:40:18] Anthony2015: in case you're curious (I know I am after looking at code samples sometimes) I'm working on a random encounter generator for my D&D group based on terrain and how difficult the monster is
[02:40:31] Anthony2015: thank you for helping me over that hurdle
[02:41:32] Anthony2015: any way to silence the join/leave messages?
[02:41:55] sevenseacat: your irc client should have a setting for it somewhere - what client are you using?
[02:42:32] Anthony2015: I'm currently using webchat.freenode.net
[02:42:49] sevenseacat: hmmm... dunno if you can do it there
[02:43:05] Anthony2015: it's alright, I'll get more sophisticated
[02:43:57] sevenseacat: yep, top left corner, click the IRC drop down, options, hide joins/parts/quits
[02:44:44] Anthony2015: oh phew, what a relief
[02:45:13] silverdust: I have a view being fetched with ajax on another view. Is there a way to make a layout false for it when fetched from another page and leave it with layout when accessed directly
[02:46:21] fryguy: silverdust: check out request.xhr? which will be true for ajax calls and false for normal calls
[02:48:41] silverdust: fryguy: Is that JS or Rails?
[02:51:16] woop: silverdust: add ".json" to the end of the path and check for type
[02:51:25] woop: don't you dare use request.xhr? to change the behavior
[02:51:34] woop: or add more params
[02:51:46] woop: anything but request.xhr?
[02:52:09] sevenseacat: woop: so you're advocating using .json to determine what HTML to render?
[02:52:24] sevenseacat: this doesnt seem like a better approach
[02:52:24] woop: oh, that?
[02:52:32] woop: then in that case, use a different path altogehter
[02:52:39] silverdust: I was just gonna do `unless request.xhr? load some assets `
[02:52:42] woop: different view html = different path
[02:53:24] woop: I was just assuming json because it's an ajax call
[02:54:05] silverdust: or better still I'll do `if request.xhr layout false` in controller
[02:55:07] fryguy: woop: what is the main differene between differentiating an action based on the presence of a header versus the presence of a resource suffix?
[02:57:04] woop: the former is *way* more obnoxious to parse out
[02:57:13] woop: it looks the same in the logs, for one
[02:57:40] fryguy: what things besides uri are allowed to alter a request?
[02:57:47] silverdust: fryguy which do you think is a better option? The latter doesn't seem to be working fine. I'll be using the former in the view and I believe it'll do it
[03:01:21] woop: everything is allowed to alter a request, but the uri should identify the resource you want, no?
[03:02:26] ackpacket: I'm setting up an Enrollment table to keep track of users participating in courses. I am including a column to also track their roles. So, an entry of (100, 232, student) would mean that user with id:100 is a student in the course with id:232. I wanted to know... what's the best way to keep track of data that should only have a few values?
[03:02:31] fryguy: woop: sure, but the representation of that resource might differ based on other parameters, or might not be represented at all.
[03:02:50] ackpacket: i.e. how can I make sure the "role" column in my Enrollments table is only ever Student or Teacher
[03:03:04] sevenseacat: ackpacket: I'd use an enum in the model
[03:03:15] woop: seems like it'd be reasonable to just make it an explicit parameter to change the actual response instead of just implicit stuff
[03:03:18] sevenseacat: and validate it
[03:03:27] fryguy: woop: there are plenty of mechanisms for altering the resource based on things that aren't the uri, checking headers is one of those
[03:03:30] woop: like... if not a different uri, at least a param to indicate this that is explicit
[03:03:36] ackpacket: sevenseacat: I've used enum in other languages before, but is that easy to apply to a model? Should I use validation instead? Or would the enum be a *part* of the model
[03:03:41] ackpacket: i mean part of the validation
[03:03:44] fryguy: woop: the header isn't implicit, it's sent as part of the body of the request
[03:03:53] woop: but the header that says it's an xhr request?
[03:04:04] sevenseacat: ackpacket: http://api.rubyonrails.org/classes/ActiveRecord/Enum.html
[03:04:16] woop: that sounds like implicit magic that just causes pain in the end
[03:04:28] woop: you're not telling the javascript to throw the header in
[03:04:56] fryguy: you aren't telling your browser to throw cookies in either, but they end up in the request
[03:05:33] fryguy: you aren't telling your browser to convert http basic auth to headers as appropriate, but it does that too. similar rules for client-side certificates (although those aren't used by anybody)
[03:06:26] fryguy: understanding the protocols/standards for the tools you use is just as important as understanding HTTP/1.1 as the underlying protocol that you are using
[03:07:18] woop: fryguy: except that someone had to explicitly throw the cookies in
[03:07:48] woop: I guess implicity behaviro is the Rails Way
[03:07:56] fryguy: woop: somebody had to explicitly throw the code that makes the ajax request in too
[03:08:58] woop: not gonna convince me that it doesn't reek
[03:14:23] fryguy: basically every language I just checked, including haskell snap lol, mentions or advocates for checking for ajax requests by inspecting this header. It's silly to not be pragmatic about this.
[03:16:52] ackpacket: If I want a field in my model to have the enum type, what should I specify on the command line? I can see how to make the change in the model's class but, when generating the model should I use the actual datatype each of the enum values could be?
[03:18:14] fryguy: i never worry about generating the model correctly from the command line, just make sure the file contents is what you want it to be, and edit the file if necessary.
[03:18:47] ackpacket: fryguy: I'd prefer that as well, but I'm trying to be cautious since the generate is also setting up the DB for me
[03:19:42] ackpacket: I'm trying to do: rails g model Enrollment user:references course:references role:???? <-- I don't know what to put for role, but I know it can only have 2 or 3 values
[03:20:05] ackpacket: as suggested earlier, I'll edit the model class so that role is enum of :student, :teacher
[03:20:19] ackpacket: but I'm just confused what the DB will look like afterward
[03:20:49] sevenseacat: ackpacket: enums in rails map to integer fields in the db
[03:21:00] ackpacket: ah. So in the generation I should do role:integer
[03:21:13] sevenseacat: so you should have role:integer and then define the mapping between symbols like :string and an integer value, in your model
[03:21:27] ackpacket: K. Crystal clear. Thanks!
[03:24:40] ackpacket: Anyone ever come across an instance where generating a new model creates some factory girl code with errors in it?
[03:30:27] ackpacket: One of my fields was named end
[03:32:23] ackpacket: I'd likt to have the fields start:date and end:date in my model, but since that's causing errors I have to rename them. My question is, is there a convention for naming something like that? Seems like trivial question I know, but I'm really trying to build a good foundation
[03:36:22] sevenseacat: i'd use either start_date or start_at
[03:36:42] ackpacket: I settled on startdate and enddate, since someone is going to be calling these as methods
[03:36:51] ackpacket: I also find special chars slow me down :D
[05:33:41] floopie: Hi, I'm a total noob and I'm running into some trouble with setting up a mailer on Michael Hartl's Rails tutorial. Would someone maybe be able to knock some sense into me over PM? :)
[05:37:39] vedu: floopie: no love. only code!
[05:37:43] floopie: maybe everyone's asleep.
[05:37:57] floopie: trying to code! but extremely stuck.
[05:38:22] vedu: code! | floopie
[05:38:24] rhizome: ask in channel
[05:39:24] vedu: rhizome: what are the commands in the channel? like code! and ask!
[05:39:29] floopie: Basically, I'm on chapter 10 of Michael Hart's tutorial (working on cloud9) where he creates a mailer for account activation and password reset.
[05:39:44] rhizome: dunno, but ! comes first
[05:39:59] vedu: !ask | floopie
[05:40:16] rhizome: you have to have rights on the bot
[05:40:17] frankson: nooooo! hellpaaaa!
[05:40:33] floopie: When I run " rails generate mailer UserMailer account_activation password_reset "
[05:40:35] vedu: rhizome: oh that explains a lot :D
[05:40:49] frankson: thats not very helpaful is it
[05:40:54] vedu: floopie: use gist.github.com to paste your code and your error
[05:40:59] floopie: according to the tutorial, it's supposed to generate a file "app/mailers/application_mailer.rb"
[05:41:05] floopie: but it's not being generated.
[05:41:12] floopie: oh, okay. Sorry, I'm totally new at this. Will do that.
[05:41:34] rhizome: if you're generating UserMailer, it'll at least be user_mailer.rb
[05:42:04] floopie: yes, that file exists. but the tutorial refers to this totally other file that wasn't generated
[05:42:15] frankson: you can probably just make it
[05:42:27] rhizome: what other file?
[05:42:31] vedu: floopie: link to the toutorial?
[05:42:49] floopie: https://gist.github.com/Haseeb-Qureshi/58611bdeb688e210d0e7 <== this is what it says is supposed to be there
[05:43:13] floopie: https://www.railstutorial.org/book/account_activation_password_reset
[05:43:40] floopie: this is at Listing 10.1.2 on the tutorial
[05:43:49] rhizome: "At present..." god there is some bad writing in the rails world
[05:44:37] floopie: I take what I can get at this point :P
[05:45:02] rhizome: oh sure, i get it. i'm just grumpy because i learned 50% of what i know from man pages
[05:45:26] vedu: floopie: this isn't really my thing. reading from books.
[05:45:39] vedu: I tried. But I can't understand it
[05:45:44] floopie: I've been teaching myself Ruby that way and it's working out pretty well, but Rails feels like a whole nother beast
[05:45:44] sevenseacat: rhizome: good this rails 4 in action isnt written badly!
[05:45:50] frankson: floopie: i dont think the generator generates that file, but you can make it manually and it'll work the same
[05:45:55] vedu: Do railscasts, official guides, and googling
[05:46:03] rhizome: sevenseacat: muphry's law
[05:46:35] frankson: floopie: actually, you should see what the UserMailer that was generated is inheriting from if anything
[05:46:42] frankson: and generate that for your defaults
[05:46:54] frankson: er manually create* if it doesnt already exist
[05:46:54] rhizome: frankson: yeah but the implication is that all of that is autogenerated. never seen that before.
[05:47:14] frankson: i've never seen a rails generate create the base class though
[05:47:21] floopie: UserMailer inherits from ActionMailer::Base
[05:47:37] frankson: so actionmailer base already exists in rails
[05:47:41] rhizome: "Let???s take a look at the generated mailers"
[05:47:41] floopie: i just created the application_mailer.rb manually and filled it with the stuff he has
[05:48:04] sevenseacat: you're likely using a different version of rails than the book is
[05:48:05] frankson: yea now just make your usermailer inherit from applicationmailer instead of actionmailer base
[05:48:09] floopie: yeah, i've followed the tutorial without fail through ten chapters. and this is the first time a file has not existed when he said it should.
[05:48:38] rhizome: floopy: does the generated user_mailer have < ApplicationMailer or ActionMailer?
[05:48:41] sevenseacat: what version of rails are you using?
[05:48:47] floopie: so 'class UserMailer < ApplicationMailer::Base?
[05:48:57] frankson: nah just ApplicationMailer
[05:49:00] floopie: gem 'rails', '4.1.6'
[05:49:20] sevenseacat: yeah an older version. the book is for 4.2.
[05:49:20] frankson: and your ApplicationMailer should inherit from ActionMailer::Base, so your UserMailer does too
[05:49:25] rhizome: rails 4.2 does not create ApplicationMailer
[05:49:34] sevenseacat: i just did it.
[05:49:46] floopie: i believe actually the book explicitly tells you which versions of rails and gems to use
[05:49:53] floopie: and i've been following that.
[05:49:53] sevenseacat: https://gist.github.com/sevenseacat/f58a12a47ab3fc709978
[05:50:12] floopie: but maybe I messed up somewhere.
[05:50:26] sevenseacat: rails -v => 4.2.1
[05:51:07] floopie: is the problem maybe the rails version? i presume if i change the rails version now it'll break everything.
[05:51:10] sevenseacat: floopie: the book uses 4.2
[05:51:16] sevenseacat: https://www.railstutorial.org/book/static_pages#sec-sample_app_setup
[05:51:18] rhizome: huh, must be a 4.2 change. i thought i was using 4.2 but it's 4.18
[05:52:14] floopie: should i change the gemfile? or just go with it and improvise?
[05:52:48] rhizome: yeah, it's a 4.2 thing
[05:53:07] floopie: ok, so changing the gemfile at this point in an app is safe-ish?
[05:53:13] rhizome: p.s. your terminal is doubling lines sevenseacat
[05:53:14] floopie: i don't have much intuition for this yet
[05:53:17] sevenseacat: floopie: probably not.
[05:53:24] sevenseacat: rhizome: no its not.
[05:53:38] floopie: oh. i'll just go with it then.
[05:55:25] rhizome: mysteries solved
[05:59:02] shortCircuit__: why would I use this gem https://github.com/guilleiguaran/fakeredis ?
[06:00:14] shortCircuit__: I mean it provides no cleaning strategy, uses my development database, (that's still ok, because I can create another table, but shouldn't it have stubbed them ) ?
[06:00:26] sevenseacat: to stub out redis?
[06:01:47] shortCircuit__: no I mean the methods that redis gem provides. because it providing no cleaning after my tests are run, it should I mean, I don't know, how does these things usually work?
[06:02:33] shortCircuit__: I have already written a class to abstract out the four methods I need, I see no point in using this, plus there isn't any docs
[06:07:57] sevenseacat: so dont use it?
[06:10:15] browndawg: Hey, does anyone know how I can display error messages in the devise log in form? devise_error_messages! doesn't display anything, even when I submit a blank form, and resource.errors.size is 0.
[06:12:00] browndawg: https://pastee.org/ffq9h this is the view
[06:15:39] browndawg: The only thing I can seem to do is to display flash[:alert] or alert.
[06:44:23] anti-freeze: Hi everyone. So this is a strange one. I'm using the default rubymine debugger and I get an exception when debugging an instance method from the debugger. undefined local variable or method `local_variables' Any ideas?
[06:51:09] anti-freeze: Oh right, I got it. The problem is that I'm a moron
[06:51:33] anti-freeze: Thanks everyone
[06:55:34] ackpacket: I may have been taught this the wrong way but, what's the *current* way of finding a record given the value of one of it's variables?
[06:55:37] ackpacket: is it with where?
[06:59:09] rhizome: variables?
[07:00:25] ackpacket: person.where(age: 20) vs person.find_by_age(20)
[07:00:50] rhizome: current is Person.find_by(age: 20)
[07:01:11] rhizome: where is also fine
[07:01:54] sevenseacat: where will always return you a relation
[07:02:04] sevenseacat: find_by will always return you the first instance
[07:04:25] ackpacket: Sorry, what do you mean by returning a relation?
[07:06:10] sevenseacat: it will return you an enumerable list, that may contain zero, one, or more elements
[07:06:31] sevenseacat: so it really depends on what you need to do
[07:08:09] ackpacket: sevenseacat: Trying to unenroll someone from a course. Doing so via Enrollment.where(user_id: person.id, course_id: self.id).delete
[07:08:53] ackpacket: sevenseacat: Trying to unenroll someone from a course. Doing so via Enrollment.where(user_id: person.id, course_id: self.id).delete
[07:09:03] sevenseacat: that wont work
[07:09:27] sevenseacat: or maybe it will
[07:09:31] sevenseacat: ACTION checks
[07:09:41] sevenseacat: are you expecting more than one record?
[07:09:49] ackpacket: shouldn't be
[07:10:33] sevenseacat: should you raise an error if you get zero or one result?
[07:10:36] sevenseacat: *more than one
[07:10:59] ackpacket: Well now that I think about it
[07:11:11] ackpacket: I suppose it's possible for a teacher to double-add a student
[07:11:18] ackpacket: and if that's the case, they probably only want to delete one record
[07:11:31] ackpacket: so I think find_by(user_id:.........).delete is the way to go
[07:12:04] sevenseacat: make sure to handle nil cases then
[07:12:22] ackpacket: I don't see a reason to
[07:12:49] sevenseacat: so you want your user to get a 500 error if Enrollment.where() returns nil?
[07:13:05] ackpacket: I would be using find_by
[07:13:15] sevenseacat: which returns nil if no matching record exists
[07:13:17] sevenseacat: as i said earlier
[07:13:28] ackpacket: Oh I see... delete would throw a no method error
[07:13:40] sevenseacat: nil does not respond to the delete method.
[07:13:41] ackpacket: I was thinking find_by would just silently return nil and that's ok by me
[07:13:48] ackpacket: but yes you're right
[07:14:16] ackpacket: I guess the only way there would be nil result is in some concurrency issue
[07:14:34] ackpacket: or they could have an old window open with the studentlist still including the deleted student XD
[07:14:49] sevenseacat: you laugh, but its very possible
[07:15:06] ackpacket: Oh I believe
[07:16:38] ackpacket: Anyone alive right now, I'm wondering what you would identify as the two most influential events/sources in learning ruby. Something that took you from "I know ruby" to "I know ruby really well, and write good code"
[07:16:48] ackpacket: s/ruby/rails
[07:18:23] sevenseacat: we've just been talking, why ask if people are alive?
[07:18:33] sevenseacat: IS THIS THE AFTERLIFE?
[07:19:02] ackpacket: Sure. IRC heaven
[07:19:10] sevenseacat: ACTION sobs quietly
[07:19:15] ackpacket: I am jack's, complete lack of suprise
[07:48:00] thebatu1_: hey all, I am getting undefined local method error when trying to access a model method from my view. not sure how to fix it. https://gist.github.com/thebatu/bc1067e3e077fbfe6b49
[07:50:17] rvanlieshout: thebatu1_: operation isn't defined
[07:50:31] rvanlieshout: you've got a @operation defined though
[07:51:14] thebatu1_: @operation is in the controller
[07:51:29] thebatu1_: I am trying to access the model though
[07:51:55] rvanlieshout: i understand what you're trying to do, but you're trying that on something that isn't defined
[07:52:06] thebatu1_: app/models/operation.rb
[07:52:20] sevenseacat: thebatu1_: what is defined in that file?
[07:52:30] sevenseacat: its not operation
[07:55:05] thebatu1_: rvanlieshout: yes it is not defined. I thought _show.html can access /model/operation.
[07:55:17] sevenseacat: it can. if you call it correctly.
[07:55:28] rvanlieshout: thebatu1_: you don't "access" things like that
[07:55:30] sevenseacat: thebatu1_: what does your app/models/operation.rb file define?
[07:55:31] rvanlieshout: you use defined variables
[07:55:39] rvanlieshout: and you've got a @operation defined in the controller
[07:55:43] rvanlieshout: but you're trying to use operation
[07:57:01] thebatu1_: rvanlieshout: it defines a method "all_products_have_same_posters_count?"
[07:58:20] rvanlieshout: thebatu1_: close all files in your editor besides that view
[07:58:32] thebatu1_: I got it. I need to make use of @operation.
[07:59:03] thebatu1_: rvanlieshout: closed
[07:59:40] rvanlieshout: remember the context you're working in
[08:00:58] thebatu1_: rvanlieshout: ok
[08:37:25] jheg: has anybody ever built a rails app that serves as a kind of back office system
[08:37:46] jheg: like a client management system
[08:39:53] rvanlieshout: we only build rails apps that are used for back office
[08:40:00] rvanlieshout: only = most of the time
[08:40:04] sevenseacat: seems like any other normal rails app?
[08:43:41] jheg: what types of things have you built rvanlieshout
[08:44:20] rvanlieshout: amazing things
[08:44:26] sevenseacat: what makes a back office app different from any other app?
[08:46:28] jheg: I guess sevenseacat. I???m trying to figure out if Rails is suitable for say building a BOS for an estate agent that needs to register applicants, run a diary, do email shots, book viewings, register offers and much more besides
[08:46:47] sevenseacat: as suitable as any other web framework is
[08:46:51] sevenseacat: maybe even more so
[08:47:17] rvanlieshout: and don't try to compare these things to like facebook, twitter or linkedin
[08:47:29] rvanlieshout: they might started with a framework, but they won't be using it anymore
[08:47:42] sevenseacat: facebook rewrote the programming language to suit themselves
[08:47:44] rvanlieshout: any overhead is too much at that scale
[08:48:47] jheg: cool thanks
[08:49:24] jheg: the couople of companies I work for alone spend in excess of ??700 per month in subscriptions on two systems
[08:49:41] jheg: one is web based
[08:49:45] rvanlieshout: that alone doesn't say anything about the value of them
[08:50:15] jheg: it does say that if I could build a solution with Rails then it potentiall saves ??8,400 per annum
[08:50:37] rvanlieshout: not if your effort will cost them more
[08:51:19] jheg: them is me
[08:51:42] rvanlieshout: not if you can earn more money in the time you need to spend to save 8400
[08:51:54] jheg: besides having my own BOS means feature updates can be done much quicker
[08:52:10] rvanlieshout: oh there is no doubts about benefits
[08:52:14] rvanlieshout: but it's not only benefits
[08:52:22] jheg: yeah I know
[08:53:00] jheg: but (assuming I am capable) the long term benefits outweigh the relative short term loss of my time
[08:54:55] rvanlieshout: if you have the time for it sure
[08:56:33] ackpacket: It's not the value of his time vs 8400
[08:56:40] ackpacket: it's the value of his time vs a cashflow
[08:56:45] ackpacket: since he said 8400 per anum
[08:59:47] arup_r: Hi.. I have the same situations like -- http://stackoverflow.com/questions/16041790/what-is-the-best-way-to-resolve-rails-orphaned-migrations ,, I found the easy solution as `delete from schema_migrations where version='<MIGRATION_ID>';` as mentioned in the answer - http://stackoverflow.com/a/16155349/2767755
[09:00:10] arup_r: If I do delete it from the table directly.. will there be any side effect ?
[09:00:23] arup_r: I never ran into this situation before.. so asking
[09:00:33] arup_r: If it is the best approach or not
[09:00:58] rvanlieshout: what exactly is your issue?
[09:01:28] arup_r: one min rvanlieshout
[09:22:06] arup_r: rvanlieshout: https://gist.github.com/aruprakshit/f7f8f6780143ab789b35
[09:24:26] rvanlieshout: arup_r: ah right. so the db assumes that one has been performed, but the file isn't there anymore
[09:24:40] rvanlieshout: so who is right?
[09:24:55] rvanlieshout: should the file be present or shouldn't the migration exist?
[09:25:01] arup_r: so deletion of the migration table
[09:25:20] arup_r: migration id from the migration table
[09:25:43] arup_r: But I was asking if it has any side impact or not ?
[09:26:38] rvanlieshout: it all depends on what's right
[09:27:03] arup_r: didn't get you
[09:27:15] rvanlieshout: well.. you've now just deleted that number from the migrations table
[09:27:24] rvanlieshout: but what if that number should actually exist and the problem here is that the file is missing
[09:27:34] arup_r: rvanlieshout:
[09:28:03] arup_r: rvanlieshout: if number exist... then it is not allowing me to do rol;back
[09:28:19] arup_r: as the migration file was not there
[09:29:16] rvanlieshout: but should it be there? cause then that's an issue with side impact
[09:30:27] arup_r: rvanlieshout: corresponding the file shouldn't be there
[09:30:42] arup_r: well let me tell you what I did
[09:31:43] arup_r: (1) rails g model feed feedable:references{polymorphic} (2) rake db:migrate... then we changed the way of implementing it.. so I did rails d model feed feedable:references{polymorphic}
[09:32:14] arup_r: without doing rake db:rollback before
[09:34:19] rvanlieshout: you don't have to do a rollback
[09:34:25] rvanlieshout: you should just not delete migrations that have been performed
[09:35:30] arup_r: then what is the best practice ?
[09:35:47] arup_r: This was the last migration.. so I did the way I told you
[09:37:19] arup_r: ok.. then ? how would I revert back the changes I applied through the migration ?
[09:37:48] rvanlieshout: you should also not change migrations that have been performed
[09:37:55] rvanlieshout: well.. performed on something non local
[09:39:02] rvanlieshout: if you've pushed your code you should not edit migration files
[09:39:14] arup_r: I didn't push this migration..
[09:39:28] arup_r: it was in my feature branch
[09:39:47] rvanlieshout: then it's ok to edit them
[09:39:55] rvanlieshout: but deleting them while executed is not really the best way to go :)
[09:54:47] shortCircuit__: I have discovered sleep and sex are of same value to me.. the more I sleep the less I feel satisfied :D
[09:55:04] shortCircuit__: I wished I could sleep for 2 days.
[09:55:17] manuelmesson: me too :'( Take a Advil PM
[09:55:53] manuelmesson: is a pill that make you sleep :)
[09:55:58] manuelmesson: from where you are?
[09:57:00] manuelmesson: I'm from Puerto Rico, a small island in the caribbean :)
[09:57:09] manuelmesson: most people dont know where it is
[09:57:18] exadeci: Hey, I have a simple_form in which I would like that when select an option it would load checkboxes that are linked to the option I did in ajax and that works with a select using the option_for_select but I can't find how to do it with checkboxes, how would you do that ? rendering a partial isn't working because it renders it before appending it
[09:57:48] shortCircuit__: ah, I have heard that name somewhere, maybe in a movie.
[09:58:36] rvanlieshout: exadeci: if it's not really that much data i would add the checkbox-list to the data attribute of the options
[09:58:36] manuelmesson: hahaha, probably.
[09:58:55] shortCircuit__: is it summer there ?
[09:59:37] manuelmesson: always is summer :D
[09:59:54] manuelmesson: i live in front of the beach.
[09:59:57] shortCircuit__: ow.. then, is it hot summer or cool summer :P
[10:00:18] manuelmesson: hahaha yep, just like that.
[10:01:28] shortCircuit__: http://upload.wikimedia.org/wikipedia/commons/a/ae/Patillas_Puerto_Rico.jpg looks like our Kerala http://www.hotelskerala.net/beaches/image/Beach.JPG except for the hills
[10:03:43] manuelmesson: yeah, Puerto Rico can be a tourism paradise. But politics have destroy this beautiful island.
[10:04:32] manuelmesson: I was here last week. http://www.yasta.pr/wp-content/uploads/2012/07/Flamenco-culebra_3-e1342657027399.jpeg?cbe5cf
[10:05:00] manuelmesson: I want to go to asia. So different, i have never been outside of america.
[10:05:40] exadeci: rvanlieshout: you mean all preloaded in the select ?
[10:05:45] rvanlieshout: exadeci: yeah
[10:08:34] exadeci: rvanlieshout: I got a case where it could be an issue but only for the admins so I'll try that thanks
[10:11:11] manuelmesson: Serious question, it is posible to find a US45K salary working remote?
[10:11:19] manuelmesson: with ruby on rails??
[10:22:11] ackpacket: manuelmesson: I believe so, but you won't have an easy time getting it. Or much security.
[10:22:29] ackpacket: manuelmesson: you will pay US taxes also.
[10:23:25] ackpacket: Does rails/haml have an easy way to make a form field for inputting a date? month, day and year.
[10:30:49] rubyonrails402: here to discuss ?
[10:32:00] jhass: rubyonrails402: if you got a question, just ask it
[10:32:32] frank_o: I'll take that
[10:33:08] jhass: ackpacket: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-date_select (I just entered date into the search)
[10:33:09] ackpacket: Not even certain he's got a question at this point...
[10:33:31] ackpacket: jhass: already found and implemented :D
[10:33:34] ackpacket: It's wonderfully convenient
[10:33:43] frank_o: Hi! Trying to send my Paperclip jobs off into the background with https://github.com/jrgifford/delayed_paperclip/ -- https://gist.github.com/dt1973/6b65794bf677e8753bdb
[10:33:46] frank_o: I'm getting `[ActiveJob] Enqueued DelayedPaperclip::Jobs::ActiveJob (Job ID: fb1e6e56-6f47-4bc6-a24a-d5f41a83a959)` but after that nothing seems to happen. But, when trying to inspect it: `Delayed::Job.find("fb1e6e56-6f47-4bc6-a24a-d5f41a83a959")` I'm getting `ActiveRecord::RecordNotFound: Couldn't find Delayed::Backend::ActiveRecord::Job with 'id'=fb1e6e56-6f47-4bc6-a24a-d5f41a83a959` -- anybody fami
[10:33:52] frank_o: liar with this?
[10:34:21] ackpacket: frank_o: you might wanna pastebin your error
[10:35:26] frank_o: ackpacket: There's no error unfortunately.
[10:36:24] frank_o: ackpacket: Check the gist though
[10:37:20] ackpacket: Beyond me =\
[10:38:53] frank_o: I think I'm missing something fundamental..
[10:39:01] frank_o: Waiting for that "aha"-moment to show up
[10:48:47] psyxoz228: hi all. i'm goint to write my first project - web shop. i read about spree, but i want do it myself(sorry for bad english). So, what should i do? Use gems for auth, cart and etc. or do it by myself?
[10:50:10] frank_o: psyxoz228: yeah. spree is pretty much a gem for cart so..
[10:52:55] ackpacket: if I have a rails model with a field that is a :date, can I do my_model.date.month?
[10:53:41] psyxoz228: ye, but. one my friend tell me, that ~80% of project is some gems. but if i'll use gems, how i learn rails?
[10:53:50] ackpacket: Sure enough
[10:54:04] rvanlieshout: rails is a gem...
[10:54:05] ackpacket: psyxoz228: consider creating a smaller project first that relies less on gems?
[10:55:40] ackpacket: psyxoz228: Look up ESaaS by Armondo Fox
[10:57:06] frank_o: psyxoz228: if you dont use gems you'll waste your life away reinventing the wheel. even with gems you'll still have to copy their views into your app and customize them etc.
[10:58:05] psyxoz228: so, any idea about small project? but not a blog, please... i wanna make something a little usefull. and run it in production.
[11:00:12] ackpacket: Maybe I'm trying to be too clever but.. I'm trying to add a value to a text field ONLY if an object exists. Is this proper: =text_field_tag "description", @course.description if @course
[11:00:31] ackpacket: but it seems like the if @course portion elliminates the tag entirely if there's no course
[11:03:02] frank_o: psyxoz228: https://github.com/radar/forem centered around your favorite hobby :D
[11:05:12] frank_o: psyxoz228: radar is one of the main men behind spree, so forem is structured in the same way (as a rails engine) so its a perfect way to learn
[11:05:47] frank_o: forem is probably my most favorite tool of all times next to ruby on rails
[11:06:42] psyxoz228: frank_o: do you mean that I should study the source code of forem? and create something with it?
[11:07:56] psyxoz228: frank_o: and sory for stupid questions, i'm new but i wanna learn this framework very much
[11:08:15] frank_o: create something cool :-)
[11:08:24] frank_o: slap a few google ads on there and make lots of money while at it
[11:11:33] esparkman: ackpacket: you could probably get a better result with javascript
[11:11:58] ackpacket: esparkman: javascript would have no knowledge of one of ruby's instance variables
[11:12:31] esparkman: ackpacket: but it would have knowledge of the dom and if that element exists on the page
[11:13:02] esparkman: if it does then you populate the value, if not then do nothing
[11:13:03] ackpacket: esparkman: No one mentioned an element
[11:13:09] psyxoz228: frank_o: thant you for advices... i don't know what it will be, but i'll try create something good.
[11:14:01] ackpacket: So, I used date_select to make a few select boxes based on my model... but how do I go about using that in params to update a model? It's oddly structured in the request
[11:16:47] jhass: I don't have it present, how is it structured?
[11:19:07] ackpacket: "course"=>{"startdate(1i)"=>"2015", "startdate(2i)"=>"4", "startdate(3i)"=>"3", "enddate(1i)"=>"2015", "enddate(2i)"=>"4", "enddate(3i)"=>"3"}
[11:19:31] ackpacket: jhass: I'm not certain how this is easily translated to something useable in update_attributes
[11:19:45] ackpacket: I can pick out each value of course...
[11:20:54] jhass: ackpacket: guides say it works by magic: http://guides.rubyonrails.org/form_helpers.html#using-date-and-time-form-helpers-model-object-helpers
[11:22:11] ackpacket: more magic...
[11:22:16] ackpacket: it's everywhere
[11:33:41] psyxoz228: frank_o: why in forem postController is a part of Forem module?
[11:44:49] frank_o: psyxoz228: sorry?
[11:47:21] psyxoz228: frank_o: in forem. PostController or Post class are contained within a module Forem. Why? (like Module Forem; class Post < ... )
[11:50:32] Morkel: I try to moch this call with mocha. Customer.new(sid: self.data['object']['id']) but it doesent work with Customer.any_instance.stubs(:new).once. Can anyone tell my why this dont work
[11:52:13] frank_o: psyxoz228: i think because forem is a rails engine (http://guides.rubyonrails.org/engines.html).. if you want to customize them you have to extend them.. ie. by creating app/decorators/controllers/forem/post_controller_decorator.rb etc.
[11:53:44] frank_o: psyxoz228: for instance here i extended forem to support paperclip photo uploads: http://runnable.com/VEEnRTEK-igg4XGD/forem-with-paperclip-for-ruby-on-rails
[11:53:49] frank_o: anyway gtg good luck
[12:03:50] macmattias: Good day??? I am trying to get the first part of the auth from Instagram. I can do i tmanually but in code how do I get the respone URL and not the body?
[13:05:53] chridal: Anyone with any experience with geofencing here?
[13:07:40] thaumer: hi, can I load database content into a .html.erb page? suppose I want to load the last 'review' (method) I wrote
[13:07:42] chridal: I'm building a social network and we want to use it for our application. Is this something that is very hard to implement? And what about resources, is it intensive?
[13:08:23] sevenseacat: thaumer: sure.
[13:09:13] elaptics: I don't even know what geofencing is
[13:09:19] thaumer: sevenseacat: how? tried googling it but found anything
[13:09:25] chridal: thaumer: Just make the review available for the view through putting it in an instance variable, and then you can use erb to render it
[13:09:50] sevenseacat: thaumer: thats the entire point of using a framework like rails, to build HTML websites from database-driven content
[13:10:02] sevenseacat: thaumer: !gettingstarted
[13:10:02] helpa: thaumer: http://guides.rubyonrails.org/getting_started.html - Getting started with Ruby on Rails guide written by Mike Gunderloy and Ryan Bigg
[13:10:32] chridal: elaptics: http://whatis.techtarget.com/definition/geofencing
[13:13:00] elaptics: chridal: ah ok, I understand. I guess the answer to your question is, it depends. What exactly are you geofencing?
[13:13:36] elaptics: And how does that relate to the application you're building
[13:14:01] chridal: Well, for instance, if a person is within X miles of another person, we want to trigger an alert.
[13:14:52] chridal: That means that every person is a wandering geofence, and they update their location say each Y minute. So when a person updates his location, we want to check if he is within a geofence defined in the database.
[13:15:49] elaptics: chridal: well I'm no expert but if you're using something like postgis then I'd think it's just a factor of how often locations are being updated and how many people you're querying against
[13:16:37] chridal: elaptics: We are running on postgres, yes, but I hadn't looked into postgis yet. Do you have any experience with that one?
[13:17:11] elaptics: not particularly, I just know that it's designed for spatial queries
[13:18:45] chridal: I have no experience with geofences, so I guess I am seeking information about which traps to obviously avoid
[13:19:27] elaptics: chridal: a quick search yielded this http://blog.geomusings.com/2011/08/01/triggered-notifications-using-postgis/
[13:19:37] elaptics: sounds like the gist of what you're asking
[13:20:13] chridal: Cheers. I'll have a look at that one.
[13:39:30] gaussblurinc1: hi! I have rails gem version 3.2.14, should I go to newer version and to which version?
[13:48:55] piotrj: gaussblurinc1: are you creating new project or you are asking about updating rails in some older projecT?
[13:49:25] gaussblurinc1: piotrj: about old project
[13:52:06] banisterfiend: hi, is there a way to do: an cohort.students.includes(:attendance_records) but define a 'where' expression so that only some attendance_records are preloaded rather than all of them?
[13:52:52] piotrj: gaussblurinc1: if you are currently heavily developing something in this project then maybe it's worth upgrading to the newest one which is 4.2.1 right now. If it's just maintanence then upgrade to the newest 3.2 to get security fixes
[13:57:12] gaussblurinc1: piotrj: thanks for advice!
[13:57:52] piotrj: gaussblurinc1: http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html may come in handy if you decide to upgrade to 4.2
[14:19:34] Criten: Hey guys! Quick conversation topic. How do you document your infrastructure, and does anyone know of any templates to get started doing so. Or examples.
[14:28:51] dEPy: Any way I can group model by some attribute then select only last (based on created_at or id) from each group?
[14:29:50] fryguy: dEPy: will need arel to do that I think
[14:30:13] dEPy: why would you need arel?
[14:30:20] dEPy: I can just write SQL then
[14:30:33] dEPy: Just wondering if there's a rails way
[14:30:41] fryguy: if you prefer to have sql strings instead of arel objects, you can do that
[14:30:43] fryguy: arel is the rails way
[14:31:01] dEPy: so no way to do it only with rails?
[14:32:36] fryguy: there are ways to do it in only rails, but it won't be performant (return the whole table, and do the group_by stuff on ruby enumerables instead of in the database accomplishes what you want)
[14:34:57] fryguy: if you are using mysql you can do it by grouping by things that aren't referenced in the select clauses, but this won't work in things like sqlite or postgres. if you are in postgres I think a window function would do what you need.
[14:36:03] shortCircuit__: hi I have a spec where I have to get the salary for the present year. Now if there is a leave taken then the salary is deducted ... but the problem is , I had Date.today.begining_of_week(:monday).... to avoid the leave being on a sunday. but now the problem is, for 2015/04/03 the leave date is going to the previous month. :( How to get rid of this problem once and for all ?
[14:36:19] shortCircuit__: *present year and *prsent month
[14:37:17] borodin: I'm learning javascript + rails, finding I'm clueless in many areas. I have a js file in app/assets/javascripts named for the controller. This file needs visibility to params[:uuid] (a value visible in the controller). I know I could create an erb file and add in <%= params[:uuid] %> but erb files don't belong in app/assets/javascripts, correct?
[14:38:45] shortCircuit__: if you need a to have a server side value in client side, either you do a js.erb file or use ajax or set the value in some data- attribute and extract with JS
[14:38:55] fryguy: borodin: you can put erb files in app/assets/javascripts, but it won't do what you want. you should either emit a small amount of javascript on your view to add the thing you want as a variable for the rest of javascript, or just read the uuid from the url, which you do have access to via javascript. you are probably doing things the wrong way in general though
[14:39:18] borodin: here's what I have: https://gist.github.com/anonymous/6961ae4631b639d6e657
[14:39:30] borodin: and yes, I'm probably doing 80% of everything in the wrong way
[14:39:53] borodin: half of this code is stolen from somebody who knew what they were doing, the other half is crap
[14:40:22] borodin: but on line 5 that uuid is hard-coded here because I can't figure out how to know it. Does the client side javascript know the params hash?
[14:40:45] fryguy: borodin: http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
[14:41:52] borodin: fryguy: awesome thanks
[14:42:18] borodin: if you were learning javascript on rails for the first time, what book/website would you learn from?
[14:42:35] fryguy: i wouldn't bother learning javascript on rails, they are basically 2 separate things
[14:42:37] shortCircuit__: so uuid should be params[:uuid] ?
[14:43:02] shortCircuit__: what is your controller action name ? do you have a view for that ?
[14:43:02] borodin: I haven't actually tried that in the js file but I suspect it'd fail
[14:43:13] shortCircuit__: yeah that will..
[14:43:17] borodin: dpoint_graph#data
[14:43:25] borodin: lemme gist that nasty bitch
[14:43:37] shortCircuit__: and you have dpoint_graphs/data.html.erb ?
[14:45:14] borodin: https://gist.github.com/chewmanfoo/7c013032c3be36c20ad8 my shitty controller
[14:45:25] shortCircuit__: I don't need your controller
[14:45:43] shortCircuit__: I need the view for that.. the .html.erb or .js.erb
[14:46:08] shortCircuit__: I mean the js is supossed to act on some page right?
[14:47:32] browndawg: quick question. I've got spec/requests/blah_spec.rb. The helper methods should be in spec/helpers/blah_spec_helper.rb, right?
[14:49:15] borodin: shortCircuit__: the dpoints_graph controller has an index method and a data method - the javascript douint_graph.js is loaded automagically when the dpoint_graph controller index page is requested - it has an ajax function which gets dpoint_graph#data
[14:49:30] borodin: I understand that almost 80% :)
[14:54:22] qurve: Does anyone know how, given a kaminari scope, I can generate a full URL (including hostname) to the next/previous page?
[14:54:35] qurve: I've dug into it's code and the closest I've gotten is doing `next_page = Kaminari::Helpers::NextPage.new(self, current_page: @articles.current_page)`
[14:54:48] qurve: But `next_page.url` seems hard-coded to only_path: true
[14:55:30] qurve: I'm trying to include a link[rel=next] in an atom feed but it doesn't appear that kaminari exposes a way to generate a full URL, figured I'd ask here before giving up and doing something stupid.
[14:57:15] qurve: This seems to be the line of code ruining my day: https://github.com/amatsuda/kaminari/blob/master/lib/kaminari/helpers/tags.rb#L31
[14:58:53] qurve: It's odd that they expose helpers for generating links, but not URLs.
[15:06:36] browndawg: yo, is there a it_should_not_behave_like <shared_examples> helper for rspec?
[15:08:52] qurve: But you could do something like Rspec.shared_examples_for 'not a foo' { ... }
[15:08:59] qurve: That negates all the expectations.
[15:09:13] shortCircuit__: ok so your data action recieves a requst of JSS format, so then just put that js file inside views/dpoint_graphs.js.erb where you can directly use <%= params[:uuid] %>
[15:09:23] qurve: Or you could do RSpec.shared_examples_for 'a fooable foo' |negated = false| { ... }
[15:09:32] shortCircuit__: borodin, sorry for the late, I had a meeting
[15:09:47] qurve: Then do it_behaves_like 'a fooable foo', false
[15:10:00] qurve: Then within the shared examples, negate the expectations based on the value of negated.
[15:10:20] qurve: I'd probably use separate sets of shared examples though for clarity.
[15:10:51] qurve: You could also create a shared_context between both sets of shared examples that does the same setup however.
[15:12:42] browndawg: qurve: yeah, but that's sort of cumbersome
[15:13:13] qurve: YOu have to keep in mind that shared examples themselves don't have expectations, they are just a container.
[15:14:30] qurve: RSpec.shared_context 'fooable foo setup' { ... }; RSpec.shared_examples_for 'a fooable foo' { include_context 'fooable foo setup' ... expectations }; RSpec.shared_examples_for 'not a fooable foo' { include_context 'fooable foo setup', ... inverse expectations }
[15:14:38] qurve: That's how I would do it, it would still be reasonably DRY.
[15:15:10] qurve: I've been doing RSPec for quite a while and can't think of a better way, but perhaps someone else knows more than I.
[15:19:41] snicers-work: I have a method and I want to pass either a relation to it or just a class instance, should I use something like if(@variable.class.name) ?
[15:21:47] qurve: I would switch on @variable.class or use variable.is_a?(...) probably.
[15:22:00] qurve: That way you're referencing types not strings.
[15:22:07] vlad_starkov: Question: What ruby gem do you use as a client for rabbitmq: "bunny" or "amqp"?
[15:26:11] fortunate: Do I need an API on my rails app in order to have an arduino send data to its database?
[15:27:05] fortunate: Do I need an API on my rails app in order to have an arduino send data to its database?
[15:28:55] shortCircuit__: how to make this better let!(:payslip) { employee.create_payslip(3, 2015); employee.payslips.first }
[15:29:26] snicers-work: What would a reference to a class look like in rails?
[15:29:45] snicers-work: if(myActiveRecordRelation.class == ?)
[15:30:10] shortCircuit__: class name in string
[15:30:57] snicers-work: I was just told not to use the strings by qurve
[15:31:46] qurve: snicers-work: if @variable.is_a?(MyModel) or if @variable.is_a?(ActiveRecord::Relation)
[15:31:58] qurve: The main benefit of using references over strings is that if it's not defined, you'll get an error.
[15:32:19] qurve: if @variable.class.name == 'MyModl' will fail silently because of a typo.
[15:32:35] qurve: Additionally, you have to worry about things like classes in modules when dealing with strings.
[15:33:10] snicers-work: What about something like: ActiveRecord::Relation::ActiveRecord_Relation_Order
[15:33:36] snicers-work: doing is_a?(ActiveRecord::Relation::ActiveRecord_Relation_Order) doesn't work.
[15:33:41] qurve: snicers-work: To be perfectly honest it sounds like you may have a larger design problem if you are passing varying types as a parameter.
[15:33:52] elaptics: shortCircuit__: what are you trying to do in that let? create_payslip should return the payslip so no need to do the 2nd line
[15:33:54] djellemah: fortunate: does the arduino have an http stack?
[15:33:57] qurve: That's usually (not always I guess) a code smell to me.
[15:34:02] gaussblurinc1: where should I put gems from :assets group in rails 4.2?
[15:34:16] snicers-work: Well that is the thing, either you are passing a single order or a group of orders and wanting a CSV generated.
[15:34:26] snicers-work: How would you handle that qurve ?
[15:34:37] qurve: @snicers-work: What's the problem you're trying to solve?
[15:34:41] elaptics: snicers-work: wrap the single order in an array so it's always a collection
[15:34:52] elaptics: snicers-work: Array(single_thing)
[15:35:14] snicers-work: elaptics, but wouldn't I want the classes of that object to match as an active record relation?
[15:35:38] qurve: snicers-work: What is the actual problem you're trying to solve, I may have missed the back story.
[15:35:39] elaptics: snicers-work: ok, I missed the first part of this...what are you trying to do?
[15:36:20] snicers-work: get a list of say orders via ActiveRecord and then pass that to a method to parse through. I want to be able to pass 1 to n to this method.
[15:36:32] snicers-work: So I need to wrap that 1 in the same class as the n.
[15:36:52] snicers-work: I just don't know how the best way to do that is in Rails.
[15:36:52] gaussblurinc1: what should I do with gems from :assets group? where to put them in rials 4.2?
[15:37:36] qurve: When you say 'orders' do you mean an Order model or the .order() method of ActiveRecord?
[15:37:38] elaptics: snicers-work: if you're getting the list of orders through an AR model then it will be a relation so it will always be a collection even if it only contains 1
[15:37:50] qurve: ^- what he said.
[15:38:07] qurve: Order.where(...) will always coerce to a collection regardless of how many are returned.
[15:38:14] elaptics: gaussblurinc1: just put them in your gemfile like the others
[15:39:03] qurve: The only time you'd run into a problem is if you were doing something like: orders = params[:id] ? Order.find(params[:id] : Order.where(...) # This is bad because orders can now be of varying types
[15:39:14] qurve: And will lead to tears.
[15:40:38] dstarh: Anyone know how to redirect after success with a custom devise/warden strategy? We have an handoff token appended to the url and we'd like to redirect after warden authenticates the token.
[15:40:49] shortCircuit__: elpatics , nah, create_payslip is not returning the payslip, since its wrapped in an active record transaction block and no @payslip is used there, it only return true
[15:41:05] dstarh: success!(user) followed by a redirect!(url) does not follow the redirect
[15:41:36] fortunate: Is it possible for me to have to controllers with the same name for example, app/controllers/user_controller.rb and app/controllers/api/v1/user_controller.rb?
[15:41:39] elaptics: shortCircuit__: who is this elpatics guy? ;)
[15:42:08] shortCircuit__: ow, sorry .. actualy office is going, they are kicking me out
[15:42:08] elaptics: shortCircuit__: is there a reason that method can't return the payslip? It sounds like it would make sense to do so
[15:42:33] qurve: fortunate: Yes, they will be in different modules
[15:43:02] qurve: I use the exact same setup to separate web controllers from API controllers and different versions of APIs.
[15:43:16] fortunate: thanks qurve!
[15:43:20] shortCircuit__: umm, because that method is in the model ..
[15:43:29] qurve: The rails generators are smart enough to handle it for you as well if you use `rails generate controller api/v1/users`
[15:43:33] shortCircuit__: bye .. will talk when get home
[15:43:51] qurve: It will automatically create the directory structure and declare the class like class `Api::V1::UsersController`
[15:44:16] qurve: You're one step ahead of most rails devs in separating your API from your normal controllers, so congrats on that as well.
[15:44:55] qurve: Conflating API/non-API formats in a single action is a huge mistake I see in a lot of rails apps.
[15:45:30] qurve: API is a separate business concern and should use completely different sets of controllers IMO.
[15:46:16] qurve: In other news, I learned about this today: http://api.rubyonrails.org/classes/ActionView/Helpers/AtomFeedHelper.html
[15:46:22] delinquentme: setting up a test database w PSQL ... $ rake db:reset db:migrate runs as expected but when I look @ the database .. not tables are there
[15:46:26] qurve: Had no idea that helper existed, ut it's awesome.
[15:46:33] delinquentme: I'm guessing a DB access / configuration issue?
[15:47:26] fortunate: thanks qurve, that was really helpful and took a huge weight off my shoulders!
[15:48:08] qurve: fortunate: You when versioning APIs you can do fun stuff with concerns as well.
[15:48:28] fortunate: I don't really know a whole lot about concerns
[15:48:43] qurve: Eg, if you have 10 API controllers in V1 and only one of them needs to change for V2, take all the code from the other 9 in V1, move them into a concern, and in V2 you can just do stuff like
[15:49:06] qurve: class Api::V2::UsersController; include Api::V1::Concerns::UserControllerable; end
[15:49:30] qurve: It's a fancy way of saying "The V2 Users API behaves exactly the same as the V1 Users API"
[15:50:01] fortunate: qurve: NICE! thanks I have to go now! wish me luck
[15:50:03] qurve: It's not perfect, but it can prevent having to copy/paste code en-masse when moving to a new API version.
[15:50:21] qurve: Concerns generally are very helpful and one of my favorite additions to rails.
[15:50:49] woop: I'd just handle that in routes.rb
[15:51:07] woop: why make a new controller that mimics another controller if you can just point the client to that other controller in the first place?
[15:51:17] workmad3: I also wouldn't attribute that capability to concerns... seeing as you've always been able to do that with plain modules :P
[15:51:18] woop: I guess it lets you namespace route, at least
[15:51:44] qurve: workmad3: Agreed, but I like that they packaged it up and standardized it a bit.
[15:51:46] woop: kinda still new at rails - looks like concerns occupy the role "service" classes often do?
[15:51:56] qurve: Not really.
[15:52:05] qurve: Concerns are more of shared functionality without inheritence.
[15:52:20] woop: that's what I use services for, at least
[15:52:32] qurve: For example, in my system Articles and Users can both attach a Photograph to them, but they have no relationship to each other.
[15:52:58] woop: which is just a normal mixin workflow
[15:53:00] qurve: So I have a concern called Lifestyleable which wires any model it's included in up with the necessary associations/validations related to having a related Photograph.
[15:53:09] qurve: Rails Concerns are just standardized mixins.
[15:53:12] woop: concerns are just modules with a new Rails name?
[15:53:24] sevenseacat: and a bit of extra magic
[15:53:30] woop: what's the extra magic?
[15:53:32] qurve: woop: ActiveSupport::Concern just does some of the plumbing for you.
[15:53:46] sevenseacat: god i hate the fashion of adding 'able' to words that it doesnt make sense to add them to
[15:53:52] woop: and... is there a place I can just buy a poster of all the rails magic to put up at work so I can stop cursing it?
[15:53:55] qurve: sevenseacat: Me too :)
[15:54:17] woop: sevenseacat: welcome to java lolz from years ago using interfaces
[15:54:19] qurve: But I prefer consistency and clarity in role and haven't come up with a better naming scheme yet.
[15:54:34] elaptics: this is a good article on concerns http://blog.coreyhaines.com/2012/12/why-i-dont-use-activesupportconcern.html
[15:54:48] woop: along with why the author does not like them :)
[15:55:04] elaptics: woop: I agree with the author
[15:55:32] woop: I'm generally skeptical of mixins, already, and mixins + magic makes me downright uneasy
[15:55:32] elaptics: concerns make it a bit too easy to use them as a drawer to shovel some junk in
[15:56:05] elaptics: it's already easy to do that in rails - we didn't need any more ways to make it easier :)
[15:56:15] qurve: I've read that article before, it's good. Personally I enjoy using them and will until it's not fun anymore, which may be in the future.
[15:56:36] elaptics: qurve: everything in moderation :) I do use them too - just very sparingly
[15:56:36] sevenseacat: i dont use them very often
[15:56:42] qurve: Between concerns and shared rspec examples, I personally think my code is clearer.
[15:57:01] qurve: RSpec.describe 'MyModel' { it_behaves_like 'a model with a lifestyle photo' }
[15:57:09] qurve: class MyModel; include Lifestyleable; end
[15:57:38] sevenseacat: if only you didnt have to manually manage the database side yourself
[15:58:10] qurve: Haven't really had an issue with that.
[15:58:50] qurve: My commit to make Users have photos was a add_column migration, an it_behaves_like, an include, and a change to the form so they could upload.
[15:58:55] qurve: Perhaps I just haven't hit the landmines yet.
[16:00:02] woop: oh golly
[16:00:05] woop: elaptics: thanks for the link
[16:01:18] woop: it mostly describes the situation I just got dropped into
[16:01:43] woop: except that the technical co-founder was a trained baboon
[16:43:22] livcd: is there some gem that would emulate a codekit behaviour of refreshing the page automatically when i change something in a stylesheet?
[16:44:15] Axilla: whats your favorite deployment tool for AWS?
[16:45:14] xibalba: aws is garbage
[16:45:45] xibalba: can't even provide you with a real console
[16:46:18] Axilla: that's not the question i asked
[16:46:27] Axilla: what do you mean can't provide you with a real console?
[16:46:35] Axilla: a real console for what?
[16:46:43] xibalba: means SSH is broken, and so I have no way to get into this box
[16:46:48] xibalba: a real console, like a KVM
[16:46:55] bricker: livcd: https://github.com/guard/guard-livereload
[16:46:55] xibalba: as in you're sitting infront of the computer
[16:46:55] snicers-work: elaptics, I think you are wrong, I think if you use .first you don't get a relation collection returned.
[16:46:57] snicers-work: Can someone help me find out how to get a single record back using active record but have it encapsulated within a relation.
[16:47:37] livcd: bricker: have you googled that or are you actually using it ? :-)
[16:48:38] bricker: livcd: I don't use it, I think rhizome does maybe
[16:48:43] Axilla: sounds like a personal problem xibalba
[16:48:49] Axilla: yes, i get it.
[16:49:05] JDeen: Hi, I am needing to implement a simple inventory app. I checked and I didn't find any thing in Rails. Thinking of implement it, I am wondering if https://github.com/collectiveidea/awesome_nested_set could be used to create nested categories. As I am said the number of levels can vary.
[16:49:18] Axilla: you could roll back to a working snapshot and fix whatever you broke
[16:49:21] rhizome: axilla: rubber is ok if you stick with defaults.
[16:49:26] livcd: bricker: i actually have a codekit but do not know how to set it up for rails or if it would not be a inappropriate to use it with rail uh
[16:49:31] rhizome: s/with/close to/
[16:49:39] elaptics: snicers-work: that's right, but I didn't say to use first
[16:49:51] elaptics: snicers-work: can you gist your code?
[16:50:02] rhizome: jdeen: inventory is not necessarily simple
[16:50:30] bricker: I hate that when you switch branches all your files in sublime text are marked as "unsaved"
[16:50:40] bricker: all the new files
[16:50:52] rhizome: jdeen: awesome nested set is good though
[16:50:54] bricker: and then you have to remember if you forgot to save it or what
[16:51:07] bricker: and closing the window you have to tell it not to save every file
[16:51:27] elaptics: bricker: you should use a proper editor like vim :D
[16:51:40] snicers-work: well it isn't much right now, I have Model.all and Model.first, I just want to get a single Model but have it able to pass through an each statement so that my class can remain simple.
[16:51:47] rhizome: yeah a proper editor doesn't care whether it's saved or not
[16:52:20] elaptics: snicers-work: gist what you have then, then I can provide better advice
[16:52:26] snicers-work: Right now I am settling on doing [Model.first] just to dump it into an array but now the classes differ so I can't type hint on injection.
[16:52:26] JDeen: rhizome: Thanks for the info. What did you mean by inventory is not necessarily simple. You mean its a lot of work? or is it technical difficulties implementing it?
[16:53:30] rhizome: jdeen: can be as complex as you want to make it. you can scaffold a list CRUD in 6 min
[16:55:06] Scriptonaut: hey guys, could someone tell me why this checkbox is checked even though I've been passing it false: <%= check_box_tag '', 'this_year', 'false', :class => 'date-filter this-year-filter' %>
[16:55:16] snicers-work: elaptics, something like this: https://gist.github.com/anonymous/d4959fd687524b51b412
[16:55:21] Scriptonaut: I know it's not caching it
[16:55:47] rhizome: Scriptonaut: "false" is true
[16:56:04] JDeen: rhizome: True, thanks once again for the info.
[16:56:14] Scriptonaut: thanks, brainfart
[16:56:28] elaptics: Scriptonaut: that's no way to address rhizome :)
[16:56:37] rhizome: i'll take what i can get
[16:57:05] elaptics: snicers-work: can you share your actual code for how you plan to use this?
[16:57:43] snicers-work: I mean, not really, it isn't written. I am going to end up opening up a csv and build that based on the records returned.
[16:57:51] browndawg: where do I put rspec shared examples in a rails 4.2 app?
[16:59:32] gaussblurinc1: hi, I move to rails and run rake rails:update. and here I have results in config, don't know how to solve it: http://pastie.org/10072069
[17:00:49] rushed: gaussblurinc1: are you just getting started with Rails? what are you trying to do?
[17:01:24] bricker: browndawg: anywhere, you just need to load them
[17:01:25] gaussblurinc1: rushed, I try to update old rails application
[17:01:38] bricker: browndawg: I put them in support/shared_examples since that folder gets loaded for other purposes already
[17:01:43] browndawg: bricker: rspec no longer has the default of loading all from spec/supoprt?
[17:01:56] bricker: browndawg: I don't think that was ever loaded by default
[17:02:09] bricker: could be wrong, I always load it myself
[17:02:31] bricker: browndawg: I think the default spec_helper includes a line to load those files
[17:02:38] bricker: maybe that's what you're thinking of
[17:04:14] elaptics: snicers-work: but where are these records going to be returned from - that's what I'm trying to get at. I would think that you should be able to fetch them using a query that will return a relation object that you can then pass into or reference for iterating to generate your csv later
[17:04:36] rushed: gaussblurinc1: is this your application?
[17:05:27] Parker0: I tried everything I could, but cannot resolve "Incorrect MySQL client library version! This gem was compiled for 5.6.23 but the client library is 5.1.61. (RuntimeError)". Can anyone have any suggestion?
[17:05:50] bricker: Parker0: uninstall gem, reinstall gem
[17:05:50] gaussblurinc1: rushed: no, I am not an author, I am maintainer
[17:06:18] Parker0: bricker I didnt gem uninstall mysql2 and then did bundle install -- did not fix it
[17:06:18] rushed: gaussblurinc1: updating applications across major rails versions is generally more complicated then just running a rake task, you might search for some articles on the subject, but it will depend greatly on the complexity/gems/dependencies/etc, one approach is to create a clean application in the new version and integrate the changes into your existing code by hand
[17:06:22] browndawg: bricker: yeah, that is no longer true
[17:07:37] bricker: Parker0: when you 'bundle install', does it re-compile?
[17:07:43] MrPunkin: is there any way in a unit test to assert that a callback was called, if the callback doesn???t change anything locally but instead makes an ActiveResource call to an external API?
[17:08:01] MrPunkin: I don???t necessarily need to test the resopnse from the remote API, but I do need to test that it???s happening.
[17:08:13] Parker0: bricker it doem Installing mysql2, is that what you mean?
[17:08:15] bricker: MrPunkin: put an expectation on whatever method calls the API
[17:08:40] bricker: MrPunkin: eg, expect(YourApiClipent).to receive(:post)
[17:09:14] MrPunkin: bricker: the API is not under my control, can I stil l do this with an external service?
[17:09:28] bricker: Parker0: yes, try installing the gem separately without bundler. Also you may need to downgrade the mysql gem, your version of MySQL client is pretty old
[17:10:11] bricker: MrPunkin: You're just putting an expectation for the method that calls the external service
[17:10:16] Parker0: how do I find the mysql client version
[17:10:26] MrPunkin: bricker: okay, thanks. Sorry, not too familiar with all this testing stuff.
[17:10:29] bricker: Parker0: mysql --version
[17:11:20] bricker: MrPunkin: alternatively you could use webmock and place an expectation on the HTTP request
[17:11:29] bricker: MrPunkin: your decision
[17:12:35] Parker0: bricker I was wondering if mysql client is another library that connects to mysql
[17:13:32] bricker: Parker0: MySQL client is a C library that connects to mysql server. The "mysql" gem is ruby bindings for the MySQL client
[17:13:38] MrPunkin: bricker: do you have any leads on the expectations with rails unit testing? I can???t seem to find it in the guide to testing rails or google searching. Is it another test library I need or something?
[17:14:30] bricker: MrPunkin: which test framework are you using?
[17:14:38] MrPunkin: just the default rails testing, nothing added.
[17:15:24] bricker: MrPunkin: so you'll want to install a mock framework, mocha is fine https://github.com/freerange/mocha
[17:15:42] bricker: MrPunkin: see here: https://github.com/freerange/mocha#testunit
[17:15:52] umdstu: i have a Rails.cache.fetch in two actions in a controller. one of them fetches the data, and the other, requested via ajax, does not return any data. I printed both keys before the fetch and they are identical. Any ideas?
[17:16:30] bricker: MrPunkin: then you'd have something like, YourApiClient.expects(:post).returns("Okay")
[17:16:39] bricker: or whatever the methods are
[17:17:05] bricker: MrPunkin: there's also webmock, which is a mocking framework built specifically for mocking HTTP requests (lets you mock HTTP status, bodies, content types, etc., based on URIs instead of methods)
[17:17:11] bricker: I think it'
[17:17:26] bricker: it's useful to have both webmock and mocha (or your-mock-framework-of-choice)
[17:17:38] MrPunkin: Alright, thanks. Il
[17:17:41] MrPunkin: I???ll look into it
[17:18:48] gaussblurinc1: rushed: ok, but what about application.rb and Rails.application? is it worth to put my application name only in application.rb across other config/ files and use Rails.application everywhere in 4.2?
[17:18:56] Parker0: bricker thanks
[17:19:44] Parker0: bricker I am thinking that my MySQL Client library is of a older version and needs updates..
[17:20:01] Parker0: bricker do you know the name of the mysql client library name on mac ?
[17:21:09] bricker: Parker0: check how you installed it, could be homebrew
[17:21:35] Parker0: bricker installed mysql with homebrew
[17:22:17] bricker: Parker0: so try "brew ugrade mysql"
[17:22:44] dstarh: Anyone know how to redirect after success with a custom devise/warden strategy? We have an handoff token appended to the url and we'd like to redirect after warden authenticates the token.
[17:24:43] godzillaenlacasa: having a problem between local-development and live-staging environments. Change I made to controller work in development, but not staging. Code is uploaded, server restarted, but still not working. What gives?
[17:25:37] godzillaenlacasa: i'm deploying via capistrano, no errors
[17:27:03] bricker: godzillaenlacasa: not enough information
[17:27:13] godzillaenlacasa: have some sorting on line 7 in my controller https://gist.github.com/godzilla74/b95acf039b3b06303f8f
[17:27:22] godzillaenlacasa: works in development, not in staging
[17:27:36] bricker: godzillaenlacasa: what isn't working
[17:27:38] bricker: it's not sorting?
[17:28:09] godzillaenlacasa: bricker yes, line 7 is the sorting line. Works like a charm on my localhost, but once pushed to my staging environment, it's not working anymore
[17:28:24] bricker: godzillaenlacasa: what isn't working
[17:28:26] bricker: it's not sorting?
[17:28:52] godzillaenlacasa: bricker yes, not sorting... in staging
[17:29:06] bricker: godzillaenlacasa: is it returning the wrong order?
[17:29:06] godzillaenlacasa: bricker sorting works find in localhost development
[17:29:37] godzillaenlacasa: bricker it's not in order at all
[17:29:56] bricker: godzillaenlacasa: If you run that query in rails console on your staging server, does it return the correct order?
[17:31:37] godzillaenlacasa: bricker i'm not really that good at console... the code in the gist is in a controller method... how can I run it in console since it depends on other things?
[17:32:25] bricker: godzillaenlacasa: you just need to load the location and then copy the rest of the query
[17:32:57] bricker: Location.find(some_id).network_hosts.includes(network_host_tests: { results: :issue }).order('network_host_tests.security_percentage ASC')
[17:35:14] godzillaenlacasa: bricker returns: #<ActiveRecord::AssociationRelation []>
[17:36:21] godzillaenlacasa: bricker oh wait... let me find a valid location id
[17:44:30] godzillaenlacasa: bricker is there a way to list all table contents from console?
[17:48:01] godzillaenlacasa: bricker ok, got it... returns values, not in order
[17:54:42] godzillaenlacasa: bricker the other thing I am noticing is that the 'security_percentage' is not in the return results array... https://gist.github.com/godzilla74/861bfcd2cb8dcc166d0c
[17:55:06] ianseyer: hey guys. so i have an activerecord implementation of an object called Location, which has_many Reviews. Is there a way, when I retrieve a Location record, to also pull its associated reviews?
[17:55:27] ianseyer: so instead of having to return both Location and Location.reviews, just have Location always pull Location.reviews as well?
[17:56:01] godzillaenlacasa: ianseyer not an awesome rubyist, but I think you can use associations and an includes()
[17:56:49] godzillaenlacasa: so in your Locations model: has_many reviews
[17:57:19] godzillaenlacasa: ianseyer in your Reviews model belongs_to location
[17:57:28] bricker: godzillaenlacasa: because security_percentage is in another table, "network_host_tests", you're return objects from the "network_hosts" table
[17:57:53] bricker: godzillaenlacasa: How do you know it's not in order? It's ordering by "network_host_tests.security_percentage", how can you tell it's out of order?
[17:58:12] godzillaenlacasa: bricker but shouldn't the includes() preload the network_host_tests table contents?
[17:58:40] bricker: godzillaenlacasa: yes it loads the associations but doesn't return those objects
[17:59:00] godzillaenlacasa: bricker in the view, I actually display the seurity_percentage, so they are coming up in order like ,99, 0, 4, 33, 99, 0, 0, etc.
[17:59:11] bricker: godzillaenlacasa: how can you tell from the console?
[17:59:31] godzillaenlacasa: bricker I can't... i'm comparing to what i see in the view and it's in the same order
[18:00:06] bricker: godzillaenlacasa: add to_sql to the query to see what the actual database query is, maybe you have a default order you're forgetting about
[18:00:49] ianseyer: godzillaenlacasa: includes()? how so. I already have the has_many relation functioning via `references`
[18:01:05] godzillaenlacasa: bricker https://gist.github.com/godzilla74/6231230851eb1e09b401
[18:03:18] godzillaenlacasa: ianseyer Full disclosure: I'm still learning exactly how it works, but I have something similar... @network_hosts = @location.network_hosts.includes(network_host_tests: { results: :issue })
[18:03:54] godzillaenlacasa: ianseyer network_hosts_tests belongs_to network_hosts
[18:04:06] bricker: godzillaenlacasa: dunno, can't do much more debugging for you
[18:04:26] godzillaenlacasa: bricker so the sql query looks ok?
[18:04:27] bricker: godzillaenlacasa: my guess is that you're just looking at the wrong thing
[18:05:03] godzillaenlacasa: bricker i just don't get why it works fine in development, but not an actual deployed server
[18:05:15] bricker: godzillaenlacasa: you're asking it to order by networks_hosts_test.security_percentage, so there's no reason it wouldn't do that. Either you're re-ordering after the results come back or it's in the correct order and you're just looking at the wrong thing
[18:05:22] bricker: godzillaenlacasa: different data probably
[18:05:57] scientist1642: I'm trying to make a rails app template for my initializer, but the interpolation string inside <<-CODE CODE doesn't escape and it causes an error, any idea what to do? is there something like <<-RAWCODE
[18:07:14] godzillaenlacasa: ianseyer then I iterate through @network_hosts in the view
[18:08:06] ianseyer: godzillaenlacasa: hmm. i'm returning JSON blobs, so it'd be really nice if every Location record simply already included it's associated reviews, so I could just return Location.to_json
[18:08:37] godzillaenlacasa: ianseyer oh, i can't help much there... haven't dove into json yet
[18:10:03] tubbo: scientist1642: you could use an ERb template
[18:10:15] tubbo: interpolation in ERB is done by <%= and %> so #{} is safe
[18:11:14] godzillaenlacasa: bricker do you think using a joins() would be better so i can see the full results?
[18:13:29] scientist1642: tubbo: just to make sure we are on the same page, I'm talking about rails application template http://guides.rubyonrails.org/rails_application_templates.html
[18:14:13] tubbo: scientist1642: yeah, we're on the same page. for example, here's how i generate my Gemfile: https://github.com/tubbo/rails-template/blob/master/share/rails-template/templates/Gemfile.erb
[18:14:34] tubbo: the actual app template is here.. https://github.com/tubbo/rails-template/blob/master/share/rails-template/generator.rb
[18:15:01] Synthead: I have a controller that I want to always render a common template. Is there a single line I can put in it so I don't have to repeat "render template: "foo"" ?
[18:21:02] tubbo: %w(index new show edit create update destroy).each { |action define_method(action) { render template: 'foo' } }
[18:21:07] tubbo: also don't do that
[18:21:22] tubbo: |action|*
[18:21:42] jhass: mh, after_action ? :P
[18:24:40] smathy: Synthead, sometimes it's simpler to just wear the repetition,.
[18:26:06] scientist1642: tubbo: thank you that will be very useful, but actually I want #{smth} to be inside the code and not to be evaluated beforehand
[18:33:34] tubbo: scientist1642: !gist your app template as it stands and let's see what you're trying to do. there are a few different ways of interpolating strings in ruby.
[18:33:34] helpa: scientist1642: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[18:34:12] xibalba: If i call render in a loop, can I flush the page's contents on each iterations of the loop?
[18:48:56] rhizome: do what now?
[18:55:34] djellemah: xibalba: content = render(whatever); response.stream.write content
[18:55:52] xibalba: oh thank you i'm going to check that out
[18:56:32] djellemah: xibalba: I think you also need a server that supports it, ie not webrick. Works for me with puma.
[19:05:18] ianseyer: hi all! looking for a way to have a record query automatically include associated records. e.g. I have a Location object which has_many Reviews. I have tried Location.includes(:reviews).first, but it is not pulling any of my records (which do exist at Location.reviews)
[19:13:15] Sou|cutter: If your actual use case is using .first it's the same amount of queries
[19:13:47] ianseyer: Sou|cutter: it's not
[19:13:48] kara_sweets: hey guys, i have a form that has checkboxes, I'm starting to see a limitation in how rails handles validating checkboxes and even how to handle the value when it's stored ( store as an array or parse array in controller and create 1 value). does anybody have suggestions on how to handle?
[19:14:04] ianseyer: rhizome: @location = Location.includes(:reviews).find(params[:id])
[19:14:16] elaptics: kara_sweets: !gist
[19:14:16] helpa: kara_sweets: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:14:25] ianseyer: rhizome: (this is in the context of an API, so GET /locations/15)
[19:14:38] ianseyer: rhizome: putting @location is the exact same as Location.find(15)
[19:14:47] rhizome: ianseyer: with you so far
[19:14:49] kara_sweets: elaptics: not sure the code would help much, this is more theoretical / strategy
[19:14:57] rhizome: kara_sweets: you know the routine by now
[19:15:18] ianseyer: rhizome: however, Location.find(15).reviews has a lot of content that is not displayed by @location
[19:15:25] kara_sweets: rhizome: haha ya, i just think too much info might actually make things more complicated
[19:15:37] elaptics: kara_sweets: we'll be the judge of that :)
[19:15:38] Sou|cutter: ianseyer: What are you expecting exactly? You access the reviews through @location.reviews
[19:15:59] scientist1642: ok I am just trying this http://pastebin.com/z9v6cc82, and want the code to show up in log_formatting.rb
[19:16:15] ianseyer: Sou|cutter: i'm constructing an API, so I want a JSON blob of the Location record and all it's associated records. I would like @location.to_json to include all the reviews inside of it
[19:16:16] elaptics: kara_sweets: I'm not sure I know what you mean by validating checkboxes and what are the checkboxes even for in this case?
[19:16:28] smathy: ianseyer, what makes you think that the associated records aren't being queried?
[19:16:31] rhizome: ianseyer: @location by itself isn't going to do that.
[19:16:38] elaptics: kara_sweets: can't really advise how to store things without knowing what the things are
[19:16:40] ianseyer: smathy: because they aren't showing up?
[19:17:08] smathy: ianseyer, so after you do the above, if you do @location.reviews you get nothing? Or they're not showing up in the .to_json ?
[19:17:11] rhizome: use a json formatter to construct the json you'd like to see. also look at implementing an as_json method, but most just use rabl or something
[19:17:12] ianseyer: rhizome: ah. then i'm misunderstanding includes. to leapfrog over a few questions: is there a way to make the default to_json representation include columns?
[19:17:15] ianseyer: smathy: the to_json
[19:17:21] scientist1642: https://gist.github.com/scientist1642/7383e9377b77763427d0
[19:17:25] ianseyer: rhizome: i see
[19:17:38] rhizome: json templating basically
[19:17:43] ianseyer: so includes simply constructs the query, but to_json still only DISPLAYS the default attributes
[19:17:56] scientist1642: the question is how to escape interpolation
[19:18:06] rhizome: well, it'll display the thing that to_json is called on
[19:18:18] smathy: ianseyer, right, so you need to add an :include to the `to_json` method, ie. @location.to_json include: :reviews
[19:18:41] rhizome: also that, but you might want to pare down what's returned
[19:18:59] ianseyer: smathy: that was it
[19:19:04] ianseyer: rhizome: i think i'm going to dip my toes into rab
[19:19:38] _blizzy_: so, what server do you all recommend?
[19:20:06] tubbo: _blizzy_: like app server (thin/unicorn/puma/etc.) or static web server (nginx/apache)?
[19:20:22] ianseyer: thanks guys
[19:20:38] smathy: ianseyer, what the Location.includes(:reviews) does is prevent a whole bunch of individual sub-queries for each location later.
[19:20:46] _blizzy_: tubbo, app.
[19:20:56] _blizzy_: also, what's the difference between app server and static web server.
[19:23:04] ianseyer: smathy: right right, i assume it went a few steps further as well! but i understand now
[19:31:02] joelbrewer: is it bad form to save state in an active record model? For example, I'm modeling a parking lot. I've got an Occupation model with parking_spot and start_time attributes. I am using it to keep track of all vehicle occupations in the parking lot. However, I need to keep track of the state of parking spots. They can be either occupied or unoccupied. Should I put a "status" attribute on my ParkingSpot
[19:31:08] joelbrewer: model, and update that whenver an Occupation is created/modified? Or is there a better way?
[19:36:59] Advocation: joelbrewer: can???t you tell occupied spaces from start_time having a value and then an end_time attribute?
[19:37:57] _blizzy_: so, what app server do you all recommend for rails?
[19:38:34] joelbrewer: Advocation: yeah, I could. However, doesn't that require me to query the db unnecessarily?
[19:39:16] joelbrewer: Advocation: Because yes, that would certainly be easier. It might be hard to keep the status in sync otherwise.
[19:39:34] Advocation: joelbrewer: you???re going to have to query the DB for the status anyhow..
[19:40:52] joelbrewer: Advocation: lol. true.
[19:43:26] fryguy: _blizzy_: i'm using passenger in production right now, if i had a choice on a new project i'd probably just use puma
[19:43:43] _blizzy_: fryguy, oh ok, thanks.
[19:45:25] joelbrewer: I recently switched all the apps I could to puma.
[19:46:32] fryguy: the app i work on is (probably) not threadsafe so i haven't bothered to push to get it migrated yet. we are in the process of doing a big threadsafety audit so we can switch to sidekiq. after that is done will probably push for it more
[19:46:33] rhizome: what differences did you notice?
[19:50:45] tubbo: _blizzy_: i like puma, it runs fast in development and you can use it in production easily.
[19:50:56] kara_sweets: elaptics: you still around?
[19:50:59] _blizzy_: tubbo, I wish I could use it in production.
[19:51:03] _blizzy_: #WindowsLife
[19:51:20] tubbo: _blizzy_: and the main difference is that nginx/apache can't run ruby apps :D but they are good at serving static assets and proxying from the web to your app server, which runs as its own user and has less security overhead
[19:51:24] elaptics: kara_sweets: yep
[19:51:35] tubbo: _blizzy_: you're trying to run your rails app in production on windows?
[19:51:43] _blizzy_: tubbo, no, development on windows.
[19:51:46] _blizzy_: production on heroku.
[19:51:56] _blizzy_: I meant to say development, lol.
[19:51:56] tubbo: i think heroku lets you use puma
[19:52:08] _blizzy_: yeah, it does, I just need to be able to use it in development.
[19:52:13] _blizzy_: I have to keep commenting it out.
[19:52:43] tubbo: _blizzy_: just add it to group :production in your Gemfile so it won't get included unless RAILS_ENV=production
[19:53:04] tubbo: there's nothing wrong with using webrick locally and something like passenger in production
[19:53:28] _blizzy_: I did. it still says that I need to install puma when I run rails server.
[19:53:32] tubbo: fryguy: ugh...we just dealt with some nightmare shit regarding thread safety
[19:53:39] scientist1642: what are this things called <<-CODE <<-RUBY <<-SQL I cant find the docs via google
[19:53:50] _blizzy_: also, thanks for the info, tubbo.
[19:54:23] tubbo: tldr: sidekiq is threaded, elasticsearch-rails is not thread safe
[19:54:27] tubbo: _blizzy_: huh?
[19:54:30] tubbo: scientist1642: HEREDOCs
[19:54:37] tubbo: they're a unix convention but yeah a little hard to google for
[19:54:49] _blizzy_: tubbo, you explained nginx/apache vs puma and stuff.
[19:55:12] tubbo: oh never mind i thought you were asking another question after that :D no problem
[19:56:33] scientist1642: tubbo: oh hi and thanks again, :D that was what I was trying to say previously sorry I was late https://gist.github.com/scientist1642/cb86ae3d7715535b37ec
[19:58:14] joelbrewer: _blizzy_: why not use a linux VM?
[19:58:35] _blizzy_: joelbrewer, not worth the time imo.
[19:59:10] snicers-work: If I want to pass a date at the end of my route to filter my model data how would I do that (e.g. mysite.com/model/date)?
[19:59:28] frank_o: I just added delayed_paperclip + delayed_job_active_record to my Rails app, but for some reason, it only enqueues my jobs but never actually runs them. Am I missing something? https://gist.github.com/dt1973/6b65794bf677e8753bdb
[20:00:42] joelbrewer: _blizzy_: time after time I hear problems folks encounter trying to develop on windows. the time it takes to setup a linux vm is time well spent in my opinion
[20:00:52] _blizzy_: joelbrewer, true, true.
[20:01:38] joelbrewer: _blizzy_: :) It'll save you from plenty headaches in the future.
[20:02:45] Senjai: Developing on windows is a terrible idea unless your developing for windows #ruleofthumb
[20:03:41] snicers-work: is it possible to pass a date (or any string other than id) in the rails routes/
[20:03:57] pothibo: snicers-work: not a date object, but you can break it down
[20:04:35] pothibo: match /:year/:month, as: ???test??? =>??test_path(date.year, date.month)
[20:04:38] _blizzy_: joelbrewer, yeah.
[20:05:03] snicers-work: pothibo, it is not an object, just a string
[20:05:20] snicers-work: do I use match?
[20:05:36] pothibo: well, why don???t you paste your routes.rb and we go from there?
[20:05:36] scientist1642: tubbo: I found the solution tom http://makandracards.com/makandra/15003-how-to-ruby-heredoc-without-interpolation thanks anyway
[20:05:51] snicers-work: mysite.com/model/20150325 is what I want
[20:06:14] tubbo: scientist1642: oh that's cool
[20:06:45] snicers-work: something like this: https://gist.github.com/anonymous/4606b755f7fbaeec2955
[20:07:25] scientist1642: tubbo: if not keyword "heredoc" I woulnd't be able to :D
[20:17:16] rubyonrailed: Say i have a has_many relationship like this foo.bars. Whats a quick way to just return all of the bar ids?
[20:19:16] rubyonrailed: nvm, my code was broken, thats why foo.bar_ids wasn't working
[20:21:21] momomomomo: (just need the link)
[20:21:22] helpa: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[20:32:02] kalebe: hi, i have this on my config/application.rb: config.autoload_paths << Rails.root.join('lib').... but one of my module files does not load... and it is just like the others... i'm a doing something wrong?
[20:40:08] Giddeon: Is there a way to get ahold of the current instance of ApplicationController?
[20:42:56] tubbo: Giddeon: usually ApplicationController is not instantiated, but `controller` will give you the currently instantiated controller.
[20:43:54] aarkerio: is there a way to change the output in the rails console?, like in: newls = Newsletter.where('id >40').select(:title)
[20:44:25] aarkerio: I mean, visually
[20:47:06] aarkerio: the output is hard to read
[21:01:16] develgeek: I've looked for an answer to my question but can't seem to find it... I have a `before_action` call within `ApplicationController` that with an `:except` option for `:index` action. Inherited controllers with `:index` action are being excluded as well. How do I target just the action in `ApplicationController`?
[21:03:06] fryguy: develgeek: don't put routable actions in parent controllers
[21:04:02] kalebe: my lib/* modules load and i can include them but it say there is no methods and cant use any of them... what could it be?
[21:04:39] develgeek: Hm, ok so just create a subclass that has `index` action and include a `skip_before_action` call in it?
[21:06:43] fryguy: develgeek: sure
[21:08:26] develgeek: fryguy: Thanks
[21:09:26] thaumer: hi, I have my new method I want to show in the home page, so I have my method: def showLast { @reviewL = Review.last }, my route "get '/' => 'reviews#showLast' and in the view: <%=raw @reviewL %> but nothing appears on the page
[21:09:54] thaumer: why? thanks in advance
[21:18:44] bricker: thaumer: What do you expect it to show?
[21:19:49] thaumer: the last review (model) record in my database
[21:20:35] fryguy: thaumer: and what is the contest of the last review model
[21:20:41] Giddeon: When I call helper_method inside a controller, where do those helper methods get defined?
[21:20:58] fryguy: Giddeon: in the view
[21:21:26] Giddeon: frygy: they're accessible in the view, but they have to defined somewhere. Some module is probably holding them
[21:22:13] joelbrewer: is it possible to make a custom validator that isn't tied to a specific attribute?
[21:23:23] fryguy: Giddeon: they are defined in the controller
[21:23:29] bricker: joelbrewer: example?
[21:23:31] thaumer: fryguy: I'm new to rails, sorry, what do you mean with 'contest' in relation to the model?
[21:23:42] fryguy: thaumer: contents
[21:23:57] fryguy: joelbrewer: just create a method and call validate with it
[21:24:14] fryguy: joelbrewer: http://guides.rubyonrails.org/active_record_validations.html#custom-validators
[21:25:30] joelbrewer: bricker: Well, I've got two models, Occupation and ParkingSpot. Occupation belongs to ParkingSpot. I need a validator on Occupation that checks the status of the ParkingSpot. If the status is "occupied" the validation should fail.
[21:25:46] thaumer: fryguy: 'name'(string), 'permalink'(string), 'content'(text)
[21:25:53] ackpacket: So... I have courses, enrollments and users. A user can be enrolled in a class as either a teacher or a student. Is this a reasonable way to get a list of all students in a course? self.enrollments.select |role| {role.student?}.map |role| {role.user}
[21:25:58] fryguy: thaumer: no i mean what is the actual contents of the last record
[21:26:16] joelbrewer: I want to add a generic error that says "You cannot create an occupation when the parking spot is occupied"
[21:26:46] thaumer: from my console: review=Review.last
[21:26:46] thaumer: Review Load (2.3ms) SELECT "reviews".* FROM "reviews" ORDER BY "reviews"."id" DESC LIMIT 1
[21:26:46] thaumer: => #<Review id: 5, name: "quinta", permalink: "5review", content: "quintarecensione\r\n"
[21:26:59] joelbrewer: from what I can tell though, an error has to be associated with a certain field
[21:27:00] bricker: joelbrewer: yep, you can do that
[21:27:09] fryguy: ackpacket: you'll probably want to define a scope on enrollments so that you can do self.enrollments.students.map(&:user)
[21:27:14] bricker: joelbrewer: no, you can just call a method
[21:27:26] ackpacket: fryguy: sorry, define a scope?
[21:27:27] bricker: joelbrewer: http://guides.rubyonrails.org/active_record_validations.html#custom-methods
[21:27:42] bricker: joelbrewer: use errors.add(:base, "message")
[21:27:45] fryguy: ackpacket: http://guides.rubyonrails.org/active_record_querying.html#scopes
[21:27:50] ackpacket: fryguy: tbh, I barely understand what you wrote =\
[21:29:02] ackpacket: fryguy: what is that map syntax? &:user
[21:29:09] ackpacket: fryguy: is that shorthand for a lambda?
[21:29:25] fryguy: specifically a proc, not a lambda, but close enough
[21:29:51] fryguy: map(&:user) is the same as map {|x| x.user}
[21:29:53] joelbrewer: bricker: nice! didn't know about the :base option
[21:30:13] Scriptonaut: is there a way to make aliases for partials?
[21:30:35] bricker: Scriptonaut: why?
[21:30:43] crzrcn: Is it possible to detect if a model's destroy method was called directly or from an owner model?
[21:30:49] ackpacket: fryguy: oh, then this seems reasonable: self.enrollments.select(&:student?).map(&:user)
[21:30:53] Scriptonaut: I have an _account.html.erb partial, but I have this script that calls partials automatically, and it is going to call a _quick_search_result.html.erb file
[21:31:07] Scriptonaut: I could just render account inside of quick_search_result
[21:31:09] thaumer: fryguy: what about the contents? pasted them
[21:31:11] fryguy: ackpacket: sort of
[21:31:15] Scriptonaut: bricker because in the end it saves me having to write hundreds of lines of code
[21:31:19] fryguy: thaumer: i don't know, looks right, post a gist or something
[21:31:29] fryguy: ackpacket: that'll do a lot more work than you need to do
[21:31:29] Scriptonaut: I just do this: <%= render partial: "/#{ActiveModel::Naming.plural(result)}/quick_search_result", object: result, as: result.class.name.downcase %>
[21:31:44] Scriptonaut: since result could be any model
[21:31:53] bricker: I still don't see why you need an alias
[21:31:53] Scriptonaut: that include my QuickSearch module
[21:32:10] fryguy: Scriptonaut: so create a helper method to do that for you
[21:32:12] Scriptonaut: because quick search is going to look for quick_search_result, and I already have an account partial which has what I want
[21:32:46] Scriptonaut: fryguy, a helper that does what?
[21:32:52] fryguy: Scriptonaut: calls render for you
[21:32:54] Scriptonaut: sees if there is already a partial named after the method in the directory?
[21:33:03] bricker: Scriptonaut: please keep in mind that you are the only person here who wrote and is looking at your code
[21:33:15] fryguy: def render_quick_result(result_model) or something
[21:33:21] Scriptonaut: I just thought there might be a cool rails alias
[21:33:32] fryguy: just make your own, it's like 2 lines of code
[21:55:25] intuxicated: somehow, after_update callback method is triggered by save method , pfff
[21:55:58] thaumer: fryguy: if I create a showLast.html.erb view and put <%= @reviewL.content %> in it it works, but I want the <%= %> in the index.html.erb, my home page
[21:56:44] joelbrewer: can I use has_one even if it isn't a one-to-one relationship?
[21:57:16] joelbrewer: for example, a want ModelA to have_one ModelB. However, multiple ModelAs could have the same ModelB
[21:58:15] intuxicated: This is my model, https://dpaste.de/uoqh , any idea why update_storage called when new object created ?
[22:00:03] intuxicated: joelbrewer, I think you can, but I'm not sure this is the right way to implement this kind of relations
[22:01:36] intuxicated: hm, I figure it out.
[22:03:21] smathy: joelbrewer, "multiple ModelAs could have the same ModelB" can only happen if the foreign key is on the ModelA side, and therefore your ModelA should be a `belongs_to :model_b`
[22:03:54] smathy: joelbrewer, in which case the reverse association, in ModelB will be: `has_many :model_as`
[22:18:15] frank_o: Hey! Anybody know why my delayed_job_active_record (delayed_paperclip) jobs get enqueued but never actually run? Am I missing something fundamental? https://gist.github.com/dt1973/6b65794bf677e8753bdb
[22:23:41] ramfjord: frank_o: are you running a worker?
[22:24:38] frank_o: ramfjord: nope
[22:25:07] frank_o: ramfjord: I'm using delayed_job_active_record for other stuff in other models and there they "just work"
[22:25:28] frank_o: ramfjord: besides i thought workers were only needed for delayed_job, not delayed_job_active_record?
[22:26:14] ramfjord: frank_o: I'm not familiar with that gem, but conceptiually that code needs to run in some process right?
[22:27:19] frank_o: ramfjord: not really sure what happens
[22:27:45] ramfjord: I would try starting up a worker like delayed_job does
[22:27:59] frank_o: ramfjord: i know delayed_job_active_record adds a db field and uses that but.. could be the process is all within active record or something
[22:28:26] ramfjord: active record is code, not a process. Would it be your server running the code?
[22:28:43] frank_o: i did actually.. installed delayed_job and ran `bin/delayed_job start` but no luck so far, i can try again though
[22:29:59] ramfjord: are you passing in a different queue for your existing workers?
[22:30:48] makerops: do a rake -T
[22:30:57] makerops: should show rake job:work
[22:33:06] frank_o: one sec please
[22:34:14] frank_o: now my jobs run!
[22:35:12] frank_o: didnt work before when i tried it, but then i had some errors stuck in my job queue.
[22:35:32] frank_o: anyway whats the deal here, do I have to run `rake job:work` every time a user uploads something via paperclip? :S
[22:37:37] frank_o: thanks a lot ramfjord, makerops .. makes sense that delayed_job_active_record alone can't handle this since paperclip requires external tools like imagemagick..
[22:45:58] loglaunch: has any more information regarding the rails-api been released yet?
[22:46:13] ackpacket: I'm trying to very very temporarily check something by overriding the method in a model but... I forget the ruby syntax for that. Can I just do def my_obj.fn = {} ??
[22:46:22] ackpacket: er... without the =
[22:46:23] loglaunch: for creating API only platforms
[22:48:26] tubbo: loglaunch: seems like things are moving along.. https://github.com/rails-api/rails-api
[22:48:41] tubbo: was something supposed to happen?
[22:48:43] frank_o: Can anyone tell why I'm getting `Paperclip::Errors::InfiniteInterpolationError` for `photos.rb`? https://gist.github.com/dt1973/a97a167c21d07e3252a9
[22:49:35] loglaunch: tubbo is this the same thing that David talked about on the Change Log podcast?
[22:50:59] tubbo: loglaunch: oh i'm not sure, didn't even know they were talking about that
[22:51:18] tubbo: loglaunch: but rails-api is really just a set of conventions in many ways
[22:51:24] tubbo: it's using the same stuff just omitting a lot
[22:51:41] tubbo: so maybe rails 5 will include more configuration for removing stuff so you don't need to use rails-api?
[22:52:01] loglaunch: tubbo ah k, he mentioned that one of the next features for rails 5 would be better support for making API only
[22:52:26] loglaunch: Is there a roadmap anywhere?
[22:52:37] tubbo: you'd have to check rails/rails on github for that stuff
[22:52:42] tubbo: the issues page might have some info
[22:52:51] loglaunch: is rails 5 being developed on master?
[22:53:43] tubbo: loglaunch: imo rails already has this support for client-side MVC, but it might not be quite as easy to understand for most people
[22:54:11] tubbo: like ActionController::Base for example is comprised of a bunch of modules. you could theoretically create your own base class and include just the AC modules you want in it without extending AC::Base
[22:54:17] loglaunch: I guess its more about having good defaults for API only
[22:54:20] tubbo: which is what rails-api does
[22:54:36] tubbo: i'd also like to see the removal of app/assets
[22:54:48] tubbo: instead, give autoloader a blacklist, put all the shit in app/
[22:54:56] tubbo: app/javascripts, app/stylesheets, etc.
[22:57:08] loglaunch: whats the recommended json web token gem for protecting an API in rails?
[23:26:25] frank_o: loglaunch: dont people use SecureRandom or something like that?
[23:34:07] tubbo: i usually turn vim on "insert" mode and let my cat walk around on the keyboard for a while to generate my secret tokens
[23:41:46] smathy: ACTION feels a little foolish now using `rake secret`
[23:42:29] smathy: I suspect loglaunch actually wanted a gem to do it all for him, like the auth gems for non-API UIs.
[23:48:54] frank_o: tubbo: lol
[23:50:03] frank_o: ACTION looks up king tubby on soundcloud