Activity Graph

Page 1 of 2 | Next »


[17:13:22] roychri: has joined #RubyOnRails
[17:13:22] roychri: has joined #ruby
[17:17:31] roychri: has left #ruby: ()
[17:17:34] roychri: has left #RubyOnRails: ()


[16:25:45] roychri: has joined #RubyOnRails
[16:25:45] roychri: has joined #ruby
[17:42:32] roychri: Quit: And that's the way the cookie crumbles!


[18:48:50] roychri: *.net *.split


[15:25:25] roychri: has joined #RubyOnRails
[15:25:25] roychri: has joined #ruby


[20:45:17] roychri: Ping timeout: 240 seconds


[23:53:01] roychri: has joined #ruby
[23:53:02] roychri: has joined #RubyOnRails


[09:37:34] roychri: Ping timeout: 255 seconds


[15:07:43] roychri: has joined #RubyOnRails
[15:07:43] roychri: has joined #ruby


[01:04:20] roychri: has joined #ruby
[01:05:49] roychri: Is there an elegant way of handling exception from different ruby version? I see this open source project rescuing from Net::OpenTimeout which is a ruby 2.x but that project tries to be compatible with 1.9.3 too. I'd like to do a PR with a fix. Any recommendations?
[01:08:46] roychri: sounds interesting.... ok, I will take a look, thank you
[01:09:57] roychri: Sounds simple enough, I will try it :) Thank you
[18:22:45] roychri: Quit: And that's the way the cookie crumbles!


[15:49:39] roychri: se trying to run the commands as root which is NOT what I am doing). Any pointers?
[15:49:39] roychri: Hello! I installed rvm and I want to run a command on boot as an unpriviledge user. I created a file in /etc/rc.d/ and I use "su - someuser -c /path/to/rubyscript.rb" and inside that /path/to/rubyscript.rb file I put a shebang line pointing to the rvm ruby (there might be a better way) I am trying to find information about how to do this but all I can find is instructions not to use "sudo" with rvm (the documents talk about tho
[15:50:19] roychri: right now the scritp cannot find the gems I installed on the someuser account


[21:09:06] roychri: Hello, I am looking for a Partner to perform a WASA (Bowling Game from Uncle Bob, part I). Anyone???
[21:20:02] roychri: a Wasa is a two person Kata
[21:20:18] roychri: one does the unit test and the other the implementation
[21:20:30] roychri: A kata is a practice session
[21:20:46] roychri: We implement someting that we know the solution for
[21:20:54] roychri: in order to practice our craft
[21:21:31] roychri: Getting common solution into our subconcious so we know how to solve them faster when faced with them in real production time
[21:21:38] roychri: getting us to be better :)
[21:22:32] roychri: artists carry a sketchpad, musicians play technical pieces, poets constantly rewrite works... We should practice too :)
[21:23:37] roychri: tubbo: in short, I am looking for a partner to practice by doing something we already know how to solve, just to get better at it the more we practice it.
[21:23:48] roychri: tubbo: make sense?
[21:24:54] roychri: tubbo: what do u mean?
[21:52:25] roychri: how far apart can I repost the same message in the channel so its reasonnable? (I dont want to annoy anyone)
[22:07:09] roychri: How far apart can I repost the same message in this channel so its reasonnable? (I dont want to annoy anyone)


[12:57:10] roychri: I am reading a ruby best practice article and there is something I am not sure about. Someone asked a question about why some method had
[12:57:16] roychri: def changed?; if defined? @observer_state and @observer_state; true; else; false; end; end
[12:57:26] roychri: rather than simply: def changed?; defined? @observer_state and @observer_state; end
[12:57:51] roychri: The answer to that question was: There is a logical boolean purity issue here, in that some folks are conservative and only want actual true and false objects to be returned from a method that ends with a question mark (to avoid possible side-effects)
[12:58:09] roychri: and I am wondering what type of side-effects the author could mean...
[12:58:13] roychri: anyone know?


[02:52:38] roychri: I am looking for instructions on how to ge tthe Fixnum#hours and Fixnum#minutes (that are part of rails) into a script that is not part of Rails. Do I have to simply include some module?
[02:53:15] roychri: tubbo: I would have to include the whole active_support shebang?
[02:54:05] roychri: tubbo: I'll check it out
[02:54:44] roychri: active_support/core_ext/integer.rb probably
[02:57:31] roychri: tobbo: it was active_support/core_ext/numeric after all :) Thanks


[17:48:06] roychri: Hello. When using paperclip with S3, am I right to say that the file first gets uploaded to the rails server (in /tmp for example) and then moved to S3 after that by the Rails app (paperclip) ?
[17:51:29] roychri: elaptics: thanks
[17:54:48] roychri: Maybe he means custom (non REST) actions
[17:55:56] roychri: elaptics: What if the image is already on S3 and I want my model with paperclip to simply point to that S3 location?
[17:56:50] roychri: elaptics: ok thanks, I'll continue my research.. I have not fouind anything yet.
[18:00:23] roychri: elaptics: That is what I think too but I am still trying to figure out "how" to get that done :)


[17:41:36] roychri: Why do ActiveRecord::Calculations methods [ like the sum() ] returns a 2D array?
[17:43:31] roychri: workmad3: I would have expected to be a hash only where the key is the grouped column values and the value is the selected calculation result.


[19:05:08] roychri: I get an error about having two different rakes. I use rvm and bundle. How do I get ride of one of the rake?
[19:22:49] roychri: bricker: Is it normal that when I do "gem which rake" it only show me one?
[20:52:39] roychri: I get an error about having two different rakes. I use rvm and bundle. How do I get ride of one of the rake? I tried "gem uninstall rake" but it says it will break a lot of dependencies (it does not ask me which one I want removed). Any suggestions?


[16:42:22] roychri: Some module/mixin/code/whatever is defining a method on my class and I dunno what is doing it. Can I redefine the method define_method()? Or... how can I know what code is responsible for defining the method I dont want?


[19:23:08] roychri: I am trying to find information on how I could create two unit test files (using Test::Unit) to test a single rails model (different aspect of the model).


[21:17:51] roychri: ount::Empty object. Is this proper Delegation or did I miss something? (
[21:17:51] roychri: I am new to the Delegation Pattern. I have users that can have 0 or 1 premium account. I was thinking of method User#premium_account that would return a Premium::Account object or Premium::Account::Empty (Special Case Object using NullObject pattern). I was thinking that the User#premium_account method would call a method of a class that would receive the User object in order to create the proper Premium::Account or Premium::Acc
[21:18:28] roychri: zelrik: I am doing TDD most of the time.
[21:21:04] roychri: ner0x: I am not talking about delegation (having another object do the job for me) but rather the original Delegation pattern (Ask someone else to find the right way to do the job and ask me a question it is missing anything).
[21:22:47] roychri: toretore: just trying to separate the logic, make clean design, dense expressions. Am I trying too hard?
[21:24:51] roychri: toretore: in general or in this case?
[21:25:57] roychri: I find that NullObject helps tremendously reading and understanding code.
[21:26:55] roychri: So with these things settled.... does my code express delegation right?
[21:29:27] roychri: toretore: oh, I have isntance methods, I just did not think they would be relevant to the question.
[21:29:38] roychri: toretore: the Premium::Account class is already a wrapper for third party class
[21:29:52] roychri: toretore: So a wrapper of a wrapper in this case would make sense?
[21:30:40] roychri: toretore: ok, sorry about that.
[21:33:11] roychri: toretore: thanks!


[00:55:50] roychri: Ogredude: The delegate module seem to only handle instance method, not class method. What am I missing?


[17:38:15] roychri: What do I need to include in my class (not ActiveRecord) in order to use attr_accessible (and friends?)
[17:38:41] roychri: I remember reading about it but I dont remember the name
[17:40:15] roychri: tubbo, tbuehlmann: Thanks
[17:53:20] roychri: I found "ActiveModel::AttributeMethods" which seem to be what I want. In all the examples that I found, it says I should call "define_attribute_methods ['name', 'color']" and "attr_accessor 'name', 'color'". This seem to break the DRY principle if I have to declare them twice.
[17:53:26] roychri: what am I missing?
[18:02:31] roychri: workmad3: I just want a (non-ActiveRecord) class with getter/setters for a given list of attributes.
[18:04:36] roychri: workmad3 : oh, Thanks! :)
[18:05:45] roychri: workmad3 : indeed. np :)
[18:10:32] roychri: workmad3: I wanted to use AttributeMethods because I want the list of attributes I define. It seems that attr_accessor does not keep track of that (unless I override it and keep track of it myself), right?
[18:13:17] roychri: workmad3: right
[22:59:08] roychri: I am creating a wrapper around a third party lib and I would like to delegate(forward) some messages (class methods). Extending would delegate all methods. I want to use composite. I use Forwardable to forward some instance methods to the third party object but I want to do same thing with *some* class methods. any pointers?
[22:59:43] roychri: I know I can define all methods manually
[23:00:15] roychri: I can also use "def self.method_missing" that check an array of the messages I want to delegate
[23:00:33] roychri: Just wondering if there is a more elegant alternative...


[18:01:47] roychri: Hello. I have a string with HTML (@response.body from functional tests) and I would like to print (log or console) the full content of the element with class "xyz". There seem to exists many options, one of which is some gem (Nokogiri) but since the assert_select is able to handle it without Nokogiri, I assume something exists already that I can use without having to install something new? what should I be looking for?


[17:15:49] roychri: With rails's default functional tests (not rspec), can I have more than one functional test file for the same controller? (each will test different aspects of a controller) ???


[19:09:46] roychri: Maybe I am missing the point of ERD, but I installed "rails-erd" and I wish it could show me the name of the relations between the models (it would say "groups" at the arrow pointing toward the
[19:09:50] roychri: User model.
[19:11:29] roychri: [ Group ](user)---->[ UserGroup ]<------(groups)[ User ]
[19:11:33] roychri: something like that.
[19:11:51] roychri: Am I making any ense?


[22:19:47] roychri: I have Poll model and PollOption model (Question and possible answers). I would like to prevent promoting a poll (changing promoted attribute to 1) when there is less than 2 options (poll.options.count <=1). What is the best way to handle that? With a validation? Custom one?


[16:37:14] roychri: In ruby, when I define a method, can I cast the parameters to make sure they are the proper objects? Or is the right thing to do is: raise RuntimeError, "Invalid Parameter type" if !param1.is_a? WoodHouse
[16:38:10] roychri: duck-what?
[16:38:48] roychri: and... with ruby... I want to be a duck?
[16:39:34] roychri: intersting...
[16:41:10] roychri: stephenorr: Thank you! I am reading that right now :)


[18:42:35] roychri: I have a controller/action with a helper path like this : new_controller_path(:foo => {:record_type => 'Group', :record_id =>}) but I would like to know if there is a way to pass an ActiveRecord object? I tried new_controller_path( => group)) and I also tried new_controller_path(:foo => => group))
[18:42:45] roychri: none of these two worked. Is it even possible?
[18:45:04] roychri: elaptics: Sorry, I will use a pastebin
[18:48:36] roychri: elaptics: that is what I meant. using that now
[18:50:17] roychri:


[20:56:50] roychri: If I have a variable containing a class (not an instance) and I want to know if it's a kind_of?, how can I do it? With instance I can use instance.kind_of?(SomeClass) but with klass.kind_of?(SomeClass) does not work.
[22:30:34] roychri: Why do vaules from class variables (using cattr_accessor) losses their values on reload? (in dev it's aweful)
[22:51:07] roychri: foucist: thanks for trying to help. :) If my problem was the stateless nature of the HTTP protocole, my problem would be solved easily :) I must not have explained my problem properly.
[22:57:25] roychri: foucist : I was refering to ruby class reload and not refreshing the page :)


[22:50:50] roychri: Hello. I am working on a Poll system where we want to have Templates for polls. I created a Poll::Template class and I want to be able to do "template :name_of_template {|args| some_code_here(args)}" but I want some_code_here(args) to be executed only when Poll::Template.get :name_of_template, arg1, arg2
[22:50:59] roychri: What shuold I use for getting there?
[22:54:46] roychri: tubbo: I need to have templates for polls. Polls can be created and attached to various models (polymorphic). I thought about using a class that would return me a poll based on the template name. Each template would need different kind of arguments since they handle different kind of attachments.
[22:55:38] roychri: tubbo: I thought about duplicating what I can do in unit tests when I can say "setup {some code here}" and that code gets run later, at the begining of every test.
[22:57:17] roychri: tubbo: My question is, how do I store the code so it's not run then, but only later?
[22:59:44] roychri: tubbo: correct. It is based on the attributes. For example, a template could be created to choose between two users of a Pair. The Pair object would be passed to the template poll factory and return a poll object based on the Pair
[23:04:14] roychri: tubbo: I wish I could store them in the DB, but since the templates are really code to execute based on the argumnets... I can't
[23:06:21] roychri: tubbo: I am more thinking about using callbacks like active_support does.
[23:08:03] roychri: tubbo: I just lookup how the "setup {}" works for tests (hard to find) and it's using active_support's callback thingie
[23:09:22] roychri: tubbo, my questino was, how can I astore the block so I can call it later
[23:10:13] roychri: tubbo: From what I just saw, it seem I can simply store it in an array or has just luike an object.
[23:11:14] roychri: wow, ok, cool then :)


[15:39:08] roychri: Hello, I am trying to get :counter_cache working and when I use it with :class_name, calling size method still execute the count query. See this gist for reproducable: What am I missing?


[15:22:56] roychri: Hello, I am building a poll system for my site and I got basic model, view, controller working for that. However, I'd like to have the ability to show a given poll on my site's sidebar and I am thinking I would need a partial for that and perhaps also a helper method? Is this the right approach?
[21:21:38] roychri: I would like to show a letter of the alphabet in the right order in a loop from any given array. So if the array has 3 elements (say of usernames) I want the loop to output A) user1 B) user2 C) user3
[21:21:54] roychri: I there some kind of sequence helper that exists to help me do that
[21:25:23] roychri: Antiarc, Radar: ok, I'll try to rephrase. I have an array of things, I want to output and prefix whatever each array element contains with a letter of the alphabet, beginning with A. So if I have featured_users.each {|username| puts "#{some_helper_here} - #{username}"} it would output A - user1 and so forth.
[21:25:58] roychri: Antiarc: oh, nice. got it . Thanks
[21:26:42] roychri: Antiarc: Interesting. I will look it up
[21:27:14] roychri: thanks you all
[21:34:57] roychri: Antiarc: Am I right to assume that the following whould cycle through the alphabet if I have more than 26 elements: <%= ('A'..'Z').to_a[index%27] %> ???
[21:37:48] roychri: Radar: Because that is what my client wants. Why do you want to know? :)
[21:38:31] roychri: Antiart's suggestions of each_with_index does the trick.
[21:39:12] roychri: Antiarc: helper method maybe?
[21:40:00] roychri: Radar: It's unlikely to happen in my situation. The list is choices for a poll. More than 10 choices and it's a weird poll :)
[21:41:21] roychri: the thnig is, I read about asking good questions on irc and one of the most improtant thing is not let others read my mind
[21:41:54] roychri:
[21:42:02] roychri: This one. I Better read it again
[21:43:57] roychri: Radar: succ! looks awesome!
[22:50:03] roychri: link_to_remote has been depreciated and replaced by link_to :remote => true. but link_to_remote seem to support :update and :with and link_to does not seem to support it. Is there an equivalent?


[13:25:23] roychri: After I restart apache on all my 50 millions servers, is there a way for me to get them to prefork/preload without me having to open my browser and manually go on each one of them? I am using Passenger on Ubuntu.
[13:28:00] roychri: workmad3: Cool. I've been trying but I might not be using the right keywords in google. "rails passenger preload preforking"
[13:30:17] roychri: workmad3: Would that be the PassengerPreStart option?
[13:30:47] roychri: rushed: Thank you. I will check them out.


[13:16:49] roychri: Hello. I would like one rails application to be able to talk to another rails' application's models (maybe using REST). Is there something that exists already to do that? Handles security and and data types and all?
[20:04:27] roychri: I am using json to call one of our rest application I am building. When I send the json of a Range, it sends all the possible values. Now I am wondering if there is a way to serialize the object so the json include the object class name and its attributes... possible?
[20:05:49] roychri: Imagine this: ("2012-10-04T05:00:00".."2012-10-04T05:00:00").to_json creates 26000001 entries :)
[20:07:00] roychri: Antiarc: That is my plan b right now. but wondering if there is another way.


[21:48:17] roychri: Is it a good idea to redefine deploy:setup cap task to install the required packages like ruby, rails and apache, etc... ?
[21:50:20] roychri: bricker: I thought that deploy:setup only needed to be done ocne too :)
[21:52:06] roychri: bricker: Right. What if I make it check if these packages already exists first? Would you say that using cap to do this is bad idea?
[21:52:54] roychri: bricker: Its for a stack of virtual machine , creating 20 every week
[21:53:03] roychri: 15 minutes is long then :)
[21:53:25] roychri: bricker: Thanks, I will look into that
[21:55:08] roychri: Axsuul: I know I technical can. My question was, was it meant for that.


[20:38:09] roychri: I made a module that allows me to specify before and after callbacks of all class methods of my classes that include that module. The problem is, when in the Rails console when I reload! or on the web in dev mode when it reloads when I made a change to any file, it stops working. The callbacks are no longuer called.
[20:38:14] roychri: The code is here:
[20:39:38] roychri: I am using alias_method and redefininf all the class methods and calling the original methods after calling the before callbacks and before calling the after callbacks.
[20:40:01] roychri: Antiarc: So, it I use instance variable it should be ok
[20:41:19] roychri: Antiarc: First, thanks for taking the time... It's for Rails but not for ActiveRecords model classes. It's for some other classes that handles data that is not in a relational DB.
[20:41:36] roychri: Antiarc: I will look into what ActiveSupport::concern is. I dunno what that does, I'll read it up.
[20:44:29] roychri: Antiarc: So, ActiveSupport::Concern will just mean that my module won't need the self.included() base.extends part?
[20:47:17] roychri: Antiarc: Cool, I'll look into that!
[20:47:25] roychri: Antiarc: Thanks!
[20:47:45] roychri: cause I have no clue how to sets instance variables on the mixing-in class when the module is mixed in!
[20:47:49] roychri: but... I'll find it!
[20:49:20] roychri: certainty: Nope. I am fairly new to Ruby
[20:49:39] roychri: certainty: Thanks though. I'll check in that area as well
[20:51:34] roychri: Antiarc: Since my module only define class methods... won't supporting instance variable be... weird? Unless its instance variable of the class and not of the objects? (since classes are objects... still tryign to get my head around that)
[20:54:38] roychri: certainty : yeah
[20:54:49] roychri: certainty: convoluted, I know
[20:55:05] roychri: certainty: all class methods. not instance methods.
[20:55:39] roychri: certainty: Why, something like that exists and I've lost the past 2 days?
[20:55:57] roychri: Well, I did learn a lot!
[20:57:39] roychri: Aspect Oriented Programming?
[20:58:46] roychri: certainty: You lost me. I am not that good :)
[20:59:38] roychri: certainty: Nope. In fact, I already built something to prevent that from happening.
[21:00:19] roychri: You can add many after methods
[21:00:23] roychri: and many before methods
[21:01:07] roychri: hehe, I understood that :)
[21:02:03] roychri: certainty: I must look like an idiot. I dont understansd half of what you are saying :(
[21:02:53] roychri: certainty: Well, you certainly know more than me about scemantics :)
[21:03:46] roychri: certainty: The before methods do not get the arguments (they could). The aftetr methods dont get the results to play with (they could).
[21:03:58] roychri: certainty: That would be a good addition but I have no need for that at the moment.
[21:04:24] roychri: certainty: that is what you mean?
[21:04:58] roychri: It's cool that someone seems so interested :)
[21:06:50] roychri: Feel free to look at the source I made.
[21:07:05] roychri: you probably gonna see things that can be improved. I am still new at this
[21:09:40] roychri: certainty: Ok, I took that from a site that explained how to make modules with class methods.
[21:11:13] roychri: certainty: Ok ,thanks! that will simply my code.
[21:39:05] roychri: Antiarc: I've tried simplying the code (not using ClassMethods sub module and using class instance variable), but I get an error. NoMethodError: undefined method `<<' for nil:NilClass
[21:39:18] roychri: Antiarc: The variable seems to eb undefined as per the method..
[21:39:30] roychri: Antiarc: Code is


[13:21:39] roychri: Why can't I do "clients = Client.order("id DESC"); if some_condition; clients.limit(2); end; clients.each ...
[13:22:08] roychri: I always get ALL clients.
[13:23:32] roychri: universa1: : When I do this, it still returns ALL client because of the first order() call.
[13:24:15] roychri: universa1: ok, one sec
[13:26:27] roychri: universa1:
[13:27:48] roychri: it clones relatino
[13:27:56] roychri: I remember seeing this in rails source code
[13:28:57] roychri: universa1: Thanks!
[13:29:19] roychri: universa1: I did not see it properly when you fuirst suggested it
[13:29:25] roychri: sorry about that
[17:20:56] roychri: Why would ClientController.respond_to? 'edit' return false when there is clearly "def edit" inside this controller ?
[17:21:46] roychri: Antiarc: Oh! Oops. THANKS!
[17:52:40] roychri: Is there a way to clear the rails console buffer (not clear the screen, I know its CTRL-L) so that any previous code entered and incomplete (like a block with no end yet) without having to exit and restart the console ?
[17:55:54] roychri: Likethe "mysql" console on the cli, you can do "\c" to clear the buffer when you have incomplete SQL statement (you did not put ; or \G yet). It allow you to start over the multiline expression.
[17:56:21] roychri: scott[8]: nope
[17:57:13] roychri: Like, if I do begin followed by enter, then enter a couple of lines. Then realize I made a mistake.
[18:00:11] roychri: too simple!
[18:03:08] roychri: scott[8]: Nice page this ninja thing. Thanks!


[22:52:56] roychri: I am trying to find if a controller exists. Object.const_defined?("Foo::Bar::SomeController")
[22:53:04] roychri: I get wrong constant name
[22:56:04] roychri: rhizmoe: Well, I do know. But the code I am writing works with many polymorphic models and some of them have a controller associated with them and some do not.
[22:56:46] roychri: rhizmoe: So instead of having big switch, I'd like it to find out on its own base on the model name
[22:57:56] roychri: Spaceghostc2c: hmmmm. maybe , yeah. thanks
[22:58:52] roychri: rhizmoe: I know. Even worst, this is in a view!!! look what I have : <% if "Foo::Bar::#{some.record.class}Controller".constantize.respond_to? 'edit' %>
[23:00:06] roychri: rhizmoe: Displaying a list of records from a table that has polymorphic records associated. Sometimes I want an "edit" link and sometimes a "delete" link. Depends on the model. (if the controller exists and has the edit or delte action (method).