Page 1 of 1
[23:33:35] CalvinnHobbes: Hi all, if I want to eager/pre-load the associations on a model object that has already been found. What is the best way?
[05:10:38] CalvinnHobbes: Hello all: I was wondering if it was bad practice to use devise methods signed_in?/current_user within models(non-User model). E.g. I want to set an association between the model and the current_user in a :before_create filter
[18:54:45] CalvinnHobbes: Have a general schema question: I have an app where I have data versus time, that I am eventually going to plot. Lets say temperature in celsius and revenue in dollars. Should I create two models/tables (Temperature, Revenue) or one model such as Data?
[04:44:57] CalvinnHobbes: hello all! is there something special about the before_destroy that prevents a model that is about to be destroyed from updating its parent?
[04:47:43] CalvinnHobbes: I set up a method that gets called by :before_destroy. The method does an update on on the parent of the model. When I go to rails console it shows the update being called in SQL and then the delete being called in SQL, then it returns the model that was deleted
[04:49:02] CalvinnHobbes: Yakko: pretty much. The parent keeps a count of how many children it has. When of the children is about to be deleted, I want to decrement the parent's count
[00:00:05] CalvinnHobbes: I came up with a function in the controller but there has to be an easier or smarter way
[00:07:53] CalvinnHobbes: gwillen: yes. So should I write a method that returns the appropriate where depending on whether params contains a id for "A" or "B"
[23:51:53] CalvinnHobbes: hi all! What is the proper way to do filtering, particularly filtering by an associated model? I've read scopes and "where", but they seem to be out of date or not the proper way to do it?
[23:57:29] CalvinnHobbes: sergiocampama: A has_many C, B has_many C. B belongs_to A & C. On the index function of Cs controller, I am trying to get all B when you provide the id to either an "A" or a "C"
[23:59:18] CalvinnHobbes: "On the index function of Cs controller, I am trying to get all "C" when you provide the id to either an "A" or a "B" in the params"
[06:53:47] CalvinnHobbes: Is it bad form to create a different type of model within a Model. E.g. if ModelA has_many ModelB is it a bad idea to have methods in ModelA that build ModelBs?
[06:55:58] CalvinnHobbes: isn't the has_many a coupling in itself? in my case if B can't exist without A, there is an inherit coupling?
[06:57:52] CalvinnHobbes: I was going to use the build function but just call that within a method of ModelA
[07:05:18] CalvinnHobbes: I'll just describe it. I have product and users can vote on it. I need to make sure users only vote once, and products keep track of how many positive or negative votes they got. So Votes belongs_to users and products. Currently I am doing the voting logic in the controller, but I was going to move it to the Product Model
[07:09:14] CalvinnHobbes: OffTheRails: haha, so that seems a bit over my head. Can you gimme a sentence or two about what you mean? I only have run into redis when I was setting up gitlab and im not quite sure what it does
[07:20:18] CalvinnHobbes: is it a NoSQL type of thing? I am new... and have only be working with this stuff for ~4 mos trying to learn in my off time
[07:22:30] CalvinnHobbes: coutner cache columns just store the previous count query, correct? I saw a few gems with conditions. I'll probably try to implement it wihout a gem for the learning experience
[07:25:10] CalvinnHobbes: OffTheRails: I as writing tests for Product.vote_with_user when I thought "maybe I am doing this wrong"
[07:27:08] CalvinnHobbes: OffTheRails: great, thank you. Much appreciated for the advice when I am feeling lost
[07:34:59] CalvinnHobbes: TwinkleHood: this : https://blog.linode.com/2013/04/16/security-incident-update/ ?
[07:43:22] CalvinnHobbes: The question is, is DO any better since they are a much newer product than linode
[07:44:08] CalvinnHobbes: thats what I am saying, newer in the sense that they just aren't big enough or enough time passed to be exploited
[16:51:22] CalvinnHobbes: would someone be willing to help me out with a failing rspec test? I can't figure out why it is failing because everything seems to work alright in rails console. I have a pastebin
[19:38:47] CalvinnHobbes: can someone tell me how to properly implement ActiveModel::Dirty on a ActiveRecord::Base class? I just want the changed/changes methods?
[18:29:54] CalvinnHobbes: if I have a client side js that calculates a hidden form value, should I have a server side function that checks/recalculates the value? Otherwise I can't test it with capybara?
[21:08:45] CalvinnHobbes: I'm on rails 3.2: how do I define a stylesheet for a single page. E.g. home page has its own style sheet. I'm using sass, btw
[21:16:55] CalvinnHobbes: So is there no way to specify a single scss/css file in the asset pipeline for a single page (controller action)? Should I just make the css part of the controller's css file?
[00:04:47] CalvinnHobbes: how do you create temprary variables in a form that will be manipulated by controller to eventually fill in model variables? I.e. I was two serperate selectors one for height ft, the other height inches. I want to pass these two numbers, do a conversion, and have the model store only height(cms)
[00:07:14] CalvinnHobbes: right, but when I goto edit, it gives me an error saying height_in doesn't exist for the model. Which it doesn't
[19:22:45] CalvinnHobbes: quick question: I have a before_filter that appears to be filtering out actions properly for get requests (index/edit) but none of my put requests are being properly filtered. At least according to my rspec tests. Does anybody know why this would be?
[19:47:37] CalvinnHobbes: One more try: I have a before_filter that appears to be filtering out actions properly for get requests (index/edit) but none of my put requests are being properly filtered. At least according to my rspec tests. Does anybody know why this would be?
[08:37:23] CalvinnHobbes: Whats the best way to set up a database that has this model: Data Type A and Data Type C are a Many-To-Many relationship. However, each "A" has a certain amount "C". I.e. say I need to know that a specific type of "A" has 3000 "C", where should that be stored?
[08:41:32] CalvinnHobbes: sorry Im not communicating well. How would you store extra information about a specific many-to-many relationship? As a third column in the pivot/join table?
[08:44:50] CalvinnHobbes: so it is ok to have more than just the two keys in a bridge/join table? For some reason I thought that was bad practice
[20:07:40] CalvinnHobbes: is it possible for embedded ruby to alter html in an embedded ruby page that exists outside of <% %>. As a trival example, could you make a gem or call that modified text within a paragraph block?
[20:11:48] CalvinnHobbes: I want to do a "dynamic" find and replace on text... but I suppose the best way would be to store the text as an AR/Model and then do it. No point in having it be static in a view?