« Back to channel list

#RubyOnRails - 04 June 2013

« Back 1 day Forward 1 day »
[00:05:30] aamax: any here install Rails_admin before? i'm following the destructions on the website and keep getting an erro when i run the generator. "`table_structure': Could not find table 'addresses' (ActiveRecord::StatementInvalid)
[00:07:00] islandr: Having problems with JST paths after precompiling assets
[00:07:51] islandr: In production the first directory is stripped from the path (JST["javascripts/templates/..."] becomes JST["templates/..."])
[00:08:13] islandr: Anyone know how to fix this?
[00:11:38] waseem_: islandr: I don't think you need to append javascript there.
[00:12:32] islandr: @waseem I wouldn't if the templates weren't stored there
[00:12:53] islandr: I can inspect the JST object from the console
[00:13:13] islandr: and in development "javascripts/" is there, in production it's not
[00:14:33] islandr: I've tried moving the templates into a different directory and even breaking them out into their own templates.js file but doesn't seem to matter
[00:14:59] helpa: islandr: If you're not getting an answer here perhaps try asking on http://stackoverflow.com Use the tag "ruby-on-rails"
[00:15:00] waseem_: islandr: !so
[00:16:25] islandr: I've worked on a number of rails projects before and never had this issue. Must be a whacky config somewhere but I'm not seeing it
[00:18:41] islandr: waseem_: I know it shouldn't be but that's what is happening
[00:19:20] waseem_: islandr: Sorry, I can not help you on this one.
[00:19:37] jstrong: Hey everyone. I've got a problem with rspec not picking up the right path in my controller spec for the "create" action, but it does it correctly for the index action. https://gist.github.com/laspluviosillas/aab8be9d6e22b26a6d7b . Line 20 fails for following reason: undefined method `crm_report_adjustment_url'
[00:19:37] jstrong: The right path is admin_crm_report_adjustments_url, so rspec is missing the admin namespace and rspec not using the plural path for "post :create", yet "get :index" works without any hiccups? Any ideas? (couldn't find stack overflow or github help)
[00:20:07] jstrong: * the gist has a missing comma, just a paste error, not an error with my code.
[00:21:18] jstrong: I have attempted to manually specify the path, doesn't work. I've tried to manually use the right rails path, also doesn't seem compatible with rspec.
[00:22:48] islandr: helpa: Thanks. http://stackoverflow.com/questions/16907939/why-would-jst-paths-differ-between-development-and-production
[00:24:09] aamax: FUCK. trying to build some POC code in a site. can't even get rails admin or active admin to install and run the generators. GD it...
[00:28:20] aamax: keep getting this stupid fucking Sprockets::FileNotFound - couldn't find file 'jquery-ui' error.
[00:28:31] aamax: starting over grumble grumble. swear grrrrrr
[00:32:25] MrPunkin: How can I get an assets path without the unique string for the version? is that an option for stylesheet_link_tag and the likes?
[00:50:58] aamax: fuck. i keep getting a jquery-ui file not found error. i added the query-rails-ui gem, added the references to it to my application js and css files. bundled and the fucking site still can't find it to run active admin. wtf?
[00:57:49] oddraisin: hello all. I'm using the nested_form gem to display the option for multiple pictures associated with an object. In the f.fields_for loop, is there a way to display the picture if it's already been uploaded, or the file_field if it's not?
[01:02:03] oddraisin: the code so far is pretty simple haml, but here's a pastie in case: http://pastie.org/8002948
[01:14:04] oddraisin: I'm not even sure if my text is getting through, but found a solution with a long and convoluted google search (last of many): http://stackoverflow.com/questions/10266005/updating-paperclip-avatar-in-multipart-simple-form
[01:45:15] amh345: I'm trying to update a xml file with nokogiri. do i have to first open a read of the file File.open('some_file') and then after open a write of the file File.open("some_file","w") etc etc
[01:45:53] amh345: and then make my changes to the xml and then save?
[01:46:40] amh345: yes. it looks like thats exactly what i have to do.
[02:05:09] karmiclychee: What's the point of null: false (or null: anything) for the DB?
[02:07:20] evenix: Anyone is familiar with nested fields_for? https://gist.github.com/richardsondx/5703068 I'm having an issue with the edit view
[02:08:24] sevenseacat: karmiclychee: to not allow nulls?
[02:09:30] karmiclychee: Ah. I thought I had read somewhere that not specifying a null option in the schema was a bad idea. Or is that just default values in general?
[02:10:21] sevenseacat: nothing wrong with specifying db defaults
[02:10:41] sevenseacat: for things like boolean fields its definitely encouraged so you dont end up with trues, falses, and nulls
[02:11:59] karmiclychee: sevenseacat: cool. thanks for clarifyin
[02:16:53] jon2: Hey I'm trying to create associations between my models. I have 2 models: Person, Roles, with appropriate has_many, belongs_to relations. But I don't see any foreign key relationships on the database side. How is this handled?
[02:19:40] sevenseacat: jon2: at the code level
[02:19:43] sevenseacat: not at the db level
[02:24:30] Lewix: anyone familiar with the twitter API
[02:24:52] sevenseacat: no-one, ever.
[02:24:56] helpa: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[02:32:51] evenix: nevermind i figured it out
[02:35:51] Lewix: hey sevenseacat,evenix
[02:41:33] Lewix: sevenseacat: good. you, how are things
[02:44:16] JimmyAtCMU: A question. In my lib/task/xxx.rake file, I have a line that says:
[02:44:27] JimmyAtCMU: a.foo = a.bar + (1 + rand(7)).day
[02:44:38] helpa: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[02:44:38] JimmyAtCMU: Then the error says: "foo=" method not defined for "a"
[02:46:58] scipi0: Hey, is there any way to change the default parameter names for resource routes?
[02:49:53] bonhoeffer: anyone see what is wrong here?
[02:49:54] bonhoeffer: $("#list_for_<%= u.id %>").append("<li><%= link_to(@prof.name, @prof) %></li>");
[02:50:11] bonhoeffer: wrong number of arguments (0 for 1) <-- but i don't get it
[02:50:30] bonhoeffer: also why is my js running twice
[02:50:44] sevenseacat: more context required
[02:51:37] bonhoeffer: sorry -- need more info on the first or second question
[02:51:52] bonhoeffer: ha! fair enough
[02:52:12] sevenseacat: you'd think by now people would learn to actually provide relevant information
[02:52:33] bonhoeffer: the first one should be simple enough . . . one sec $("#my_ul").append("<li>foo</li>") should work
[02:52:53] helpa: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[02:53:38] bonhoeffer: that is my real value -- i'm trying
[02:53:50] bonhoeffer: anyway -- the problem is the instance variable . . . sorry
[02:56:35] bonhoeffer: but i'll work on getting the double javascript problem updated
[02:56:47] bonhoeffer: and well explained (and probably solve it in the process)
[02:59:17] scipi0: Hey, is there any way to change the default parameter names for resource routes?
[03:03:35] sevenseacat: scipi0: not that i know of.
[03:05:08] bonhoeffer: sevenseacat: https://gist.github.com/tbbooher/5703287
[03:05:45] sevenseacat: bonhoeffer: and what do your logs say?
[03:06:27] bonhoeffer: i'm looking at chrome log, huge mongo dump in my logs, for a front-end code, not sure what you are getting at
[03:06:56] bonhoeffer: but it is running twice
[03:07:50] jonathanwlee: Hi all, i'm using the following line of code in a view file and am getting and error of "Could not find client with out an ID":
[03:07:54] jonathanwlee: <% client = Client.find(1) %>
[03:07:55] bonhoeffer: added logs to the gist -- strange
[03:08:03] jonathanwlee: What am I doing wrong?
[03:08:09] jonathanwlee: it works find in rails console
[03:08:33] bonhoeffer: jonathanwlee: why load a variable in a view?
[03:08:46] bonhoeffer: should probably do that in the controller
[03:08:56] bonhoeffer: sevenseacat: anything jump out at you?
[03:09:33] jonathanwlee: I passed in projects from the controller, and am trying to reach up to the parent (client) to display some items from it
[03:09:50] bonhoeffer: http://stackoverflow.com/questions/4620085/rails-3-form-getting-submitted-twice <-- strange seems common
[03:10:16] jonathanwlee: I'm trying to display a list of projects along with the client names that correspond
[03:10:37] bonhoeffer: looks like i'm binding the same 'click' event twice on the same object
[03:10:50] bonhoeffer: but using nothing other than default ajax remote: true on form
[03:11:09] bonhoeffer: jonathanwlee: so use an iterator
[03:11:57] bonhoeffer: @clients.each {|c| c.projects.each {|p| p.name}}
[03:12:01] bonhoeffer: in block form
[03:12:04] jonathanwlee: I sort of am. I have these two lines of code prior to my table display: <% @projects.each do |project| %>
[03:12:04] jonathanwlee: <% client = Client.find(1) %>
[03:12:12] jonathanwlee: Is there a better way to do this?
[03:12:24] bonhoeffer: probably should gist
[03:13:12] sevenseacat: not unless you're double-clicking the link, or you have some other JS somewhere interfering with it
[03:13:29] jonathanwlee: Let me try that code you just gave me, I was sure of the exact syntax
[03:13:46] bonhoeffer: sevenseacat: ha! the ujs is included twice, so it fires twice.
[03:13:57] sevenseacat: your controller is a bit dodgy though, because you may end up with a professor without a university
[03:14:22] bonhoeffer: find . -iname "application.js" ./app/assets/javascripts/application.js ./public/assets/application.js
[03:14:33] bonhoeffer: thanks -- i'll look at that
[03:14:35] sevenseacat: well that doesnt mean its included twice
[03:15:15] bonhoeffer: i don't think it should be there twice
[03:15:51] jonathanwlee: bonhoeffer, with the code snippet you gave me would I then only need to pass in @clients from the controller?
[03:16:46] sevenseacat: depends. if its on staging as your logs suggest, yes it should because you would have precompiled your assets.
[03:17:54] jonathanwlee: ok, but some of the projects are "current leads" and some are "past leads" based on attribute of status. How do I further narrow the iteration to only display the ones with (:status => "Current Lead")
[03:19:53] bonhoeffer: in the controller -- add a scope
[03:20:04] bonhoeffer: load two instance variables
[03:21:33] bonhoeffer: sevenseacat: hmm .. . removing that didn't solve the problem
[03:22:45] bonhoeffer: wonder if this is twitter bootstrap gem related --- i think it adds javascript
[03:22:51] bonhoeffer: i might be requiring it twice
[03:22:52] sevenseacat: it does, and it's not.
[03:23:09] Catharz: I'm trying to use the NullObject pattern to clean up some conditionals in views. Thing is, my view links to the relationship. How do you cleanly handle creating a link to an existing relationship, but not creating a link if it's a NullObject? It seems like I'm recreating the problem at another level.
[03:23:28] sevenseacat: bootstrap does add javascript.
[03:23:49] bonhoeffer: and what is not?
[03:24:09] sevenseacat: its not the problem.
[03:24:53] bonhoeffer: ok -- i'll look elsewhere
[03:26:32] bonhoeffer: maybe i need to return true
[03:27:09] sevenseacat: are you including the ujs twice?
[03:27:32] bonhoeffer: i'm trying to find out
[03:27:35] bonhoeffer: not that i can find
[03:27:40] sevenseacat: grep for jquery_ujs
[03:28:15] bonhoeffer: yeah -- i get //= require jquery_ujs only once in the app
[03:28:45] solidus-lake: i'm having a wierd button_to destroy problem
[03:28:50] solidus-lake: creating pastie now
[03:29:08] bonhoeffer: sevenseacat: but i'm looking at the gems
[03:29:18] bonhoeffer: jquery-rails or something might be causing trouble
[03:31:58] bonhoeffer: and looking at the cache
[03:32:23] solidus-lake: http://pastie.org/8003298
[03:32:28] solidus-lake: i do not get why that test fails
[03:32:39] solidus-lake: can anyone offer insight?
[03:32:41] bonhoeffer: works -- sevenseacat, browser cache
[03:34:28] solidus-lake: oh balls, i see it i think
[03:34:45] solidus-lake: wait, scratch that i don't see it
[03:35:33] sevenseacat: solidus-lake: there is no HTTP method 'destroy'
[03:35:39] sevenseacat: do you mean :delete ?
[03:37:02] jonathanwlee: Bonhoeffer I'm still getting "Undefined local variable" with the following: <% @clients.each {|client| client.projects.each {|project| project.name}} %>
[03:37:23] solidus-lake: sevenseacat: yes, yes i did :), <3
[03:37:33] karmiclychee: Should I be able to call two validations on a single line? validates :username, presence: true, uniqueness: true
[03:37:38] sevenseacat: karmiclychee: yep.
[03:37:50] karmiclychee: weird, my validation isn't working,
[03:38:27] karmiclychee: sevenseacat: :C
[03:38:43] sevenseacat: code and failing test?
[03:39:33] karmiclychee: no spec yet, failing in console and browser. Sec
[03:40:37] bonhoeffer: jonathanwlee: more code needed
[03:40:43] solidus-lake: 451 examples, 1 failure
[03:41:14] bratsche: Hey all, anyone have much experience using Koala?
[03:42:12] helpa: bratsche: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[03:42:12] sevenseacat: bratsche: !used
[03:42:19] jonathanwlee: bonhoeffer: here's the view file: https://gist.github.com/anonymous/5703420
[03:43:15] bonhoeffer: yeah -- there is some basic stuff there you want @clients.each do |client| .. .
[03:43:26] bonhoeffer: so your variable is defined
[03:43:41] bratsche: Well, okay.. so my issue is that when I use the OAuth redirect shiz as described in their docs, I redirect_to @oauth.url_for_oauth_code and then Facebook redirects back to me as it's supposed to. But if I redirect_to @oauth.url_for_oauth_code(:permissions => "publish_stream") then Facebook never redirects back.
[03:43:46] bonhoeffer: you are just running some code on line 16, not creating a block
[03:44:15] karmiclychee: sevenseacat: https://gist.github.com/karmiclychee/3b417a0e19239cba25bd
[03:45:03] sevenseacat: karmiclychee: https://gist.github.com/karmiclychee/3b417a0e19239cba25bd#file-user-rb-L11 that is not the same line you posted earlier
[03:45:23] sevenseacat: spot the difference, other than the invalid option 'constrain'
[03:45:53] bonhoeffer: anyone know why pop off of a relation in mongoid doesn't remove the relation
[03:46:15] bonhoeffer: maybe the only way to remove an object from relation is to subtract it from the array and reload the whole thing
[03:46:24] karmiclychee: sevenseacat: validates != validate
[03:46:33] sevenseacat: karmiclychee: bingo!
[03:46:48] karmiclychee: sevenseacat: head, meet desk. Desk, presenting head.
[03:47:07] sevenseacat: all good, sometimes all it needs is a second set of eyes.
[03:48:00] bonhoeffer: the worlds worst code --> https://gist.github.com/tbbooher/5703438
[03:48:04] bonhoeffer: this can't be right
[03:48:37] karmiclychee: sevenseacat: and now it's vomiting on the constrain, a good sign. Thanks!
[03:48:55] sevenseacat: karmiclychee: no probs :)
[03:49:32] sevenseacat: bonhoeffer: whats wrong with just @university.professors.delete(@professor)
[03:49:42] jonathanwlee: Bonhoeffer: I can't get your iteration code to work, but I got the following to work:
[03:49:44] jonathanwlee: <% @clients.each do |client| %>
[03:49:45] jonathanwlee: <% client.projects.each do |project| %>
[03:49:52] jonathanwlee: Is this any less efficient?
[03:50:00] bonhoeffer: that is what i meant
[03:50:06] sevenseacat: i assume mongoid will support that AR syntax
[03:50:09] bonhoeffer: i just wrote it in one line
[03:50:22] bonhoeffer: sevenseacat: it should but delete destroys the original document
[03:50:31] bonhoeffer: as far as i can tell
[03:50:43] jonathanwlee: ok, just wanted to make sure I wasn't added extra iteration where it wasn't needed
[03:50:50] sevenseacat: well whats the mongoid syntax from deleting from an associaiton?
[03:51:23] sevenseacat: http://mongoid.org/en/mongoid/docs/relations.html#has_many says delete is correct
[03:52:59] karmiclychee: Does anyone have the proper format for a Matrix-style jack-in of REGEXP directly into my brain?
[03:53:23] karmiclychee: responds_to :json doesn't work for :grey_matter
[03:54:27] bonhoeffer: sevenseacat: totally correct -- i see my mistake -- it needs to unset a boolean to appear in my scope --- sry
[03:55:55] karmiclychee: the first SO post I find for regexp exclusions is a JS dev asking to be put out of his misery
[03:57:08] sevenseacat: rubular.com is a good resource for testing regexp
[03:57:40] sevenseacat: it even links to some detailed stuff on regexp in ruby
[03:57:47] sevenseacat: straight from the pickaxe
[04:06:26] ariedler: toast is great food; where the rails app that makes toast.
[04:06:38] karmiclychee: rails new toast
[04:07:00] karmiclychee: rake toast:rye
[04:08:19] ariedler: http://1bag.tumblr.com/post/4440589766/no-valid-gem hmmm no results for the toast gem
[04:08:20] sevenseacat: rails g toast
[04:12:02] ariedler: ACTION eats the toast
[04:12:41] karmiclychee: There's an undocumented method - rails d bread
[04:13:03] ariedler: rails toast bread
[04:16:58] scipi0: Hello. I'm having trouble fixing my form, https://gist.github.com/Benjmin/5703530 . The problem is that instead of the create having the parameters defined in url, it instead submits the id's of the objects for the parameters.
[04:18:13] sevenseacat: is it not submitting to the URL you specify with the parameters you specify?
[04:19:20] scipi0: sevenseacat: Yes. it is instead submitting the default. the request parameters sent is as so "{"action"=>"show", "controller"=>"pages", "user_id"=>"2", "book_id"=>"14", "id"=>"44"}"
[04:19:59] sevenseacat: no, show the proper logs
[04:20:24] sevenseacat: it will never post to a show action
[04:20:49] scipi0: never mind.
[04:21:32] scipi0: sevenseacat:Ever figure out your bug as soon as you paste your gist.
[04:21:43] chendo_: should get a rubber ducky
[04:21:48] sevenseacat: yep, but usually after i paste it and before i share it.
[04:36:00] alphonse23: So is rubyquiz.com dead?
[05:01:38] spammer: hey wats up, bitchassniggers
[05:01:46] spammer: i am here to fuckyour mom
[05:01:54] spammer: niggerfags
[05:08:31] oceanbreeze: def a PHP user
[05:08:45] oceanbreeze: and jelly as fk
[05:31:14] alphonse23: probably just some 15 year old
[05:31:38] alphonse23: what happen to this place, usually theres a lot more conversation
[05:44:54] rhizome: how about that local sports team?
[05:48:27] jonathanwlee: Hi all, what is the best way to build a form that updates 2 objects at the same time. Right now I have this code in my edit template: https://gist.github.com/anonymous/5703852
[05:50:41] Babalau: anyone from here is in charge of http://tryruby.org/ ?
[06:02:36] snorkdude: Hey all, can anyone help me with limiting an "each do" loop in Rails. This is the code I have, but I want to limit it to run only three times. What is the best way to do this?
[06:02:37] snorkdude: https://gist.github.com/aayalur/5f9b6c6a838c95379b2b#file-blah-rb
[06:08:55] sevenseacat: snorkdude: @questions.first(3).each do ?
[06:09:13] sevenseacat: i'd also move that conditional outside the loop
[06:09:38] snorkdude: The problem with that is, I want to search through all of the @questions
[06:09:44] snorkdude: not just the first 3
[06:10:44] sevenseacat: you want to output the loop three times but you dont want to feed 3 things into the loop?
[06:11:48] snorkdude: Let's say in @questions, there are 5 with the topic "products"
[06:12:21] snorkdude: So the code creates 5 <li> elements, but I only want 3
[06:12:34] sevenseacat: hence first(3)
[06:13:46] snorkdude: So that would work if the conditional was moved, right?
[06:13:59] snorkdude: Ah, I see. Thanks!
[06:15:12] efn_awesome: can you guys help me out with something
[06:15:48] efn_awesome: I have a class that contains one local array variable
[06:16:07] efn_awesome: and I want to pass a block that will act on that array
[06:16:14] efn_awesome: through a method
[06:16:34] efn_awesome: within the method I have if block_given? yield
[06:16:37] efn_awesome: will that work
[06:16:55] efn_awesome: say if I was trying to pass it { |n| n**2 }
[06:17:09] efn_awesome: when the array variable is declared
[06:17:50] efn_awesome: why wont something like this work? yield(@array)
[06:18:38] efn_awesome: you know what.. no ones going to be able to figure this out
[06:18:43] efn_awesome: I'm going to be
[06:25:18] snorkdude: sevenseacat: I can't quite move the conditional out of the loop. Doing so results in a NoMethodError because I can't call .topic on an array.
[06:25:33] snorkdude: In this case @questions
[06:28:11] helpa: snorkdude: Do not PM members of the channel without first asking if that is OK.
[06:28:11] sevenseacat: snorkdude: !rule12
[06:28:39] sevenseacat: snorkdude: @questions.where(topic: 'products') ?
[06:29:54] snorkdude: Wasn't sure if it was bad practice to do so in the view
[06:30:07] snorkdude: But it makes more sense than defining a bunch of variables in the controller
[06:30:46] sevenseacat: it would make sense to do it in the controller, but you havent given me enough context for that.
[06:30:57] sevenseacat: should it be like @relevant_questions or something?
[06:31:12] snorkdude: Yeah, but there are quite a few topics
[06:31:20] snorkdude: So wasn't entirely sure
[06:32:17] sevenseacat: well neither am i, you've given me nothing to go on.
[06:33:14] amh345: nokogiri question .node_name shows the node name for example <details>. the thing is is my node has an id <details id="sdfdsf"> what do i have to do to get the the id?
[06:34:01] sevenseacat: amh345: what class is the node?
[06:36:41] amh345: ah. .keys picks up id. but not value.
[06:37:42] sevenseacat: ACTION shrugs and goes back to work
[06:37:53] amh345: oh whoa. sorry i missed your question.
[06:37:58] amh345: but i found the solution. .get_attribute("id")
[06:38:12] drale2k: Can this code be simplified or be better written? https://gist.github.com/drale2k/6c3fee0ed46f6a66967e
[06:39:20] sevenseacat: drale2k: Exercise.find @workout_session.workout_session_sets
[06:39:52] amh345: i've bee trying to setup a rails app with an xml file as a db. but nokogiri has been kicking my ass.
[06:39:56] sevenseacat: oh, add a map(&:exercise_id) on the end.
[06:40:04] sevenseacat: amh345: sounds like a nutty thing t odo.
[06:40:17] amh345: sevenseacat: the front end of this app is a flash application.
[06:40:29] amh345: and the flash app reads and writes an xml file.
[06:40:39] drale2k: sevenseacat: thanks
[06:40:46] drale2k: flash + xml <3
[06:40:48] sevenseacat: have your flash app fire ajax requests to update a real database.
[06:40:49] drale2k: a love story :D
[06:40:54] sevenseacat: if you must use shitty flash
[06:41:08] sevenseacat: dont make the good technology bad just to keep the bad technology happy.
[06:41:35] amh345: i tried to not use flash. but the options are not really available. i hate flash.
[06:42:19] certainty: good technologie is an oxymoron
[06:42:22] amh345: and yes. i could have done json or something with the flash app. maybe next time.
[06:42:35] drale2k: amh345: You had control over it and picked flash? Why?
[06:42:45] sevenseacat: certainty: i would call ruby a good technology.
[06:42:52] sevenseacat: i would call flash a fucking horrid technology.
[06:43:26] amh345: drale2k: i had to have a flash photo booth created with tablet triggers. and a fairly modest budget.
[06:43:31] lessless: guys, what can cause this error https://gist.github.com/dirty-hippie/22bb33916f0f915b0cf8 ?
[06:44:20] amh345: rails is playing a very very minimal role in this.
[06:44:43] sevenseacat: lessless: cant see the code. cant tell you.
[06:52:47] tagrudev: certainty, Rindfleischetikettierungsueberwachungsaufgabenuebertragungsgesetz
[06:53:55] drale2k: tagrudev: lol
[06:54:00] lessless: sevenseacat, here is the place where error occurs and dump of the argument that leads to the error
[06:54:02] lessless: https://gist.github.com/dirty-hippie/22bb33916f0f915b0cf8#file-sidekiq-rb-L4
[06:55:30] gamov: is there a quick way of asking an has_many association if any of the items/sub-items are dirty?
[06:56:08] gamov: i have a deeply nested form and I would like to keep only the dirty items if validation fails
[06:56:50] gamov: brute force will be to iterate on all
[06:58:08] arrowcircle: hi! i have a problem with rails autoloading "Expected my_model.rb to define MyModel" https://gist.github.com/arrowcircle/5684586 . any ideas how to fix this error?
[06:58:59] drale2k: gamov: mabye something like Model.somethings.map { |thing| thing.changed? }
[07:00:08] gamov: drale2k: yes, that was my implementation, but it doesn't work because changed? doesn't ask the nested record
[07:01:05] drale2k: gamov: so thing has nested records ?
[07:01:18] gamov: yes, in a nested form
[07:03:45] LongLiveBacon: How do I go about adding conditions to an activerecord query if I store it in a variable? e.g. https://gist.github.com/anonymous/1784f0b09003af44dc1d
[07:04:33] sevenseacat: LongLiveBacon: results = results.deleted ?
[07:04:46] sevenseacat: i dont know what you're trying to do there
[07:04:53] LongLiveBacon: ooh, so simple heh :)
[07:06:14] LongLiveBacon: guess I should have my morning coffee before doing anything else...
[07:10:02] certainty: tagrudev: heh, you hear german news?
[07:10:26] certainty: sevenseacat: i'd call ruby a useful technologies
[07:10:51] certainty: tagrudev: yeah that's an insanely long word
[07:11:30] tagrudev: sounds fine to me :D
[07:11:58] certainty: yeah i used to say that allday long
[07:13:41] tagrudev: :D you mean it takes a day to say it
[07:14:32] gamov: drale2k: the answer is changed_for_autosave? ! Beautiful: select{|si| si.new_record? || si.changed? || si.changed_for_autosave?}
[07:14:45] certainty: tagrudev: yeah :)
[07:15:00] drale2k: gamov: ah nice
[07:15:40] drale2k: tagrudev: do you know what it means?
[07:16:12] zmalex: Good morning
[07:16:16] tagrudev: but it's out of usage now
[07:16:43] certainty: select{|si| changed?(si) } .. where changed? is defined to test if its arg is new_record?, changed? or changed_for_autosave? or add another method to your model that does that, then you can just select(&:something?)
[07:16:45] zmalex: Can anyone tell me how to inject divs into the html page when running cucumber?
[07:17:10] certainty: in any case i would eliminate the conditional in that block
[07:17:40] certainty: ok i've spent my 2cents. i'm free to talk bullshit again
[07:22:27] Criztian: yesterday I installed rails on a linux system and everything worked fine. Today I turned the device back on and no rails command found. WTH?
[07:23:52] rushed: Criztian: same user? ruby version manager setup correctly?
[07:23:56] sevenseacat: you're not in the right gemset? you don't have the right ruby loaded?
[07:24:12] sevenseacat: you did something wrong? :)
[07:24:23] karmiclychee: right dir? what cmd?
[07:24:55] Criztian: probably the default rvm gemset is empty, lemme try setting it to default
[07:25:07] sevenseacat: well which one did you install rails to :p
[07:26:10] Criztian: point is I never changed it
[07:27:55] sevenseacat: well you didnt say that before, and we're not mindreaders
[07:28:57] Criztian: sevenseacat: I'll struggle a bit more with it then give more details on the chan. Just wanted to know if it was something more frequent on linux.
[07:29:27] sevenseacat: no, its not a common occurrence to install rails and then have it uninstall itself.
[07:30:34] Criztian: btw all I did yesterday was creating a gemset in rvm which I named maingemset, then rvm gemset use maingemset and in the end gem install rails.
[07:30:56] sevenseacat: so you did change the gemset
[07:31:06] Criztian: yes but not today I mean
[07:31:07] sevenseacat: are you using that same maingemset now?
[07:31:21] tagrudev: we have a winner
[07:32:25] Criztian: if I do rvm gemset use maingemset I get "RVM is not a function, selecting rubies with 'rvm use ...' will not work"
[07:32:38] sevenseacat: i love when people don't read the RVM docs
[07:33:02] Criztian: Ok but yesterday it worked fine using that same command
[07:33:36] sevenseacat: https://rvm.io/rvm/install/ see troubleshooting
[07:33:45] Criztian: I've always been using it on mac without any problems
[07:33:50] sevenseacat: because you'd just installed it on that same terminal shell.
[07:33:57] sevenseacat: now you're on a different terminal shell.
[07:34:17] Criztian: hmmm so I need to change some properties of the shell
[07:59:33] drale2k: When you have an API for users where they can get user specific dat from it, how do you distinguish between users when they request a resource? Find user by API key or something ?
[08:03:20] Criztian: solved, I needed to make rvm run as a function from bash on linux.
[08:03:37] ziyadb: Good morning.
[08:04:34] Criztian: good morning ziyadb
[08:05:21] rushed: drale2k: you might find this useful http://railscasts.com/episodes/352-securing-an-api
[08:05:43] drale2k: rushed: i watched that but it does not cover multiple users
[08:07:16] rushed: drale2k: are you sure about that?
[08:08:03] sevenseacat: drale2k: methinks you're wrong
[08:08:09] drale2k: rushed: It creates a token per user but it does not show how to retireve content based on the requesting user
[08:08:41] drale2k: that screencast is about securing an API, not using it
[08:08:45] sevenseacat: cuz that is kinda irrelevant to the API kind of things
[08:08:49] sevenseacat: API side of thingd
[08:08:59] drale2k: sevenseacat: wrong what?
[08:09:07] sevenseacat: if you're authing a user, you know who they are. you can do whatever filtering you want based on that
[08:09:47] drale2k: sevenseacat: yes so my question was if it is a good idea to find a user based on the token and then show content which belonigs to that user
[08:10:09] sevenseacat: well thats a totally different question than you originally asked
[08:10:26] ziyadb: Hey guys, quick question. I have a post hash and wish to derive the user hash based on the user_id key included in the post hash.
[08:10:37] drale2k: sevenseacat: well no, it's not
[08:10:44] drale2k: but i guess that#s the right answer
[08:11:00] sevenseacat: 'how do you distinguish between users' != 'is it a good idea to filter data based on a user token'
[08:11:25] ziyadb: Umm, more a syntax and "right way to do it" question.
[08:11:43] rushed: ziyadb: "derive the user hash"? maybe back up a level and explain what you're trying to do
[08:12:24] ziyadb: rushed: fair enough. I have a @drafts = Post.where("published = false"), and want to display the author's name on the view for each draft.
[08:12:58] ziyadb: rushed: so I figured I needed to derive the user object based on the user_id key included in each draft and get the name from there.
[08:13:52] Criztian: ziyadb: are users linked with a foreign key?
[08:14:16] ziyadb: Criztian: with the Posts? Yes, through a user_id field defined in each post.
[08:14:51] Criztian: I'm still a newbie but I think you need to use .include
[08:15:11] rushed: ziyadb: you might find this useful http://railsforzombies.org (the answer to your question is probably "belongs_to :user" in your Post model but it sounds like a basic overview might be helpful)
[08:16:11] ziyadb: rushed: yeah, I already have that defined in my model. What I'm trying to do right now is derive and display the user.name from the user_id field included in the post object.
[08:17:38] rushed: ziyadb: if that's true then given a draft it should be available at draft.user.name, but seriously, check out an intro guide :)
[08:17:55] ziyadb: rushed: heh, I shall.
[08:18:04] ziyadb: rushed: ah, that's convenient. I'll give it a shot.
[08:18:05] Criztian: ziyadb: read the docs on .includes
[08:18:29] ziyadb: Criztian: will do, thank you.
[08:19:19] ziyadb: rushed: yup, it worked. Thank you :)
[08:19:23] rushed: includes is anti-n+1 not to define what's available :)
[08:19:38] ziyadb: Criztian: ah, yes. Includes is what I was looking for earlier.
[08:20:05] ziyadb: But evidently it is simply accessible through draft.user.name provided the associates are correctly configured.
[08:20:16] ziyadb: Criztian, rushed: thanks guys :)
[08:20:26] ziyadb: s/associates/associations/
[08:23:44] zmalex: Anyone using webrat?
[08:23:51] zmalex: With cucumber?
[08:24:54] maloik: Can't seem to find it on github, but devise does inherit its controllers from ApplicationController, right ?
[08:26:12] omarqureshi: https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb
[08:26:53] sevenseacat: i doubt anyone uses webrat anymore.
[08:27:22] omarqureshi: eventually it does maloik
[08:30:14] maloik: omarqureshi: that's what I thought... we have a before filter in app controller setting session[:locale] ||= Locale.new('nl'), and for some reason, our helper accessing that session var breaks the app on one of devise's controllers
[08:30:23] maloik: I'm puzzled, it says session[:locale] is nil
[08:35:15] rushed: maloik: you probably don't want to be storing objects in your session
[08:36:14] maloik: rushed: you're probably right... but do you think that is the issue? it seems to work for everything else
[08:36:57] rushed: maloik: does the issue matter if you avoid doing it? :)
[08:38:34] maloik: rushed: well, I was hoping for a quick fix on this ;)
[08:44:30] sevenseacat: removing the problem entirely is a pretty quick fix
[08:44:57] Nom-: Keep in mind session is not available immediately
[08:45:13] maloik: that depends on how deeply this is nested sevenseacat ;) it's a legacy app, gives me the shivers to think about it
[08:45:15] Nom-: ie. If you change session[:foo] and then try and access it immediately... it won't be the new value
[08:45:18] maloik: but I guess there's no way around it
[08:45:29] maloik: Nom-: hmm, that may be it I suppose
[08:45:52] Nom-: Or was that cookies... I've confused myself now
[08:46:05] sevenseacat: maloik: change the before_filter to store the 'nl' instead of the locale object, grep for session access and change it to load the Locale object afer accessing the value
[08:46:10] sevenseacat: seems pretty straightforward
[08:46:29] maloik: Nom-: I believe we use cookies to store the sessions, so either way.. :-)
[08:46:59] Nom-: I remember there was a method you can call to make sure it works within the same request instead of only being there on the next request
[08:47:02] Nom-: Just trying to find where I saw that
[08:48:04] ruby-lang775: hello what does the line posts.sort_by{|p|p[:at]} mean ? i looked at http://ruby-doc.org/core-2.0/Array.html#method-i-sort_by-21 and still can't understand it
[08:48:54] ruby-lang775: Is there another doc I can refer to for better understanding ? I'm yet to figure out what :at stands for
[08:49:11] sevenseacat: ruby-lang775: it's a symbol. a key in the (i'm guessing) p object.
[08:49:14] maloik: ruby-lang775: it sorts the array of Post objects on the at attribute
[08:49:48] sevenseacat: maloik: well they might not be Post objects
[08:50:00] maloik: I suppose so, but that'd be just plain weird :-)
[08:50:08] sevenseacat: ive seen weirder.
[08:50:24] ruby-lang775: i see. thank you sevenseacat and maloik . posts is a collection of json values from social network profile newsfeed
[08:50:36] sevenseacat: maloik: ah hah!
[08:50:52] ruby-lang775: err posts by social network user and will be later rendered as json
[08:50:56] maloik: sevenseacat: http://images.wikia.com/random-ness/images/0/0b/Homer_hedge.gif
[08:51:20] ruby-lang775: I'm not sure of p object. can it be this posts.sort_by(|e| e[:at])
[08:51:50] maloik: whatever you put between the | is what you call your object for the sake of the sorting block
[08:51:52] sevenseacat: it can be foobar if you want
[08:51:55] maloik: if that makes sense
[08:51:58] ruby-lang775: I mean can the p be replaced iwht any other letter. I will have to re-read the http://ruby-doc.org/core-2.0/Array.html#method-i-sort_by-21
[08:52:11] ruby-lang775: thanks again sevenseacat maloik it helped a lot
[08:53:13] marwinism: https://gist.github.com/marwinism/5704599 - Can anyone see a obvious flaw? Hash is sent on with empty JSON
[08:53:39] sevenseacat: the p just means its going to iterate over each object in posts, and each one is stored in the variable p (or e or whatever) for the duration of the block
[08:53:50] sevenseacat: so you can put any valid variable name in there
[08:55:39] rushed: marwinism: you might want to take a look at activeresource, remotely, or one of the other tools for using remote models, might save you a lot of that hand wiring
[08:57:48] marwinism: rushed: hehe, yeah, this is just me trying to connect a RoR application to a Ruby backend for a game, with a Sinatra "webservice" on top of it. I just need to get that JSON with some data. It's more proof of concept than production anyways. bachelor thesis :)
[09:02:48] toretore: marwinism: it's difficult to see flaws when you don't know if there are any problems
[09:02:56] toretore: i.e. provide more information
[09:02:59] marwinism: Hash is empty.
[09:03:09] toretore: that doesn't help much
[09:03:58] marwinism: haha, I'd give you more if I had more :) I'll do some snooping around, perhaps i'll stumble upon what is breaking it.
[09:04:06] yashshah: Hi, i am working on implementing real time communication (chat & notifications) in a social network. I went through lots of blogs online and questions on Stack overflow. They seems bit outdated. I would like to know currently what will be the best way to implement real time commuication?
[09:05:14] rushed: yashshah: you might find these useful http://railscasts.com/episodes/260-messaging-with-faye http://railscasts.com/episodes/401-actioncontroller-live http://railscasts.com/episodes/229-polling-for-changes-revised
[09:05:32] toretore: node.js obviously
[09:06:47] yashshah: i checked out Faye, but it is also not updated from a year now.
[09:07:17] marwinism: toretore & rushed - Well, that sucks.. I forgot the name="" in the form, so no wonder my hash was emtpy. *facepalm*
[09:07:56] rushed: marwinism: also you probably don't want to build form fields by hand
[09:09:07] rushed: ^ http://railscasts.com/episodes/234-simple-form-revised
[09:11:08] marwinism: rushed: For a RoR app, sure. This is not a RoR app, I just needed the fastest possible way to get a website up, and to communicate with my backend.
[09:11:46] rushed: marwinism: whoops, guess I'm in the wrong channel sorry
[09:12:23] tagrudev: rushed, yeah go away
[09:12:28] marwinism: Not really, but there is no channel for "Mixing rails with other stuffs"
[09:12:41] marwinism: on Ruby they say "go to rubyonrails.. gtfo"
[09:14:59] yashshah: tagrudev: rushed will this be nice option to go with http://goo.gl/whAVm http://goo.gl/wxC6o?
[09:15:52] yashshah: sorry tagrudev, i meant to tag toretore ^
[09:17:26] toretore: yashshah: it was a nonsensical answer to a nonsensical question
[09:17:41] toretore: it's like asking what tool is the best to make a car with
[09:18:22] rushed: yashshah: quoting from your link "While I elected to rewrite 100% of Understoodit in Node" so maybe not the best place to get Rails advice :)
[09:18:25] yashshah: toretore: okay, sorry for that. i am very confused.
[09:18:37] maloik: Uhhhh replacing this session locale thing is seriously harder than I thought, stupid old plugin already causing me headaches
[09:18:44] avril14th: is there a way in rails inside a model when doing relation.each do end to eager load the relation without writing Class.includes(:relation) ?
[09:19:55] toretore: yashshah: your problem is a complicated one - there are many layers to it each with many ways to solve it
[09:20:32] toretore: yashshah: first step would probably be to read up on websockets, sse and polling
[09:22:49] yashshah: toretore: there all are on same layer, right? i will like to go with websockets as my usecase will be mostly chat
[09:23:18] yashshah: as Websockets connections can both send data to the browser and receive data back from the browser
[09:25:05] rushed: yashshah: the railscasts I linked include a chat sample :)
[09:26:13] toretore: yashshah: the most relevant information i can give you is probably that i don't think you can do websockets from inside rails
[09:30:18] yashshah: toretore: so long pooling is the only option to implement chat inside rails?
[09:30:31] yashshah: rushed: okay thanks :) i am watching them.
[09:30:50] Veejay: yashshah: Server-side events might be able to help as well
[09:31:05] Veejay: See ActionController::Live in Rails 4
[09:31:21] maloik: rushed: out of curiosity, storing the locale object in session is probably bad practice, but theoretically it should work right?
[09:31:32] maloik: I've just changed it around, but I'm still not sure if the error is going to persist
[09:31:55] Veejay: Ah toretore already mentioned that my bad
[09:31:58] toretore: yashshah: in general, rails sucks for lots of persistent connections
[09:32:03] yashshah: Veejay: SSE connections can only push data to the browser., right?
[09:32:26] toretore: yashshah: you may want to have a look at cramp too
[09:32:30] Veejay: toretore: And there's zero investment to change that either
[09:33:05] toretore: Veejay: it would require a change in the entire philisophy
[09:33:05] Veejay: I've always wondered why.. Like request/response web apps are here to stay on the long run
[09:33:32] rushed: maloik: I don't recall you posting your error stack or code, but you are correct it doesn't matter much if it was supposed to be an object or string that turned out to be nil when you called it :)
[09:33:38] yashshah: toretore: okay, so may be i should run seperate node server ( with websocket) for chat
[09:34:00] maloik: that's what I thought... then there's probably an underlaying problem :/
[09:34:15] toretore: yashshah: if you're comfortable with node, sure, it's probably a good option for this problem
[09:34:36] maloik: maybe I need to look into what Nom- said about both setting and accessing the session param in one go
[09:34:53] toretore: it's the classic event loop perfect match
[09:35:17] yashshah: toretore: well i will learn it :) anyway will it be an issue integrating node with rails?
[09:35:28] rushed: maloik: if you want specific feedback on your problem you should probably gist the full error stack and related code :)
[09:35:36] toretore: depends on what you mean by integrate yashshah
[09:35:56] rushed: maloik: if you want general feedback on your problem: don't store objects in the session :)
[09:36:52] maloik: rushed: this is what it used to be: https://gist.github.com/hannesfostie/87910b2edd2b9e1abfc6
[09:36:55] toretore: Veejay: re: rails and all that; when rails was born there wasn't much talk about persistent connections on the web
[09:37:43] maloik: rushed: the before filter was added when my devise controller gave issues, so it should now be setting a default language on each request if it's not present... yet sometimes we still get an error where language cant be called on nil on the session hash, so I'm not sure what's causing that
[09:38:22] yashshah: Every other part of my social network ( Authentication, User model, Friendship model etc ) are implemented in rails. Will it be an issue for integrating private chat implemented in Node to Rails?
[09:41:23] rushed: yashshah: probably? :P
[09:45:32] boytoy: If I do like config.i18n.default_locale = :XX in application.rb, shouldn't Rails automatically load the datetime translations for XX, or must I include them manually into my translation file from https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale ?
[09:47:25] Veejay: toretore: Oh sure, I mean Rails is starting to get old and mature
[09:49:14] Veejay: But I was wondering why it is that the disruptive spirit of the old days got somehow lost along the way. It's been obvious for a few years now that people are moving past that old model and I don't see a real push for a rehaul that would allow Rails to enter that new millennium
[09:49:30] Veejay: I don't know, I might just be bitching for nothing
[09:49:32] lupine: there's plenty of pushes
[09:49:38] jeebster: how come when I su in ubuntu, the bash_profile for that user doesn't kick in? I'm having a hell of a time getting rbenv setup on a vps
[09:49:41] lupine: they're just all in using rails to serve clever javascript
[09:49:44] Veejay: There are SSE after all, it's a step
[09:49:55] lupine: jeebster, interactive vs. non-interactive logins
[09:50:09] jeebster: lupine: that's quite greek to me
[09:50:23] lupine: different profile files are read according to some obscure criteria
[09:50:37] toretore: Veejay: probably just difficult
[09:51:25] Veejay: What pisses me off is that it opened space for other stuff and now Node has claimed that spot
[09:51:26] jeebster: so how can I tell the ubuntu system to read from my bash_profile when switching users?
[09:51:35] toretore: Veejay: the conventional request cycle assumption permeates rails
[09:51:40] jeebster: seems that it's only read once on login
[09:51:44] Veejay: The days of sweet sweet web development with Ruby seem to be over
[09:51:55] Veejay: (I'm being dramatic)
[09:51:55] lupine: you probably want to just enter a subshell, like bash -i
[09:52:00] toretore: Veejay: there is no need to be upset :P
[09:52:23] toretore: Veejay: it's not that difficult to do what node does with ruby
[09:53:03] Veejay: Using EventMachine?
[09:53:03] toretore: there's not the same community focus as in node though
[09:53:11] toretore: par exemple
[09:53:30] Veejay: EventMachine is not a framework with tons of users and shitloads of libraries, spondors and whatnot though :D
[09:53:41] zewelor: how can i check if some route is allowed or not in controller / helper ? Allowed because of constraints in routes
[09:53:48] toretore: but what do you really need?
[09:53:58] jeebster: got it with exec $SHELL -l
[09:54:07] jeebster: hooray, now /root permission denied
[09:54:12] Veejay: The technology is not complicated, Reactor pattern and non-blocking ops, nothing new under the sun
[09:54:17] zewelor: i got constraints that excludes some routes for anonymous user
[09:54:25] Veejay: toretore: Rails has gotten me used to that comfiness know what I mean?
[09:54:32] Veejay: It's cushy
[09:54:48] toretore: Veejay: as i mentioned, lack of focus from the ruby community; it's just not in our blood
[09:55:00] toretore: node was founded on it
[09:55:49] toretore: i do think it's much more relevant to the problems we will be solving now and in the future
[09:55:55] Veejay: It'd be neat to have a framwork that does websockets and whatnot no sweat like Node or Go frameworks
[09:56:00] toretore: rails is going to fall by the wayside
[09:56:02] Dev0p: @jeebster, can you specify your problem. I've got experience with VPS & rbenv
[09:56:05] Veejay: But easy to say
[09:56:17] toretore: well, there is em-websockets
[09:56:30] Veejay: It's the easiest thing in the world, staying on the sideline and complaining like I'm doing
[09:56:31] jeebster: Dev0p: /home/deployer/.rbenv/bin/rbenv: line 30: cd: /root: Permission denied
[09:56:41] Veejay: toretore: There are no easy solutions for websockets / rails
[09:56:51] Dev0p: ok... what ubuntu version are you using, what vps
[09:56:52] jeebster: Dev0p: /home/deployer/.rbenv/bin:/home/deployer/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
[09:56:53] Veejay: It's always in the register of "you CAN do it"
[09:57:12] Dev0p: wait let me fire up my dev environment and take a look at my paths
[09:57:12] boytoy: Are there any benefits in using rbenv over rvm?
[09:57:13] jeebster: Dev0p: digital ocean, ubuntu 12.10 server
[09:57:15] toretore: i've been pretty much over rails for a few years already
[09:57:38] toretore: rails isn't the future of ruby web dev
[09:57:42] Dev0p: ok, i've got a ruby box on digital ocean too
[09:57:48] boytoy: jeebster: I think most cats here are using OpenBSD though
[09:57:57] toretore: that's just how things go, but there's nothing to take its place yet
[09:58:08] Dev0p: what instructions did you follow to setup rbenv. The original instructions on github?
[09:58:18] jeebster: Dev0p: whenever I reload my bash_profile it seems to kick in
[09:58:40] jeebster: Dev0p: I used this, https://github.com/fesplugas/rbenv-installer
[09:58:52] Dev0p: Ah ok, I see just give me a sec
[09:59:30] Veejay: toretore: The future of web development changes every fucking month nowadays though
[09:59:34] Dev0p: Sorry to ask, how experienced are you with devop work?
[09:59:36] Veejay: So don't be too hasty there
[09:59:42] jeebster: Dev0p: not very
[09:59:53] toretore: Veejay: hah, yeah, but i'm pretty sure that concurrency is in the future
[10:00:06] Veejay: hehe that's pretty much a given yes
[10:00:26] toretore: i'm sure http isn't going to last forever either
[10:00:47] toretore: it's not the best fit in a concurrent, distributed world
[10:00:49] Dev0p: Ok, I usually write down the steps I do to install [x]. I've done the same for rbenv and digital ocean. I can put this into a pastie for you. It's hard to figure out what's going wrong with your box.
[10:02:05] toretore: Veejay: what i'd like to see is some more community gathering around EM, with core developments and more libraries
[10:02:21] toretore: or just another, "better" ruby reactor
[10:04:08] Dev0p: @jeebster how do you connect to your box? Do you use ssh-keys or standard password. On the box itself do you use root or du you have a user with sudo rights that you give admin permissions by doing sudo -i?
[10:05:23] oceanbreeze: Guys is there are any pre-packaged rails + ruby installer for linux. I am using virtualbox on windowsxp, and there is a restricted internet connection. So i cant really download ruby _ rails
[10:05:40] jeebster: Dev0p: I setup a user, deployer, belonging to group sudo
[10:06:27] Veejay: toretore: Same here
[10:06:55] Dev0p: ok, but what you also need to do is add it to your sudoer list by switching to root and entering $visudo
[10:07:01] jeebster: so everything works fine if I change directories within the deployer user then reload my bashrc with the proper rbenv path
[10:07:03] Veejay: toretore: Ilya Girgorik and Mike Perham did a lot of work on that subject at some point
[10:07:14] jeebster: the problem is when I su deployer, the default directory is /root
[10:07:37] Veejay: But I guess tey got fed up eventually, one is now at Google being awesome and the other as you know came up with the excellent Sidekiq
[10:07:52] Veejay: Grigorik*
[10:08:09] toretore: Veejay: yeah, lots of good stuff coming from them
[10:08:47] toretore: ilya grigorik still doing lots of interesting stuff though, even though it's not ruby
[10:09:09] Veejay: Just that with Goliath and whatnot I got excited
[10:09:17] Veejay: Seeing a different future y'know
[10:09:25] Veejay: And it never really came to fruition
[10:09:28] toretore: yeah, i'm not that sure about goliath
[10:09:46] oceanbreeze: Guys is there are any pre-packaged rails + ruby installer for linux. I am using virtualbox on windowsxp, and there is a restricted internet connection. So i cant really download ruby _ rails
[10:09:49] Veejay: All the em-* libraries
[10:09:51] toretore: i mean, it's nice and all, but i'm not sure i like the idea of "hiding" complexity behind fibers
[10:10:20] Dev0p: well rbenv is tied to your user. I for example have the user "ror" on my digital ocean vps. In /home/ror/.bashrc I have: export PATH="$HOME/.rbenv/bin:$PATH" and eval "$(rbenv init -)"
[10:10:50] Dev0p: no need to put this into your .profile
[10:11:28] Dev0p: As user "ror" i can then simply call rbenv -h and it works
[10:11:36] toretore: Veejay: have you played with celluloid?
[10:12:01] toretore: i'm a little put off by the em hate coming from that front, tbh
[10:12:50] Veejay: For two reasons: I find it overly complex for now (I guess Celluloid is intended for library writers rather than end-users) and I haven't found practical uses for it
[10:12:55] Veejay: I've dabbled in Go though
[10:13:02] jeebster: Dev0p: yup, those are the last two lines in my /home/deployer/.bashrc, export PATH="$HOME/.rbenv/bin:$PATH"
[10:13:02] Veejay: Fantastic language
[10:13:02] jeebster: eval "$(rbenv init -)"
[10:13:25] toretore: yeah, i should really give it a go (couldn't resist)
[10:13:30] whowantstolivefo: http://www.tumblr.com/tagged/direnadana support us guys
[10:13:52] Veejay: The syntax can be off-putting but damn is it efficient
[10:14:05] Dev0p: ok try this as user "deployer" and tell me what it says: ~# rbenv rehash
[10:14:21] toretore: i'm more in a infrastructure, SOA kind of phase right now
[10:15:52] jeebster: Dev0p: no output, I do have access to the rbenv command though
[10:16:04] jeebster: I get ruby command not found when running ruby -v
[10:16:12] jeebster: my rbenv global looks to be set
[10:17:53] jeebster: rbenv version returns 1.9.3-p429 (set by /home/deployer/.rbenv/version)
[10:18:22] TousBientot: Hi guys... Now install fat free crm on windows, but (!!) the command-> http://pastie.org/8004276 i have a problem, any ideas for the solution?
[10:19:15] Dev0p: And just typing ruby -v on the command line?
[10:19:24] jeebster: ruby not found
[10:19:48] jeebster: so if I set globally again, it will find the proper ruby version. if I exit that user and go back to root, then su deployer again, it loses reference
[10:20:05] Dev0p: Try rbenv versions. What does it say?
[10:20:12] maloik: TousBientot: you're going to need to give us more than that, full stacktrace etc
[10:20:21] jeebster: * 1.9.3-p429 (set by /home/deployer/.rbenv/version)
[10:20:23] msimkins: jeebster, try su - deployer, so it runs your shell init properly
[10:20:26] maloik: also: why are you creating a production db locally? Or are you running a windows server
[10:20:30] spygame: how can i add scope for my email attribute validation using devise ?
[10:20:51] Dev0p: And try this command "rbenv version which ruby"
[10:21:01] msimkins: jeebster, and is it an Ubuntu install ?
[10:21:20] jeebster: Dev0p: 1.9.3-p429 (set by /home/deployer/.rbenv/version)
[10:21:26] jeebster: msimkins: yes, ubuntu 12.10 server
[10:21:48] Dev0p: This all works as user "deployer"? But not as root?
[10:22:22] TousBientot: @maloik, ok, wait now copy
[10:23:19] Dev0p: From what I know this has something to do with sudo switching out the Path and Env. So one way to deal with this, the way I've dont it with my setup is the follwing:
[10:23:31] Dev0p: Step 1) Ditch the root user
[10:23:37] msimkins: jeebster, is your RBENV path, and rbenv init at the very TOP of the .bashrc ? (before the [ -z "$PS1" ] && return line)
[10:24:22] TousBientot: @maloik: http://pastie.org/8004287
[10:24:30] TousBientot: this is the --trace
[10:24:35] jeebster: msimkins: nope, bottom
[10:24:41] Dev0p: If your using ssh-keys to connect to your server by running visudo, add deployer to your list of priviliged users: deployer ALL=NOPASSWD: ALL
[10:24:51] GarethAdams: This is a very specific question, but does anyone know if paper_trail's #reify creates a new version of the object?
[10:24:54] msimkins: jeebster, Put it at the top
[10:25:02] Dev0p: you can then execute root command from deployer by doing sudo -i
[10:25:43] Dev0p: Still rbenv will not work only as user deployer, but this way you can delete your root account on your VPS and just have deployer with admin rights
[10:26:00] msimkins: jeebster, It causes issues when deploying, and can cause some odd su issues I have found, because if the system (somehow) thinks its not an interactive session, the rbenv stuff never gets executed
[10:26:07] jeebster: msimkins: I had tried that before and did it again, to no avail
[10:26:24] jeebster: I don't even see that directive in the .bashrc
[10:26:34] Dev0p: Are you deploying via capistrano?
[10:26:56] jeebster: Dev0p: yes, I haven't deployed yet though. I had another box setup properly on rvm
[10:27:08] maloik: TousBientot: not quite sure... probably something to do with your mysql/mysql2 gem and/or your db
[10:27:25] Dev0p: yeah it took me a while but I have RoR, Rbenv, Cap and Unicorn working on my DigitalOcean box
[10:27:25] maloik: TousBientot: does this only happen for the prod db?
[10:27:34] msimkins: jeebster, Its normally a standard install by Ubuntu, unless you have heavily edited your bashrc - can you paste/gist it ?
[10:28:19] jeebster: this is digitalocean's bashrc default
[10:28:23] jeebster: this is their interactive shell bit
[10:28:24] jeebster: # If not running interactively, don't do anything
[10:28:24] jeebster: *) return;;
[10:28:29] TousBientot: @maloik : i try only for the prod for now.
[10:28:46] jeebster: and I placed the rbenv declarations before that
[10:29:03] maloik: TousBientot: are you running this on the server?
[10:29:05] msimkins: jeebster, have you logged out/in again ?
[10:29:17] jeebster: nope, about to
[10:29:23] jeebster: ssh in and out
[10:30:07] jeebster: msimkins: no change. putting up gist of bashrc in a sec
[10:30:42] arrowcircle: hi! i have a problem with rails autoloading. its "expected my_model.rb to define MyModel". Here is the gist. https://gist.github.com/arrowcircle/5684586 Any ideas how to deal with this?
[10:30:53] toretore: jeebster: how are you starting rails?
[10:31:08] jeebster: http://pastie.org/8004308
[10:31:23] jeebster: toretore: lol I'm not even that far yet, just trying to get ruby up and running
[10:31:41] toretore: jeebster: in my experience, using rbenv or rvm on the server is a waste of time. just install your rubies somewhere like /opt/rubies and run them explicitly
[10:31:55] toretore: jeebster: explicitness is the key to getting anything to run on a server
[10:32:10] lxsameer: hi, i tried to add e prefix to a resource url bye scope
[10:32:19] toretore: full paths, explicitly pass full pahts to log files, config files, etc
[10:32:19] TousBientot: @maloik : yes, beh web server apache, i follow this guide: http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html
[10:32:30] lxsameer: hi, i tried to add e prefix to a resource url bye 'scope "dashboard" do' but it did not applied to post urls, why
[10:32:31] mklappstuhl: Having an admin (=su) and a management (to manage a users resources) interface I need CRUD controllers for every model & interface, is that correct? I can't reuse the admin controller to update a resource in the management interface, can I?
[10:32:36] msimkins: jeebster, and if you echo $PATH ?
[10:32:48] msimkins: I would not put the " around the export line
[10:33:49] jeebster: msimkins: /home/deployer/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
[10:34:14] msimkins: jeebster, hmm, that looks right
[10:35:03] jeebster: msimkins: right, yet bash: ruby: command not found
[10:35:08] jeebster: with ruby -v
[10:35:16] msimkins: jeebster, and the rbenv global 1.9.3-p429
[10:35:20] msimkins: has been run
[10:35:38] jeebster: msimkins: what's really strange is if I call source ~/.bashrc then everything works fine
[10:36:09] jeebster: and yes the global is set
[10:36:24] jeebster: for whatever reason, the bashrc isn't being sourced when I swith to the deployer user
[10:36:28] msimkins: Do you have a .profile, or .bash_profile ?
[10:36:37] TousBientot: @maloik : same problem with development
[10:36:48] jeebster: and I also get this error since the default directory is /root, home/deployer/.rbenv/bin/rbenv: line 30: cd: /root: Permission denied
[10:36:58] msimkins: deployers ?
[10:37:03] msimkins: Thats wrong
[10:37:19] jeebster: msimkins: profile
[10:37:33] jeebster: strange, I'm used to bash_profile, I guess do sets up with profile
[10:37:44] msimkins: edit the /etc/passwd file (as root), to specify the home directory as /home/deployer
[10:37:50] msimkins: (for the deployer user)
[10:38:13] TousBientot: @maloik : this my database.yml ->http://pastie.org/8004325 the problem might to be the configuration?
[10:38:16] spygame: does devise validation_scopes method ?
[10:38:18] msimkins: and make sure .profile sources the .bashrc
[10:38:18] TousBientot: http://pastie.org/8004325
[10:38:49] jeebster: msimkins: this looks right, no? deployer:x:1000:27:,,,:/home/deployer:/bin/bash
[10:39:04] msimkins: so check profile
[10:40:00] jeebster: msimkins: http://pastie.org/8004328
[10:40:18] jeebster: hmm, perhaps the path is being overwritten? looks like it's including the bashrc
[10:40:47] arrowcircle: any ideas about autoloading? https://gist.github.com/arrowcircle/5684586
[10:41:32] msimkins: jeebster, Well, it should not be, as your path looks OK, its just interesting that if you (re) source the bashrc, it all works
[10:41:34] jeebster: so strange, if I su deployer from any other directory besides root, everything runs fine. it's that one damn directory that causes things to go haywire
[10:41:55] jeebster: ex. root:/etc su deployer
[10:41:59] jeebster: and everything runs fine
[10:42:00] msimkins: and su - deployer (there is a subtle difference
[10:42:17] jeebster: I tried su - deployer and no dice
[10:43:02] mr_pause: Is there a way to cascade a save made to a model to associated models built ?
[10:43:07] msimkins: jeebster, There must be a strange permissions problem somewhere on one of the directories....
[10:43:29] arrowcircle: jeebster, what is your problem?
[10:44:05] jeebster: arrowcircle: rbenv craps out when I su deployer from root, get permission denied at deployer:/root
[10:44:32] lxsameer: how can i add a url prefix to a resource ?
[10:44:33] arrowcircle: jeebster, is it in interactive mode or in some script, like capistrano?
[10:44:54] jeebster: interactive, I'm performing this in the command line
[10:45:26] arrowcircle: so you just type su - deployer and get error
[10:45:46] arrowcircle: what exact output you have?
[10:45:54] msimkins: TousBientot, /var/run/mysqld/mysqld.sock wont exist on windows
[10:47:06] msimkins: TousBientot, remove the socket line, and add
[10:47:09] msimkins: host: localhost
[10:47:18] msimkins: and try gain
[10:47:59] codeho: anyone who has worked with activeadmin-axlsx ? i'm having troubles getting helper methods to work inside a column value set
[10:48:03] sedrickcz: hi I need method in model which return path to show action for whichever model I pass. I have this: Rails.application.routes.url_helpers.url_for(controller: 'core/infopages', action: 'show')
[10:48:35] jeebster: arrowcircle: root@somewhere:~# su deployer
[10:48:35] jeebster: /home/deployer/.rbenv/bin/rbenv: line 30: cd: /root: Permission denied
[10:48:35] jeebster: deployer@somewhere:/root$
[10:48:35] jeebster: deployer@somewhere:/root$ ruby -v
[10:48:35] jeebster: bash: ruby: command not found
[10:48:36] jeebster: deployer@somewhere:/root$
[10:49:10] jeebster: things run fine when I source ~/.bashrc
[10:49:11] arrowcircle: you cant access root from deployer
[10:49:25] arrowcircle: also, what you have in .profile and .bash_profile?
[10:51:42] arrowcircle: bashrc is for non-login mode
[10:52:39] jeebster: arrowcircle: right, but that's the default directory when I su deployer from the root account
[10:52:41] codeho: jeebster: i didn't read your whole thread, but is your problem that when you deploy with capistrano you don't get your env?
[10:53:16] arrowcircle: try to login as deployer
[10:53:26] jeebster: arrowcicle: profile, http://pastie.org/8004356
[10:53:26] arrowcircle: do you have valid ruby with rbenv?
[10:53:38] arrowcircle: btw, do you have rbenv initializer in bash_rc and bash_profile?
[10:53:47] arrowcircle: inside deployer home dir?
[10:53:59] jeebster: arrowcircle: bashrc, http://pastie.org/8004358
[10:54:14] jeebster: codeho: haven't yet tried it with capistrano, kind of unnerving I can't get it to work CLI
[10:54:26] codeho: $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
[10:54:27] codeho: $ echo 'eval "$(rbenv init -)"' >> ~/.profile
[10:54:40] arrowcircle: and whats in bash_profile?
[10:54:45] arrowcircle: also, where you have these files?
[10:56:19] Nyris: Hello guys, as far as i know, that a=Array.new would create an array of integers right? what if i wanted to "a" to be an array of strings ?
[10:56:54] DouweM: there are no typed arrays in Ruby
[10:57:03] codeho: jeebster: do these two lines, source .profile, rbenv install your ruby version then rehash
[10:57:37] Nyris: oh i see...
[10:57:48] codeho: Nyris: you want a hash
[10:58:00] Nyris: so why i am getting this errror ? :
[10:58:01] Nyris: >> header.each do |i| dei18n_header[i] = HEADERS[header[i].to_sym] end
[10:58:01] Nyris: !! #<TypeError: can't convert String into Integer>
[10:58:21] codeho: Nyris: coz i is the value
[10:58:23] DouweM: Nyris: because arrays are integer indexes by definition. you want a hash
[10:58:24] codeho: not they key
[10:58:55] codeho: Nyris: http://ruby-doc.org/core-2.0/Hash.html
[10:59:12] TousBientot: @msimkins : i have changed, but same issue
[10:59:14] arrowcircle: any guru of rails autoload? i have a problem with my models. here is the gist https://gist.github.com/arrowcircle/5684586
[10:59:35] TousBientot: http://pastie.org/8004371
[11:00:06] codeho: arrowcircle: whats your problem?
[11:00:53] jeebster: codeho: trying that now, reinstalling the ruby version I already have
[11:00:57] arrowcircle: i have this annoying problem "expected my_model.rb to define MyModel"
[11:01:25] helpa: arrowcircle: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[11:01:25] DouweM: arrowcircle: !fake
[11:01:41] DouweM: arrowcircle: what is the actual error you're receiving? without fake values?
[11:01:46] DouweM: arrowcircle: you can't do that ;)
[11:02:14] arrowcircle: DouweM, actual error is in the gist. "Expected app/models/redditor/text_block.rb to define TextBlock"
[11:02:28] codeho: arrowcircle: are you sure you don't' want self.table_name = "redditor_textblocks"
[11:02:52] DouweM: arrowcircle: whoops, I missed that.
[11:03:05] codeho: yeah i missed the error too :)
[11:04:40] arrowcircle: so any ideas?
[11:05:05] codeho: codeho: arrowcircle: are you sure you don't' want self.table_name = "redditor_textblocks"\
[11:05:11] DouweM: codeho: that's not the issue
[11:05:15] arrowcircle: also, i can access this model with Redditor::TextBlock in rails console
[11:05:25] DouweM: arrowcircle: try module Redditor; class TextBlock; ... end; end;
[11:06:21] arrowcircle: DouweM, already tried
[11:07:15] DouweM: arrowcircle: hmm.
[11:07:44] codeho: i'm pretty sure that it has to be textblock.rb and the table name redditor_textblocks
[11:08:12] DouweM: codeho: no it doesn't
[11:08:23] arrowcircle: https://gist.github.com/arrowcircle/5684586
[11:08:36] arrowcircle: here is uodated gist. i have error, when i trying to access it via controller
[11:08:44] arrowcircle: and its not the table name problem
[11:09:36] DouweM: arrowcircle: post code of how you try to access it in the controller
[11:10:09] arrowcircle: just simple get to /admin/redditor/text_blocks/new
[11:10:56] arrowcircle: "admin/redditor/pages/1/text_blocks/new"
[11:10:58] DouweM: try ::Redditor::TextBlock with the preceding ::
[11:12:55] arrowcircle: DouweM, wise idea. will try now
[11:15:42] arrowcircle: DouweM, ah yeah! it helped!!!! thanks a lot!
[11:15:47] drale2k: Is there something better than securing an API based on just a api token? Anyone could brute force a resource with a list of tokens
[11:16:11] DouweM: it's because you've got all these module naming conflicts going on. Redditor could either mean the root Redditor or Admin::Redditor
[11:16:46] DouweM: drale2k: if you make the api tokens sufficiently large, they'd won't be able to brute force it
[11:16:55] GarethAdams: drale2k: there are 5.3×10^36 different UUIDs
[11:18:41] GarethAdams: at one a second that would take nearly 2 billion billion billion centuries
[11:19:08] DouweM: GarethAdams: where'd you get thet number? 128bit UUIDs would be 2^128 = 3.4*10^38
[11:19:12] drale2k: GarethAdams: when i generate the token using "SecureRandom.hex", couldn't you just use the same function, generate a list and brute force ?
[11:19:20] DouweM: drale2k: lol
[11:19:56] GarethAdams: solars: http://en.wikipedia.org/wiki/Globally_unique_identifier - the total number of unique such GUIDs is 2^122 or 5.3×10^36
[11:20:00] GarethAdams: 6 bits aren't random
[11:20:08] DouweM: GarethAdams: ah!
[11:20:44] DouweM: drale2k: there are 5316911983139663491615228241121378304 possible values, good luck trying all of those
[11:21:08] DouweM: SecureRandom.hex is smaller, but the point still stands
[11:21:12] drale2k: i understand but that only applies if you have one user and one token right ?
[11:21:55] DouweM: drale2k: no
[11:22:34] GarethAdams: well yes, but the probability doesn't change significantly until you get to about as many users as the square root of that number
[11:22:42] DouweM: drale2k: I can't quite follow your train of thought
[11:22:49] drale2k: GarethAdams: yeah
[11:23:08] rushed: I accidentally the whole math
[11:23:28] GarethAdams: drale2k: do you plan to have 2000000000000000000 users?
[11:23:29] drale2k: i just feel if hes lucky he will hit a valid token. Maybe add another token and use hte combination ?
[11:23:44] drale2k: GarethAdams: well i wouldn't mind, but no :P
[11:23:50] GarethAdams: drale2k: then really don't worry
[11:23:56] GarethAdams: drale2k: http://en.wikipedia.org/wiki/Universally_unique_identifier#Random_UUID_probability_of_duplicates
[11:24:05] DouweM: drale2k: his chances of being lucky are 1/5316911983139663491615228241121378304. he'd win a billion lotteries before guessing a valid token
[11:24:12] DouweM: (billions of lotteries actually)
[11:24:20] GarethAdams: "only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%."
[11:24:49] GarethAdams: that's the probability of *any* of those generated UUIDs being a match to any other
[11:25:10] rushed: drale2k: a) l2math b) don't let bad guys go on guessing sprees
[11:25:27] drale2k: So you would take one token sent via a HTTP header, search the user which that token is assigned to and show the requested resource?
[11:25:28] GarethAdams: well that's the other issue. rate-limit your API
[11:25:30] DouweM: drale2k: it's good to be sceptical of any security measures you use, but always trust in the math
[11:25:50] DouweM: drale2k: pretty much
[11:26:11] GarethAdams: drale2k: also, if you're leaking API keys by letting them be sent over insecure HTTP then the probabilities increase quite quickly
[11:26:12] rushed: drale2k: also, https all the things
[11:26:54] rushed: drale2k: all of which I believe are covered in http://railscasts.com/episodes/352-securing-an-api :)
[11:27:12] drale2k: yes SSL is the next step
[11:27:29] drale2k: does it slow down your app? I think i read that
[11:27:47] DouweM: it slows down every connection a little bit, but not your app itself
[11:27:51] GarethAdams: drale2k: you probably heard that the same place you heard that your API keys will be brute forced
[11:28:03] DouweM: connecting is a bit slower because there's more negotation that needs to happen, but that's negligable
[11:28:20] drale2k: DouweM: right, not on the App Server level but on the Web Server level
[11:28:48] DouweM: drale2k: yeah. but don't worry about that. the benefits greatly outweigh the downsides
[11:29:01] dllama: hey guys,
[11:29:52] dllama: hoping someone can help me out with carrierwave. trying to add avatar to user profile, and no matter what i do, i can't get the image to save.
[11:31:25] drale2k: DouweM: ok thx
[11:31:33] DouweM: dllama: we're gonna need more than that. are you seeing any errors?
[11:31:54] dllama: DouweM, no errors, just nothing is happening. i'm not sure if i'm doing my update call proplerly
[11:32:03] DouweM: post code to gist
[11:32:05] dllama: but i tried following every guide i can fine online
[11:32:07] dllama: yup, gisting it now
[11:36:45] dllama: https://gist.github.com/mvoloz/2c27ab2de07ef94079d2
[11:36:54] dllama: that has my model, controller and view
[11:37:19] dllama: as u can see by the user#edit, i've tried like 20 variations of what ever i could have read in guides
[11:37:52] DouweM: @user.update_attributes(params[:user])
[11:38:52] dllama: after AvatarUploader.new ?
[11:38:56] dllama: or i dont even need that?
[11:39:25] DouweM: drop that
[11:40:04] DouweM: you should use strong_parameters though, and I'd look into respond_to/respond_with as well
[11:40:31] JohnBat26: How in Bundler install --pre version of gem ?
[11:41:00] DouweM: JohnBat26: specify the version you want in your gemfile
[11:45:09] dllama: DouweM, that worked, thank you VERY VERY much!
[11:45:26] dllama: i webnt through every wiki link, and there is nothing in the documentation that even comes close to 1 line lol
[11:46:43] DouweM: dllama: it's just how regular Rails update actions work. carrierwave doesn't need any special care
[11:47:05] dllama: I thought there might have been something more involved considering that it should be doing something with the file
[11:47:07] dllama: but now i know
[11:47:32] dllama: just a PITA that all the documentation points in the complete opposite direction of this lol
[11:47:57] DouweM: user.update_attributes(params[:user]) means that user.avatar = params[:user][:avatar] will be called, where that [:avatar] is the file in question. since you've mounted your uploader on :avatar, CarrierWave intercepts that call
[11:48:14] DouweM: and does the right thing(tm)
[11:48:44] dllama: I have another question on this topic if u dont mind
[11:49:13] dllama: i have to grab remote files (it'll have to be via FTP),
[11:49:38] dllama: FTP is my only option, i basically have to synchronize 2 different document folders,
[11:49:56] dllama: would it make sense for me to pass the downloaded file into carrierwave to handle the rest or just manually manipulate it ?
[11:50:45] DouweM: depends on what you want to do with it. if you just want to save it somewhere on the file system, don't use carrierwave. if you want to manipulate the file and potentially link it to a model, use carrierwave
[11:51:52] dllama: each "user" has a ton of assigned documents that i have to grab from another location. so the process has to be something like: get list of documents from db, download each file, attach file to appropriate user
[11:52:25] DouweM: carrierwave it is then
[11:53:25] dllama: thanks again!
[11:53:39] maloik: dllama: carrierwave has a remote_url (or similar) method that you may even be able to use directly
[11:54:12] dllama: i'd love to, but my only option is via FTP, if carrierwave can use FTP protocol that would be fantastic.
[11:54:34] DouweM: dllama: I think remote_url only does HTTP
[11:54:39] maloik: yea it does :/
[11:54:48] dllama: https://github.com/luan/carrierwave-ftp
[11:54:54] dllama: that looks like it might work
[11:55:09] dllama: but based on my experience (as of last night) with carrierwave, nothing is as simple as it should be :)
[11:55:31] DouweM: dllama: nah, that stores the files on FTP, it doesn't download them from it
[11:56:57] dllama: alright, i guess its the manual method the :)
[12:00:30] dllama: DouweM, if i want to manipulate the image on upload, do i pass params[:user][:avatar] to the AvatarUploader?
[12:00:39] dllama: just to resize it
[12:01:17] DouweM: you don't need to use AvatarUploader directly
[12:01:52] dllama: ahh i see that it scale method gets triggered on update
[12:01:54] DouweM: just user @user.avatar = File.open('wherever/youve/saved/the_file.png')
[12:01:57] dllama: it errors but its triggered :)
[12:02:05] dllama: so thast already progress lol
[12:02:22] DouweM: dllama: all processing directives from your AvatarUploader class are triggered when the file is updated
[12:02:31] zmalex: I'm trying to prevent Devise::Mailer to send emails in test environment but it doesn't seem to listen to config.action_mailer.perform_deliveries = false
[12:02:50] DouweM: it does though
[12:03:15] DouweM: how are you concluding it doesn't?
[12:03:40] dllama: DouweM, thanks again! :)
[12:03:45] DouweM: zmalex: you
[12:03:58] zmalex: k. You are right. It does send emails. I'd like to make it stop :)
[12:04:10] DouweM: zmalex: I mean, it should respect that option ;)
[12:04:36] zmalex: DouweM: Hmm. I'm runing through cucumber and I'm pretty sure it uses the test environment.
[12:04:45] DouweM: zmalex: are you actually receiving the emails? or just seeing them in the logd?
[12:05:07] zmalex: DouweM: I can see them being sent. I checked mandrillapp
[12:05:38] DouweM: email not from Devise::Mailer is not being sent?
[12:06:05] zmalex: DouweM: I'm using Devise::Mailer::delay is being sent. Allthough I set perform_deliveries = false
[12:06:23] zmalex: Whoops. Not proper english. But you get what I mean :)
[12:07:10] DouweM: zmalex: that's very strange, because Devise::Mailer < ActiveMailer::Base. It doesn't do anything to handle sending email differently
[12:07:21] zmalex: DouweM: I'd like the mails to end up in the ActionMailer array where they are supposed to end up in test env.
[12:07:25] lxsameer: hey i'm looking for a task scheduler for rails
[12:07:29] zmalex: DouweM: I know right?
[12:07:58] DouweM: zmalex: maybe your delayed worker is not running in test env?
[12:08:27] zmalex: DouweM: Well atleast we confirmed that it should listen to ActionMailer settings. Now to find out why it doesn't. I'm using sidekiq from the delayed mailer. Could that have something to do with it?
[12:08:50] zmalex: DouweM: I'll look into delayed worker using test env or not.
[12:09:14] DouweM: zmalex: and there you go. your app is running in test env, but it's pushing the email job to the sidekiq worker which is running in dev and will happily send the email
[12:10:05] DouweM: zmalex: add `require "sidekiw/testing"` to your spec_helper
[12:10:20] DouweM: zmalex: that way, delayed tasks will be ran inline instead of actually pushed to the worker
[12:10:32] zmalex: DouweM: About that. I have set config.action_mailer.delivery_method = :test and not smtp as it in in dev and prod. How come it seems to read the mailer settings from the dev settings?
[12:10:33] DouweM: i.e. they're not delayed, which is what you want for testing
[12:10:44] DouweM: zmalex: because the worker runs in dev
[12:11:02] arrowcircle: hi! If i have model Redditor::TextBlock, then when i make link_to "", @text_block it will go to "/redditor/text_blocks/1". how i can remove leading "redditor" from url generation?
[12:11:15] zmalex: DouweM: Would it help to start the like sidekiq -e test?
[12:11:30] zmalex: omg what happened to my spelling today
[12:11:31] DouweM: zmalex: sure, but better yet: use that sidekiq/testing I mentioned
[12:11:39] DouweM: it's made for exactly this purpose
[12:12:20] zmalex: DouweM: Thanks. You mention spec_helper. I'm pretty new to specs. Where exactly should the sidekiq/testing be added?
[12:12:33] DouweM: you should have spec/spec_helper.rb
[12:13:08] zmalex: DouweM: And that's it?
[12:13:30] DouweM: add require "sidekiq/testing" there, and it'll run the queued workers inline instead of on the actual sidekiq worker process
[12:13:40] DouweM: so it'll be in test env, and you'll be done
[12:13:55] zmalex: Wonderful.
[12:14:08] zmalex: Should I also fire up bundle exec sidekiq -e test?
[12:14:49] DouweM: not necessary
[12:16:23] zmalex: DouweM: Looking at sidekiq output it still logs lots of DelayedMailer stuff
[12:17:08] dllama: Sorry to keep asking the same question, but does carrierwave always auto rotate images?
[12:17:10] DouweM: post your spec_helper
[12:17:16] DouweM: dllama: it only does what you tell it to
[12:17:25] dllama: how do i tell it to sotp doing that?
[12:17:34] dllama: i dont think i'm passing in any arguments to rotate anythign
[12:17:48] DouweM: dllama: how do you mean it's autorotating?
[12:17:56] dllama: rotating the image 90 degrees
[12:17:59] zmalex: DouweM: https://gist.github.com/martinmalek/65eb67c9feb6bfaf255e
[12:18:12] dllama: basically every image i've tried to upload so far has been rotated 90 degrees
[12:18:41] olalonde: in rails, do singleton resources and plural resources share the same controller typically?
[12:18:48] DouweM: dllama: check this: https://gist.github.com/jcsrb/1510601 and add process :fix_exif_rotation to your uploader
[12:18:48] olalonde: let's say you have /user and /users
[12:19:07] zmalex: DouweM: Not sure it matters but my tests are not in spec. I only keep my FactoryGirl factories there. Rest is in features folder
[12:19:20] zmalex: DouweM: By rest I mean cucumber features and steps
[12:19:31] arrowcircle: DouweM, sorry for bothering again, but maybe you know how to solve routing problem with namespaced models?
[12:19:39] DouweM: I don't have any experiene with cucumber actually, might be you should add the require directive to another cucumber specific file
[12:19:48] DouweM: olalonde: nope
[12:20:02] dllama: once again, thank you! that was it :)
[12:20:13] dllama: i was using code i saw elesewhere that wasn't really working
[12:20:27] olalonde: ah, doesn't that lead to code duplication? they share many actions (show, create, update, delete)
[12:20:28] DouweM: arrowcircle: just use text_block_url(@text_block)
[12:20:29] dllama: was using: https://groups.google.com/forum/?fromgroups#!topic/carrierwave/9wqJ-kn9c-U
[12:20:42] DouweM: olalonde: singular and plural do very different things, they shouldn't share many actions
[12:21:23] olalonde: DouweM: ok. let's say you have /user and /users . /user is just an alias for /user/:logged_in_user_id/ really
[12:21:32] olalonde: DouweM: but you still use 2 different controllers?
[12:22:10] olalonde: for /users/:logged_in_user_id/ *
[12:22:14] arrowcircle: DouweM, its more complex. I use poly has_many association, and i use something like "[:admin, p.object, content_block]", where content block connected with p.object and p.object can change its class
[12:22:15] DouweM: olalonde: you could have the one subclass the other, with one having a find_user! method returning current_user and the other returning User.find(:id)
[12:22:41] olalonde: DouweM: ah ok so inheritance got it
[12:22:56] arrowcircle: and for this string [:admin, p.object, content_block] i get admin_redditor_page_redditor_content_block_path(content_block)
[12:22:59] DouweM: arrowcircle: check out ActiveModel::Name and a self.model_name method on your TextBlock class. it'll allow you to override that stuff
[12:23:27] arrowcircle: DouweM, is that method used for url generation
[12:23:36] DouweM: among other things
[12:23:57] DouweM: that's what the URL generation will check the get certain "versions" of your class's name, such as the version used in URLs and url helpers
[12:24:16] zmalex: DouweM: Ok. Thanks. I'll try to find it.
[12:26:55] olalonde: DouweM: what if you have a before filter in your subclass… which one is executed first?
[12:27:04] olalonde: parent or child
[12:27:29] DouweM: have a before_filter :find_user! and just implement find_user! differently in both controllers. it'll call the version for the actual controller for the request
[12:28:27] olalonde: DouweM: thanks
[12:28:58] zmalex: DouweM: Solved it. - https://github.com/mperham/sidekiq/issues/748
[12:29:00] olalonde: DouweM: I guess before filters in the parent controller are executed first?
[12:29:11] zmalex: DouweM: Minues the /inline/ part in require
[12:29:21] zmalex: minues => minus
[12:29:25] DouweM: olalonde: yeah. but in your case you should just override the filter method
[12:29:33] DouweM: zmalex: *thumbs up*
[12:29:40] zmalex: clap clap :)
[12:32:26] olalonde: DouweM: what about nested resources? do you also use inheritance for those?
[12:33:05] DouweM: olalonde: like /user/resources and /users/123/resources ? yeah, probably, you'll need a different way to find the User object
[12:33:58] Babalau: anyone can help me with his issue ?
[12:34:09] Babalau: usr/share/ruby/gems/rubygems/custom_require.rb:36:in `require': cannot load such file -- rubygems/user_interaction (LoadError)
[12:34:38] DouweM: Babalau: post some code
[12:34:56] olalonde: DouweM: No I mean, let's say you have /companies and /companies/1/users/ . I would probably need before filters from the first in the second
[12:35:07] olalonde: DouweM: to load the company for example
[12:35:38] Babalau: i tried to: rails server
[12:35:42] DouweM: olalonde: ah. no, don't use inheritance there. there'll be a difference anyway. for companies/123 the id will be params[:id], for companies/123/users the id will be in :company_id
[12:35:50] Babalau: usr/share/ruby/gems/rubygems/custom_require.rb:36:in `require': cannot load such file -- rubygems/user_interaction (LoadError)
[12:35:52] Babalau: from /usr/share/ruby/gems/rubygems/custom_require.rb:36:in `require'
[12:36:11] Babalau: and a list of all others from /home....
[12:37:06] Babalau: DouweM: it's here: http://pastebin.com/cwhKpF3t
[12:37:53] olalonde: DouweM: how can I avoid code duplication though? when i create a user in companies/123/users, I need to send an email to the user, etc. same as for /users. any advice on avoiding code duplication? put that stuff in my model?
[12:38:27] Babalau: DouweM: from pastie: http://pastie.org/8004690
[12:38:34] DouweM: in that case, you could Companies::UsersController < ::UsersController
[12:38:49] DouweM: Babalau: not sure why that'd fail. sorry
[12:40:17] Babalau: DouweM: :9
[12:40:28] GeorgesLeYeti: I try to deploy my RoR with capistrano on my VPS, but it seems that all my CSS/JS files didn't push.
[12:40:41] olalonde: DouweM: cool.
[12:41:52] elaptics: GeorgesLeYeti are you using the asset pipeline?
[12:42:45] elaptics: GeorgesLeYeti: did you add the capistrano deployment recipes for the asset pipeline?
[12:43:38] GeorgesLeYeti: elaptics: if you mean the load 'deploy/assets'
[12:44:26] elaptics: GeorgesLeYeti: yes, that. So is it actually running that task?
[12:44:38] GeorgesLeYeti: elaptics: i don't know
[12:45:57] elaptics: GeorgesLeYeti: run it and watch then. You'll see if it's being done
[12:46:39] elaptics: GeorgesLeYeti: it's either that or you're not precompiling something that your app needs. Do you have other stylesheets you're including into pages other than the default application.js and application.css
[12:48:13] GeorgesLeYeti: elaptics: yes all my stylesheets are into "all" folder under asset/stylesheets
[12:48:44] GeorgesLeYeti: apparrt from application.scss
[12:52:42] olalonde: DouweM: what if I have company/123/users/ my Users controller should check if the company exists right?
[12:53:24] GarethAdams: olalonde: Probably it will do something like @users = Company.find(params[:company_id]).users
[12:54:14] olalonde: GarethAdams: ok.
[12:54:15] DouweM: olalonde: yeah, as GarathAdams says. I'd add a before_filter to just find_company! that'll raise an error if it doesn't exist
[12:54:24] GarethAdams: that will fail with a 404 if the company doesn't exist, because ActiveRecord::RecordNotFound is caught by ActionController and turned into a 404
[12:54:29] DouweM: then use @company.users in your users method
[12:54:36] DouweM: GarethAdams: right you are
[12:54:40] elaptics: GeorgesLeYeti: so you only include the application.css into your pages? And when you view the site what does the html source show for the paths to the files?
[12:54:53] elaptics: GeorgesLeYeti: I also assume that on the server public/assets is empty?
[12:55:18] olalonde: GarethAdams: ah nice, didn't know that
[12:55:29] GarethAdams: (by default, it can be configured)
[12:55:49] GarethAdams: s/)/ to do otherwise)/
[12:56:56] GeorgesLeYeti: elaptics: you right i had an "error" on 1st deployment telling me that stylesheets images and javascripts foleder under public directory doesn't exist
[12:57:09] mantas322: im learning rails, and I'd like to implement a user login for a website. Is there a simple example anyone knows of. Do most people use a gem for this?
[12:57:35] mantas322: can I scaffold a new users table and do page filters to check if different users have permissions?
[12:57:39] TousBientot: Why, when at the command -> rake db:create RAILS_ENV= production , the rake aborted, bad file descriptor?
[12:58:01] TousBientot: same error for prod and dev.
[12:58:15] Krikke: RAILS_ENV=production comes before the rake command
[12:58:17] GeorgesLeYeti: i try to push a new migration to redeploy and 2013-06-04 14:51:14 executing `deploy:assets:clean_expired'
[12:58:35] GeorgesLeYeti: sorry wrong line
[12:58:42] elaptics: mantas322: take a look at railscasts.com - lots of resources there
[12:58:46] GeorgesLeYeti: 2013-06-04 14:49:53 executing `deploy:assets:precompile'
[12:59:14] TousBientot: @krikke , so RAILS_ENV=production rake db:create ? right?
[12:59:24] Krikke: TousBientot: yeah that's the way
[13:01:07] DouweM: Krikke: after should work as well
[13:02:13] TousBientot: doubt? why RAILS_ENV.. isn't command for prompt?
[13:03:03] GeorgesLeYeti: elaptics: didn't see i have a Failed to load resource: the server responded with a status of 404 (Not Found) for assets/application-all-b794278449f56b75de129de774d9c61e.css
[13:03:25] Krikke: it's a variable assignment
[13:03:28] Krikke: for the shell
[13:03:51] Krikke: doubt you can put that after the actual command as it will think it's just parameters for the command
[13:04:18] TousBientot: ok, but for the command rake db:create, the error is the same
[13:04:27] DouweM: Krikke: definitely works here
[13:04:41] Krikke: ok, are you running bash?
[13:05:15] TousBientot: also with rails_env=production rake db:create the error is the same
[13:05:21] DouweM: Krikke: http://stackoverflow.com/a/5050412/211041
[13:06:21] elaptics: GeorgesLeYeti: yes, because I assume that public/assets is empty - or it can't find that file in there
[13:11:14] HardFu: undefined method `current_page' for #<ActiveRecord::Relation::ActiveRecord_Relation_User:0x007f9c9a578f80>
[13:11:30] HardFu: I'm having this error when using Kaminari, CanCan and inherited_resources together
[13:11:35] HardFu: rails 4 rc1
[13:11:58] mantas322: elaptics thats your answer for everything
[13:15:06] rsl: hardfu: gist of the code yr calling that raises that?
[13:15:49] crankharder: CanCan is gramatically incorrect... that's probably the problem
[13:16:04] HardFu: https://gist.github.com/carmivore/baa5176221f763a214c6
[13:16:40] JohnBat26: How in bundler install gem from local directory?
[13:16:50] JohnBat26: not folder,
[13:17:17] maloik: JohnBat26: what do you want to do? Add a local gem to your gemfile ?
[13:17:34] maloik: gem 'gemname', path: '../path/to/gem'
[13:17:52] JohnBat26: I have ddd.gem
[13:17:58] elaptics: mantas322: well not everything, but railscasts has a large catalogue of good info. If you ask a more specific question I can be more specific with my answers :)
[13:18:17] rsl: HardFu: so accessible_by is returning a user [relation]?
[13:18:25] mantas322: im looking into devise
[13:18:46] HardFu: rsl, I remove accessible_by
[13:18:46] elaptics: mantas322: more seriously, I would definitely recommend you try implementing authentication from scratch before resorting to a gem so you understand what the gems do for you
[13:18:53] HardFu: and get exactly the same error
[13:19:11] elaptics: mantas322: and especially so if you're looking at devise - in fact they recommend the same themselves in readme iirc
[13:19:15] mantas322: I thought with rails al lthe work was already done for you :)
[13:19:19] HardFu: i think it has something to so with lazy loading, because source of the error shows: <%= paginate @users %>
[13:19:27] rsl: HardFu: weird. i haven't used that combo of things on rails 4 rc so not sure what it is. was hoping it was something more obvious.
[13:19:50] HardFu: yeah, beats me too
[13:20:12] HardFu: rsl: it's awkward, if I remove 'collection' method, error still same
[13:20:38] rsl: hardfu: you're using will_paginate, right?
[13:20:48] rsl: oh i've never used that
[13:20:55] mantas322: 9$ a month for railscasts! boooo >:O
[13:20:56] HardFu: lol in fact, I can remove just about everything from the controller
[13:21:04] defswork_: mantas322, well worth it imho
[13:21:08] DouweM: mantas322: only for the premium episodes. which are well worth it
[13:21:22] HardFu: mantas322: stop whining. I use Rails to make money. Railscats allows me to make money faster. End of story.
[13:21:22] rsl: HardFu: lol it does it on a nil instance variable? heh
[13:21:38] HardFu: class Admin::UsersController < InheritedResources::Base; end
[13:21:39] rsl: well it makes sense that an undefined ivar would not have that method
[13:21:42] HardFu: and still same error
[13:22:04] mantas322: can you share railscast credentials with coworkers?
[13:22:14] HardFu: read their terms
[13:22:48] rsl: HardFu: reading http://stackoverflow.com/questions/11200330/kaminari-rails-pagination-undefined-method-current-page and i see their call to pagination seems different than yrs
[13:23:01] rsl: tried with just page?
[13:23:31] rsl: page seems to be kaminari's version of paginate
[13:23:57] defswork_: paginate isnt kaminari
[13:24:17] rsl: sounds like that's yr problem then.
[13:24:41] rsl: i hate when shit like that happens… cause you read what you think you typed.
[13:24:42] defswork_: hes mixed will_paginage and kaminari up :)
[13:24:52] rsl: and you never see you typed wrong method, etc
[13:25:07] defswork_: whats has_scope in a controller ?
[13:25:14] rsl: then you ask a question and it's obvious to everyone and you feel like an idiot
[13:25:15] defswork_: some plugin or rails 4 stuff ?
[13:25:40] rsl: looks like inherited_resources
[13:25:47] defswork_: rsl, I dont think you need to worry about feeling an idiot
[13:25:50] HardFu: i think it's inherited resources
[13:25:54] HardFu: it works if I put them out
[13:26:01] defswork_: unless you want to get arrested for sexual harassment ;)
[13:26:05] rsl: defswork_: oh but i do. a giant one. having a really hard time with it lately.
[13:26:29] rsl: HardFu: change 'paginate' call to 'page'
[13:26:29] adac: Is there a method for to check if an user has signed in within the last 24 hours?
[13:27:01] HardFu: in controller?
[13:27:01] defswork_: adac - a super magic one that just knows what your app is up to ?
[13:27:19] adac: defswork_, aye :)
[13:27:34] HardFu: defswork_: paginate is called in view, for kaminari
[13:27:46] rsl: adac: devise has modules for that but out of the box nothing on ar would automatically.
[13:27:54] defswork_: HardFu, yes - but page and per are the methods in the Arel chain
[13:28:17] defswork_: paginaite is the view helper to display the page numbers
[13:28:29] adac: rsl, thanks I will chekc the devise docs if I can find something suitable
[13:28:35] defswork_: @users ||= end_of_association_chain.accessible_by(current_ability).paginate(:page => params[:page], :per_page => 10)
[13:28:42] HardFu: that's has_scope
[13:28:42] rsl: adac: think it's 'trackable'
[13:28:42] defswork_: you are calling it in your query
[13:29:12] HardFu: at least I think so :S
[13:30:12] maloik: When doing Model.find_or_create_by_attr(), is there something similar for parent_model.model.find_or_create_by ?
[13:30:56] clocKwize: anyone have a good solution for direct-to-s3 uploads of images? I'm thinking just generate a UUID, upload client side with that as filename, then store it on form post, so when it submits, the server can take the uuid, load the image, thumbnail it, etc and store it against the model..
[13:31:41] maloik: clocKwize: I believe gems like carrierwave etc should let you do that? unless I don't understand what exactly you mean by direct to s3
[13:32:08] clocKwize: maloik: as in have client-side javascript/form post images directly to your S3 bucket
[13:32:28] clocKwize: instead of uploading to my server, then my server uploading to s3
[13:33:02] TousBientot: an error: for the command rake db:create ->rake aborted, bad file descriptor, any ideas?
[13:33:30] defswork_: TousBientot, show config/database.yml
[13:33:59] TousBientot: defswork_ voil: http://pastie.org/8004882
[13:34:33] defswork_: what's all that weird stuff in it ?
[13:34:52] defswork_: inherited settings ?
[13:35:11] ahawkins: how can you step over a line of code using the debugger gem
[13:35:13] TousBientot: yes tha database.yml
[13:35:23] maloik: clocKwize: https://github.com/dwilkie/carrierwave_direct#example-application perhaps ?
[13:35:55] zeh235: hi there. i want to set up the following: i have a table 'bundles' a table 'contents' and a table 'contentgroups'. one content has a content group (content has a contentgroup_id). so, it is possible to use. Bundle.first.contents.first.name, but now, i want to have all contentegroups for one bundle. so i want to use 'Bundle.contentgroups'. is this possible? what kind of relation will i need for this? has_many :through?
[13:36:02] clocKwize: thanks, I'll take a look
[13:36:08] defswork_: TousBientot, not seem <<: and &dev stuff before - wheres that from ?
[13:37:02] defswork_: TousBientot, http://stackoverflow.com/questions/6140493/database-yml-references-not-working
[13:37:07] maloik: defswork_: I've seen that before but it's a bit vague to me
[13:38:20] zeh235: a bundle has many contents, one content belongs to a content group. i want to see all content groups of one bundle (if there is content in the bundle)
[13:38:24] defswork_: cant see the point in complicating database.yml with inheriting from references - it's a 20 line file
[13:38:58] defswork_: is that a DRY gone mad thing again ?
[13:39:04] zeh235: hi there. i want to set up the following: i have a table 'bundles' a table 'contents' and a table 'contentgroups'. one content has a content group (content has a contentgroup_id). so, it is possible to use. Bundle.first.contents.first.name, but now, i want to have all contentegroups for one bundle. so i want to use 'Bundle.contentgroups'. is this possible? what kind of relation will i need for this? has_many :through?
[13:39:42] defswork_: zeh235, what is your relationships for bundle ?
[13:39:44] maloik: zeh235: I would think so, give it a shot :)
[13:39:54] zeh235: a bundle has many contents, one content belongs to a content group. i want to see all content groups of one bundle (if there is content in the bundle)
[13:40:26] defswork_: so bundle has many content_groups through contents
[13:40:46] zeh235: ah, i see, great. i will try that
[13:41:13] defswork_: ACTION goes back to work
[13:41:24] gavit: if one wants to make something general like a model contact which has_many addresses, and has_many emails and has_many phonenumbers etc etc. to make this reusable would this need to become a GEM?
[13:47:04] TousBientot: @defswork_ i not understand, i'm sorry
[13:47:42] zeh235: nice its working. is it also possible now to get all the contents in one contentgroup? like. Bundle.first.contentgroups.all.each ?
[13:52:03] maloik: zeh235: there's an association between contentgroup and contents, right? so just contentgroup.contents should work
[13:52:48] maloik: it wasnt entirely clear to me what you wanted to select though
[14:02:02] TousBientot: i have changed tha libmysql.dll, download a file of win 32 bit (as my win7), for make sure is compatible, but the error is the same
[14:02:28] TousBientot: rake aborted, bad file descriptor
[14:02:49] Radar: Use Ubuntu. Problem solved.
[14:03:23] TousBientot: radar, :) unfortunatly for this project must to work on win
[14:03:39] boytoy: Would be so awesome if Radar would endorse OpenBSD.
[14:04:47] wmoxam: boytoy: I endorse it
[14:04:50] Radar: TousBientot: well, you're on your own
[14:05:02] wmoxam: but not to ppl trying to do Rails on Windows
[14:05:03] boytoy: wmoxam: Bless
[14:05:05] Radar: TousBientot: editing DLLs sounds like you're shooting yourself in the foot
[14:05:21] ooo: A Rake task depending on :environment should have all my models loaded - is that correct?
[14:05:59] wmoxam: ACTION will never understand organizations that try to showhorn everything onto Windows
[14:06:05] wmoxam: *shoehorn
[14:06:08] TousBientot: radar: merci beacoup!
[14:06:38] ooo: Follow-up: There should be no need to require anything by hand? What could mess this up? Engines? Plugins? Devise?
[14:07:07] ledil: is there a tutorial on how to use nested views with activescaffold ?
[14:07:31] wmoxam: boytoy: I have been working on getting vagrant to work better with OpenBSD
[14:07:39] wmoxam: it's a bit of a pain
[14:08:39] boytoy: wmoxam: sweet
[14:08:41] wmoxam: I think I need a bootstrap script that configs NFS so vagrant's shared folder thing can work
[14:08:43] boytoy: havent tried vagrant actually
[14:09:19] boytoy: thats great man
[14:09:36] helpa: ledil: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[14:09:36] Radar: ledil: !debug
[14:09:42] Radar: ledil: see section about active scaffold in there please
[14:09:51] DouweM: ooo: threadsafe! could mess with that
[14:09:53] Radar: particularly "Active Admin and Active Scaffold are the scourges of the Devil and should be avoided at all costs. "
[14:12:05] boytoy: Is it a good idea to block out old versions of IE etc? i.e. http://ruby-journal.com/how-to-block-old-ie-version-with-rails/
[14:12:19] boytoy: as well as old mobile browsers and what not
[14:12:33] maloik: doing it for no reason is not a good idea
[14:13:00] ooo: DouweM: Thanks! I was tearing out my hair. Exhaling.
[14:13:17] boytoy: maloik: doing it so ones users wont have to use crippled versions of ones site
[14:13:36] maloik: you could of course not cripple your site for older browsers ;-)
[14:13:45] maloik: how bad does it get ?
[14:14:16] kenips: hey guys, for memcache store, since there is no delete_match, have you guys come across some good workarounds?
[14:14:34] boytoy: quite bad i think
[14:14:40] boytoy: its full of fancy JS and HTML5 stuff
[14:14:55] passion8: i have People Model , i want to fetch its name , address and country ..only . how can i ?
[14:14:55] DefV: kenips: don't depend on deleting
[14:15:26] kenips: DefV: k... what should I do then?
[14:15:34] DefV: kenips: what are you using memcache for?
[14:15:54] kenips: DefV: sadly, cacheing ActiveResource calls
[14:16:12] DefV: and when do you want to expire them?
[14:16:27] kenips: on update / destroy, etc.
[14:16:31] DefV: just work with updated_at in your memcache
[14:17:04] elaptics: passion8: People.select(:name, :address, ...
[14:17:17] passion8: let me check .
[14:17:22] maddog_: How can I select the first option of a collection select using caoybara?
[14:18:01] kenips: DefV: problem is the AR call has difference args.. so simply looking at updated_at won't be sufficient.
[14:18:02] olivier_bK: https://gs1.wac.edgecastcdn.net/8019B6/data.tumblr.com/277803cfedf919776d35fda3c1714319/tumblr_mnvb7ev2KG1r0u26co1_400.jpg
[14:18:22] DouweM: olivier_bK: ...
[14:18:35] maloik: maddog_: select('Option', :from => 'Select Box')
[14:19:06] DefV: kenips: well, your key at the moment is something with your arguments? Add in updated_at ?
[14:19:41] passion8: thanks elaptics
[14:19:47] maddog_: maloik: the content is auto created, so I don't know the name of the option
[14:20:07] kenips: DefV: correct, and hence i want to use delete_matched to remove them, since the args are different.
[14:20:13] maloik: if by auto created you mean something like a factory, surely you can use some_object.some_association.first ?
[14:20:27] maloik: your values in the select should be predictable
[14:21:22] DefV: kenips: well, if you just add the updated_at value, you'll miss your cache when the item gets updated
[14:21:27] DefV: in your key
[14:23:10] mantas322: can I drop a table from command line?
[14:23:18] mantas322: drop_table :users
[14:23:54] codeho: you should create a migration to remove it
[14:24:57] lxsameer: is there any standard to write a conf/initializer/*.rb file ?
[14:25:02] ariedler: how the ... does one disable sprockets caching in development mode...
[14:25:08] ariedler: lxsameer: no
[14:25:53] lxsameer: ariedler: so a normal ruby file in there will be run at start is it true?
[14:26:16] ariedler: lxsameer: correct
[14:31:51] mantas322: uggggh so frusterating
[14:32:02] mantas322: rails is not fun!
[14:33:31] defswork: mantas322, heresy!
[14:36:59] TousBientot: i crazy, the rake aborted. database.yml: http://pastie.org/8004882#18 why?
[14:37:19] TousBientot: i follow this guide for install fat free crm: http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html
[14:37:27] ariedler: has anyone heard dug DEEP into the ActionView pipeline; I am trying to do some kinda crazy and just need to know if it possible I guess
[14:38:59] kenips: DefV: lol. yes. just been blinded with the block create. Going to rewrite the write now. Thanks!
[14:41:01] Radar: TousBientot: show us the complete output from the rake command please
[14:41:09] Radar: ariedler: what
[14:41:15] Radar: ariedler: sprockets caching in development mode? plz explain
[14:41:55] ariedler: Radar: so I am currently modifying the ActionView+Sprockets pipelines, but tmp/cache holds the previous results...; so I have to do rm -rf tmp/cache all the time to get it to a clean state
[14:42:23] Radar: I thought it cleared out that cache if the file changed?
[14:42:44] ariedler: Radar: the file is not changing; but how I am rendering it is (as in the result is changing, but the file is not)
[14:42:56] Radar: oh, right
[14:43:03] Radar: glhf with that. It's beyond my paygrade
[14:43:18] ariedler: Radar: haha okay; thanks though
[14:49:19] TousBientot: radar: http://pastie.org/8005218
[14:50:12] Radar: TousBientot: no. I am not helping you with Windows problems.
[14:50:25] Radar: This is nothing personal against you. I just really really hate Ruby on Windows.
[14:50:52] TousBientot: no problem radar :)
[14:51:17] lxsameer: do i have access to a model in an initializer ?
[14:51:41] helpa: lxsameer: Why don't you try it and find out for yourself?
[14:51:41] Radar: lxsameer: !try
[14:58:59] codeho: lxsameer: http://www.ruby-forum.com/topic/81576
[14:59:02] codeho: google is your friend
[14:59:33] lxsameer: codeho: thanks . i finished with that
[14:59:56] codeho: very good
[15:02:36] jeebster: how far off would one be to claim the majority of startups are mere modern manifestations of slave trade
[15:03:11] terrellt: Pretty far off. Willing cooperation is a far ways off from slavery.
[15:04:33] jeebster: terrellt: yeah, maybe I'm just crazy for throwing away endless hours of my life for someone else to profit off of
[15:04:52] DouweM: jeebster: if that's the case, you signed a terrible contract
[15:04:56] jeebster: what a sour taste to leave in an engineers life
[15:05:18] jeebster: DouweM: yeah I think I've realized this more-so recently. only one way out
[15:06:24] terrellt: jeebster: Burn the place and take your stapler?
[15:06:34] GarethAdams: I understood that reference
[15:08:55] jeebster: terrellt: yup, maybe make it out with a laptop or two
[15:10:09] blob4000: hey all. if i have a project that has_many users, through roles. how do i add a user to a project via roles?
[15:10:20] ryannielson: I'm trying to remove the div wrapper for a simple_forms field. Do any of you have any idea how to do that?
[15:10:22] blob4000: is it project.roles << user ? if so, that's not working
[15:10:47] fryguy: blob4000: project.users << user
[15:10:54] blob4000: ahh :P thanks
[15:11:16] DouweM: blob4000: the dependency on the :through relation is abstracted away
[15:11:27] blob4000: great. i knew it was something simple
[15:12:02] ericwood: TeknoFiend: oh hai
[15:14:08] blob4000: if roles have a title string, like "Developer", how do i add that to the project.users << user syntax?
[15:17:43] blob4000: another way to ask, if i was going with example 2.4 The has_many :through Association, at http://guides.rubyonrails.org/association_basics.html how would i set the appointment_date as I create an appointment?
[15:19:00] DouweM: blob4000: I've been searching for a couple mins now, and I think this is the closest you're gonna get: http://stackoverflow.com/questions/428066/elegantly-selecting-attributes-from-has-many-through-join-models-in-rails?rq=1
[15:19:05] DouweM: not quite nice syntax, but it'll work
[15:19:18] blob4000: DouweM: very much appreciated :) thank you
[15:34:44] boytoy: Do you guys recommend the new Puma over Unicorn?
[15:35:37] boytoy: https://www.engineyard.com/articles/rails-server -- seems Puma is the winner!
[15:39:43] boytoy: "His benchmarks show Puma using less than one-tenth the active memory of a similar Unicorn setup"
[15:39:46] boytoy: jesus christ
[15:40:19] GeekOnCoffee: disclaimer: I only use it locally
[15:40:46] DouweM: we use puma in production, haven't had any problems, and performance is definitely better than thin. Have never tried unicorn
[15:41:53] fryguy: we still use passenger over here, about to upgrade to passenger 4
[15:42:38] fryguy: GeekOnCoffee: why's that
[15:42:48] GeekOnCoffee: I just don't miss my passenger days
[15:44:14] weckl: Hi everyone. I have an ActiveAdmin "Post" model set, and I'm trying to get foreign field "post_type" on the new action.
[15:44:17] weckl: ActiveAdmin.register Post do
[15:44:21] weckl: f.input :post_type_id
[15:45:05] Nyris: Guys, i wrote few lines of code, and i would like to convert it into a method that i can use it in different models in my app, any advice how would i achive this ?
[15:45:27] weckl: The problem is I'd like to fill it by its name (post_type.name)
[15:45:30] fryguy: Nyris: create a class in lib/ for it
[15:45:56] Nyris: umm ..i will google that fryguy ..thanks for the tip
[15:46:00] weckl: Can somebody give me a hint please..
[15:47:08] DouweM: Nyris: rather, create a Module and include it in your models
[15:47:18] weckl: f.input :post_type_id , is giving me a number field...
[15:47:32] Nyris: DouweM i will google that as well :) thanks
[15:47:53] Nyris: DouweM is it the same as "wrapper" ? or own-gem
[15:47:54] maddog_: Is it possible to use a selector like this: "[id^=order_component_chart_component_chart_positions_attributes][id$=amount]" in capybara?
[15:48:02] maddog_: And more important: How? :)
[15:48:09] DouweM: Nyris: nope, I also have no idea what those are
[15:48:29] Nyris: umm..okay ..thanks..i will do some googling and some homework :D
[15:48:42] codeho: Anyone know how i can create a separate log file only for action mailer? i've searched and nothing i found worked. so far i have: config.action_mailer.logger = Logger.new 'Action Mailer'
[15:48:54] DouweM: maddog_: page.find("that_stuff") doesn't work?
[15:50:06] DouweM: codeho: that sounds about right
[15:50:30] codeho: mum its not creating a new log file. i also touched one, but its not writing to it
[15:51:31] DouweM: codeho: try Logger.new Rails.root.join("logs/action_mailer.log")
[15:51:34] boytoy: GeekOnCoffee: i see the passenger dude getting a bit defensive at http://ruby-journal.com/how-to-setup-rails-app-with-puma-and-nginx/
[15:51:42] codeho: will do..
[15:52:58] codeho: DouweM: awesome. thanks!
[15:53:07] codeho: it worked
[15:53:26] tubbo: boytoy: i hate it when people do that
[15:53:33] codeho: i'm about to send out transactional mails to 16000 people.. i'm horrified.
[15:53:41] tubbo: it's like some of those guys are paid to sit around on IRC and Reddit and just start flame wars
[15:54:02] DouweM: codeho: I hope you're not going to do that with an ActionMailer email in a loop
[15:54:44] codeho: i'm doing batches and i create a new AM instance every time
[15:55:15] mklappstuhl: Having sth like 'has_many :questions, :through => :screening_questions' what should be the name of the array in params containing the ids so that updating the list associated questions works with update_attributes automagically?
[15:56:26] lxsameer: should i have access to variables in MyAPP::Application::variable ?
[15:56:44] DouweM: mklappstuhl: tried question_ids ?
[15:57:05] DouweM: lxsameer: :: indicates a constant, not a variable. what are you trying to do?
[15:57:47] lxsameer: DouweM: that's good point, i try to create a global variable to hold and instance of a class
[15:58:34] DouweM: just create a CONSTANT in an initializer, it'll be available all over the app.
[15:58:49] DouweM: what you're describing is rarely a good idea though, what's the actual use case?
[15:59:44] avril14th: lxsameer: have a variable in application controller cached
[15:59:56] avril14th: if it's a class you can also singleton it
[16:00:20] lxsameer: avril14th: hmm but i need to initialize the in an initializer, its a rufus instance
[16:00:41] avril14th: rufus scheduler?
[16:01:05] lxsameer: avril14th: yeah
[16:01:10] DouweM: lxsameer: in that case, having a RUFUS global constant would do the trick
[16:01:20] defswork: lxsameer, I use an @@ var inside a class method for my globalsettings etc..
[16:01:49] defswork: lxsameer, http://pastie.org/8005509
[16:02:01] maddog_: DouweM: works, thanks :)
[16:02:06] avril14th: lxsameer: def _rufus; sceduler ||= Rufus.new end
[16:02:21] avril14th: then u can do _rufus from all your controllers
[16:02:29] mklappstuhl: also questions & screening_questions
[16:02:38] avril14th: Now I'm not sure a rufus instance needs to be single
[16:02:46] DouweM: avril14th: I wouldn't put this into a controller. it's more of an app-wide thing, so why not use an app-wide constant
[16:02:51] avril14th: meaning I dont see why it wouldn't work to just Rufus.new wherever u please
[16:03:29] avril14th: DouweM: then singleton it
[16:03:31] lxsameer: avril14th: hmm in a application controller ? but i need to define some job in initializer
[16:03:59] avril14th: lxsameer: controlelr initialize?
[16:04:04] avril14th: or model initilialize?
[16:04:08] DouweM: avril14th: that's the other option, but then you'll have another object just to keep track of the rufus instance. So why not just use a RUFUS constant
[16:04:21] lxsameer: avril14th: no app initializer, conf/initializer/
[16:04:51] avril14th: DouweM: everything works, just depend the design you want
[16:04:56] avril14th: having a class that you can singleton
[16:04:59] avril14th: also allows you
[16:05:04] avril14th: to have an initalize
[16:05:11] avril14th: so solving both problem
[16:05:17] avril14th: now I might be wrong :)
[16:05:23] DouweM: lxsameer: so, you've got a couple of options :)
[16:05:29] avril14th: lxsameer: just curious, what are u trying to schedule?
[16:05:40] lxsameer: DouweM: yeah you're right
[16:06:09] lxsameer: avril14th: my users will define some dates , i want to run a code on those dates.
[16:06:54] avril14th: lxsameer: I thought about that I thought it was a bad idea
[16:07:02] johannesvetter: when I run this migration https://gist.github.com/johvet/5707169 it refuses to process it with this message: Index name 'temp_index_altered_transcodings_on_transcodable_id_and_transcodable_type' on table 'altered_transcodings' is too long; the limit is 64 characters. The problem now is, how to specify or control this temporary index name?
[16:07:04] lxsameer: avril14th: i was thinking about storing dates in a model and read them each 5 minutes and schedule them using rufus
[16:07:21] lxsameer: avril14th: what's your idea my friend ?
[16:07:29] mklappstuhl: DouweM: ok, apparently question_ids worked after a while
[16:07:31] DouweM: lxsameer: why not use something like https://github.com/mperham/sidekiq/wiki/Scheduled-Jobs ?
[16:07:39] avril14th: I'm in the middle of trying all this
[16:07:45] avril14th: but my best yet solution
[16:07:57] avril14th: is to use redis with persitance + a sidekiq + perform_at
[16:08:07] avril14th: so close to what DouweM just pointed at
[16:08:36] arrowcircle: DouweM, could you please answer another annoying question? can i use STI on input class to connect digital and text inputs to category? https://gist.github.com/arrowcircle/5707191
[16:08:41] lxsameer: DouweM: i'm looking at it,
[16:08:55] lxsameer: avril14th: i have to take a look at perfom_at and sidekiq
[16:09:14] DouweM: arrowcircle: seems good to me
[16:09:41] DouweM: arrowcircle: also, you might get more answers if you just direct your questions at the channel rather than me in particular ;)
[16:09:43] lxsameer: DouweM: avril14th any way, thanks guys
[16:10:05] arrowcircle: DouweM, ie if i catch category.inputs - it will get me array of digits and texts model objects?
[16:10:12] DouweM: arrowcircle: yup
[16:10:49] DouweM: arrowcircle: it's STI so they're all in the same database table, they're just instantiated as different types of objects in Rails
[16:12:11] arrowcircle: DouweM, ok, and what to add to this class structure, to have an ability to add predefined arrays of values? ie introduce new class Input::Predefined, that will have another association with predefined values?
[16:12:47] DouweM: arrowcircle: I'm not exactly sure qhat you're trying to accomplish, but that sounds all right to me
[16:13:07] f0ster: avril14th: never heard of sidekiq, looks sweet
[16:13:14] arrowcircle: also, thats the best way to connect this properties to notice? now i use postgres hstore to store inputs valiues like notice.params[input_id] = value
[16:13:21] f0ster: avril14th: I have a bunch of async jobs I just run in a rake task through a cronjob lol
[16:13:33] arrowcircle: arrowcircle, should i use another table with classic data types?
[16:13:59] DouweM: f0ster: a poor man's message processing queue
[16:14:00] avril14th: many ways to do many things
[16:14:09] avril14th: sidekiq is my thing
[16:14:17] DouweM: yeah much <3 for sidekiq
[16:14:40] DouweM: arrowcircle: I have no idea
[16:15:47] f0ster: yeah maybe if i needed full fledged event architecture I'd use something diff
[16:15:49] zmalex: I'm looking for a good forum to discuss architecture of a rails project where we want to have a dynamic hierarchy / grouping of items which today have AR relations.
[16:15:53] f0ster: libevent for ruby ?
[16:16:07] arrowcircle: btw, any sidekiq competitors working on beanstalk message queue?
[16:16:43] arrowcircle: zmalex, what you mean by dynamic hierachy?
[16:16:58] zmalex: arrowcircle: Maybe not the right way to put it but let me explain.
[16:17:46] zmalex: arrowcircle: We want a way to dynamically group doors where the group hierarchies can be set in runtime instead of through AR relations.
[16:17:54] lxsameer: avril14th: do i have to use redis for sidekiq task storage ?
[16:18:07] DouweM: arrowcircle: a quick google gives me https://github.com/nesquena/backburner
[16:18:12] zmalex: arrowcircle: The background is that we today group Organizations, Sites, Tenants, Doors
[16:18:15] avril14th: avril14th: sidekiq doesn't work without redis
[16:18:19] avril14th: check the railscast
[16:18:19] DouweM: lxsameer: because it needs to store the queued messages somewhere, and because redis is perfect for that
[16:18:21] avril14th: and the doc
[16:18:36] avril14th: only question you have to ask yourself is persistance for your db
[16:18:51] avril14th: this you'll find in redis documents
[16:19:00] zmalex: arrowcircle: But that's very static and prone to change and will in the long run end up in a billion AR where the actual groups hierarchy is just metadata to what we want to do.
[16:19:17] lxsameer: DouweM: so since my queue is very small is it ok to use current db to store them ?
[16:19:30] DouweM: lxsameer: you can't, sidekiq requires redis
[16:19:56] lxsameer: DouweM: aha thanks man
[16:19:58] zmalex: arrowcircle: So I want to build something maybe using polymorphism on an owner column. Following the owner item would provide the hierrarchy
[16:20:45] zmalex: arrowcircle: This would let users create own groups of doors and at the same time allow for business cases to build up their own group hierarchies.
[16:20:54] zmalex: arrowcircle: Am i making any sense?
[16:21:06] arrowcircle: DouweM, its not celluloid driven
[16:23:33] arrowcircle: btw, how you restart sidekiq on deploys? with sitekiqctl?
[16:24:08] avril14th: arrowcircle: foreman
[16:24:12] DouweM: on Heroku it's done automatically, otherwise I don't know
[16:24:26] DouweM: https://github.com/mperham/sidekiq/wiki/Deployment
[16:24:27] arrowcircle: avril14th, in production i mean
[16:24:36] avril14th: still foreman
[16:24:49] DouweM: arrowcircle: capistrano will restart sidekiq for you if so configured
[16:25:34] davidcelis: arrowcircle: just require 'sidekiq/capistrano' and it happens automatically
[16:25:41] arrowcircle: DouweM, and how to deal with jobs, that takes more time, than in timeout? will my deploy take 60 (timeout) seconds longer?
[16:26:13] DouweM: you mean if you try to deploy while a task is running?
[16:29:44] DouweM: arrowcircle: if the timeout is 60, it'll wait that long. but workers should be idempotent anyway, so it could be sidekiq just quits immediately and runs the worker again the next time
[16:43:27] Sylario: I'm sending mails in dev mode, where are the logs? Is it only in the terminal where i run rails s ?
[16:44:45] DouweM: log/development.log
[16:45:14] Radar: Sylario: If you want to be checking those emails then I would highly recommend using the mailcatcher gem
[16:45:23] Radar: Sylario: https://github.com/sj26/mailcatcher
[16:45:33] Sylario: Radar : as a dev only gem?
[16:45:41] Radar: Sylario: yes
[16:46:35] DouweM: Sylario: also check out letter_opener, it might be bit easier to set up
[16:47:15] Sylario: thx Radar, DouweM, i am gem installing!
[16:48:44] Sylario: i like mailcatcher
[16:55:15] codeho: i hate email
[16:56:27] Radar: codeho: that's nice dear
[16:57:38] spazm: IS DIS RUBYONBAILS?
[16:58:19] rsl: good to see web irc users haven't changed
[16:59:07] rsl: ACTION pulls up a chair
[17:00:00] Radar: +b spazm!*@*
[17:00:03] Radar: spazm: Fuck off.
[17:00:16] rsl: radar: ooh he managed to get one in juuuuust before the kick. he's a pro.
[17:00:24] Radar: +b *!*@*gateway/web/freenode/ip*
[17:00:35] Radar: We've been getting a ton of abuse from webclients. It's time they were banned.
[17:00:40] Radar: Connect using a real client or GTFO.
[17:00:53] rsl: radar: didn't they get the ban back in the day?
[17:00:57] brendan6: Hey! I have a class setup like so http://pastie.org/8005703 and everything works exactly as expected however there is a class variable that is used that makes me hesitant. Does this setup look ok?
[17:00:58] Radar: rsl: They did.
[17:01:01] rsl: mibbit, etc
[17:01:50] rsl: brendan6: why not use a class instance variable?
[17:02:02] bmsatierf: What would be the Rails way to perform a HTTP Post on a URL that requires authentication? With curl, I can do something like: http://pastebin.com/2iBQZX4j
[17:02:09] brendan6: rsl: It is setup as a singleton
[17:02:30] bmsatierf: kk gotta use pastie.org next time
[17:02:39] brendan6: rsl: Or sorry, was thinking of the wrong item.
[17:03:08] brendan6: rsl: I could but doesn't the method track_on_activities only get run on compile time?
[17:04:08] rsl: brendan6: compile time?
[17:04:53] rsl: that wouldn't get set until the method's run
[17:05:39] brendan6: rsl: Right but that would only happen once correct? As in when classes are cached and not on every instantiation of Statistics::Item
[17:05:45] rsl: per request
[17:05:47] boytoy: tubbo: hehe yeah
[17:06:02] rsl: wait that last part isn't a request/controller thing ;)
[17:06:31] rsl: brendan6: does anything inherit ever from Statistics::Item?
[17:07:57] rsl: do you change activities at runtime?
[17:08:03] brendan6: rsl: Never, hard coded
[17:08:16] brendan6: rsl: Trying for a DSL like has_many :articles
[17:09:31] rsl: i'd still use a class instance variable personally there but that works
[17:12:35] brendan6: rsl: I think I found the answer after some digging. http://bit.ly/WBm54s And you're right, that is the approach I am going to take
[17:12:58] rayrod2030: What's the preferred way to call a rake task from within a cucumber/rspec test?
[17:13:08] brendan6: rsl: Although Item never gets subclasses, Base will get subclasses multiple times and that will cause issues with @@activities. Thanks!
[17:13:13] rsl: brendan6: yeah i mean. it works. and if you aren't ever gonna inherit… it may never bite you. but for some reason [premature optimization] i'd avoid it personally.
[17:14:15] rsl: not sure it's defined on base there though. pretty sure the class there is item still
[17:18:08] rsl: yup yup. that's the bugger there.
[17:18:24] rsl: ACTION forgot it works reverse [upstream] like that
[17:19:24] werdnativ: Hey is there anything in activerecord to say if a model is newly persisted, i.e. just been created, not reloaded from db?
[17:21:50] rsl: werdnativ: new_record? or persisted?
[17:21:59] werdnativ: I guess i can use an after_create callback to set an ivar… just wondering if there is already something for it.
[17:22:27] werdnativ: rsl, I know those… but persisted is true for old reloaded records too.
[17:23:05] rsl: werdnativ: you care about it being changed not just time delta from db load right?
[17:24:27] werdnativ: rsl, I build a ImportTable that has many ImportCells. the cells "touch" the parent table… but when I trigger the first save on the the parent table, each cell "updates" the parent table as it gets saved.
[17:25:03] werdnativ: so I need to say touch: proc { |c| c.parent_table.newly_persisted? } or similar
[17:25:41] rsl: werdnativ: i see then. i've never found anything for that. just set ivars in the past.
[17:25:54] rsl: i don't bother changing them in a callback.
[17:26:06] werdnativ: yup. doing that! thanks.
[17:26:22] rsl: just setting them manually when i do whatever… like if i do touch i might add ivar for @touched = true
[17:26:29] rsl: then if not touched it's already falsy.
[17:28:37] werdnativ: that almost seems like it should be made default behaviour… I might try: def touch; @touched=true; super; end
[17:28:52] DouweM: don't do that, touch already is a method on AR models
[17:29:03] DouweM: I didn't see the super
[17:29:17] werdnativ: and I mean super unless @touched
[17:30:01] rsl: werdnativ: that's always true though if the line just before it always sets it, no?
[17:30:17] werdnativ: yeah, other order…
[17:30:20] werdnativ: that way it only saves to the database the first time.
[17:31:51] rsl: i'd personally check changed? as well there just to be safe
[17:32:17] werdnativ: to be clear: def touch; super unless @touched; @touched = true; end
[17:32:58] rsl: def touchable?; changed? || !!@touched; end
[17:33:47] rsl: to be more readable than super unless foo || !!bar
[17:35:31] superscott[8]: has anybody seen any projects using Rail4 with Ember yet?
[17:38:39] werdnativ: rsl, I don't think "changed" should play into it. I might want to allow touching it even when it hasn't changed. (like when only its association changes.)
[17:39:06] rhizome: use :touch => true on the association
[17:41:41] werdnativ: rhizome: I am. the question is when multiple children all get saved and each one touches the parent, it triggers too many needless sql updates. Only need to touch once.
[17:48:44] lectrick: 1) Has anyone written a REST API and 2) how do you communicate versions? (other than the URL versioning scheme, say you have a minor version change that might require web clients of the API to reload?)
[17:50:49] davidcelis: you don't minor version an API
[17:51:31] TheMoonMaster: lectrick: Once your API is in place, changes are bad.
[17:51:41] TheMoonMaster: Additions not so bad, but changes that aren't versioned? No way.
[17:51:47] lectrick: TheMoonMaster: That's fine, but change happens.
[17:51:56] TheMoonMaster: Right, that's why you version them.
[17:51:59] lectrick: I want to version those changes.
[17:52:20] davidcelis: then why would you need to require web clients reload?
[17:52:22] TheMoonMaster: namespace them.
[17:52:24] davidcelis: they'll keep using the same version
[17:52:53] lectrick: davidcelis: Which is why we want to, say, put a version number in a header. If it increments, force a reload.
[17:53:04] TheMoonMaster: api/v1 api/v2 etc.
[17:53:14] lectrick: We need more fine grained control than that
[17:53:16] TheMoonMaster: lectrick: Force a reload?
[17:53:19] DouweM: how do you mean "reload"?
[17:53:27] davidcelis: why do you need to force a reload if they keep requesting the same version
[17:53:51] davidcelis: why would their requested version change until they actually refresh and re-request assets
[17:53:53] lectrick: OK, as a simple example: The Google Chrome web store literally just said this to me: "Error: A new version of the Chrome Store app is available. Reloading..."
[17:54:07] davidcelis: pub/sub, then?
[17:54:15] DouweM: if you change the API, the client's implementation needs to change
[17:54:33] TheMoonMaster: Wait, is this a public API for developers?
[17:54:47] DouweM: TheMoonMaster could be onto something
[17:54:54] lectrick: DouweM: We're our own client, for the time being, but others will be soon
[17:55:00] lectrick: TheMoonMaster: It's a public API, yeah
[17:55:13] TheMoonMaster: Then just saying, "this is outdated" won't cut it.
[17:55:34] TheMoonMaster: How do they know what changed? Why do they randomly have to rewrite their implementation just because you changed a few things?
[17:55:41] DouweM: if it's a private API, you could force a reload of the client-side app, but you can't force a third party to magically support a new version of the API :/
[17:55:52] davidcelis: dude what it comes down to is that clients should be requesting a version
[17:55:53] TheMoonMaster: That's why you have versioning in place. So you can deprecate old version in favor of new versions.
[17:56:01] davidcelis: if you bump the version, they can change their implementation and bump the version they request
[17:56:05] davidcelis: you are waaay overthinking this
[17:56:06] lectrick: TheMoonMaster: OK good point. Let me think, hol don
[17:57:19] lectrick: davidcelis: yeah good points all. let me gnaw
[17:57:34] kedarm: lectrick: Would using human-readable messages help to cope with something that changed incompatibly?
[17:57:38] bricker: davidcelis: I missed it, what was your reason for not minor-versioning an API?
[17:57:58] davidcelis: there's no point
[17:58:05] davidcelis: minor versioning should not break existing functionality
[17:58:06] lectrick: bricker: their point was that any API change at all requires a client change which is why all changes need to reflect a new endpoint
[17:58:26] davidcelis: the only version you really need to implement in an API is a major version, since that's what breaks shit
[17:58:34] lectrick: kedarm: yeah, that's another idea
[17:58:48] TheMoonMaster: If your changes will break backwards compatibility, you need to add a new endpoint/version.
[17:58:50] bricker: I minor-version APIs usually just to indicate additional functionality
[17:58:53] TheMoonMaster: That should be the rule of thumb.
[17:59:26] TheMoonMaster: I wouldn't "minor" version it, but I would definitely put in the docs when things were added and what was added.
[17:59:34] lectrick: bricker: Yeah, that's along the lines of what I was thinking about. Not breaking old endpoints, just adding new ones
[17:59:47] kedarm: Whoa! lots of logins and outs
[18:00:13] TheMoonMaster: lectrick: That makes little sense.
[18:00:17] TheMoonMaster: Then you end up with a mess of versions.
[18:00:24] TheMoonMaster: It would be a maintainability nightmare.
[18:00:35] TheMoonMaster: A plethora of code duplication as well.
[18:00:42] lectrick: TheMoonMaster: We already do that :)
[18:00:45] bricker: TheMoonMaster: well it's not like they can request version 3.2.4 or whatever, but it's more of just letting them know that something is different. It could also help them hack around anything that changed that they didn't want to change
[18:01:19] TheMoonMaster: bricker: But nothing should have changed that would have broken previous compatibility?
[18:02:37] bricker: TheMoonMaster: not necessarily broken, just "different" - a contrived example, but if we started capitalizing a byline or something - I wouldn't conbsider that a "breaking change" (certainly not worthy of a major version bump), especially if it was never documented that Bylines won't be capitalized - but someone might not want it capitalized.
[18:03:08] TheMoonMaster: I was assuming something like a date format changing or something along those lines.
[18:03:32] TheMoonMaster: Either way, even something that small has the potential to upset developers, but that's more of a case by case scenario.
[18:04:52] bricker: lectrick: I only have separate endpoints (and directories in the app) for major versions - minor version changes don't get their own endpoint
[18:06:05] kedarm: lectrick: I am with TheMoonMaster on this. After you're done with the "too-fine-grained" API, if you use it once, you may find it hard to work with.
[18:06:41] olalonde: which is better: delete obj.property or obj.property = undefined ?
[18:06:51] olalonde: I think I read the performance was better on the latter
[18:06:53] olalonde: but cant remember
[18:06:59] TheMoonMaster: Performance on the latter is better.
[18:07:36] Aristata: Does anyone here have any experience with the 'vpim' gem?
[18:07:36] TheMoonMaster: I think hasOwnProperty will return true on it though.
[18:08:37] Aristata: Does anyone here have any experience with the 'vpim' gem?
[18:09:37] olalonde: when you output the JSON for a resource, what are good guidelines to know how many nested objects and how deep you should output?
[18:09:44] slash_nick: anyone know of a plugin that'll provide a "Session ends in 2 minutes, click here to extend" feature?
[18:10:30] olalonde: does anyone understand my question?
[18:10:53] slash_nick: olalonde: as deep as they need to be
[18:11:28] olalonde: slash_nick: yes, my question is how do I know how deep it needs to be?
[18:11:56] olalonde: slash_nick: wouldn't make much sense to output my whole object graph on every request due to bandwidth limitations ...
[18:12:06] rhizome_: so only output what you need
[18:12:13] slash_nick: olalonde: use common sense.
[18:12:44] olalonde: i was just wondering if there were some common rules for that or if people just go with their common sense :)
[18:12:58] abhinavmehta: I've wrote simple ActionMailer code, it works! Now I need output as string(code generated after parsing erb) in my app/mailer/mailer.rb …how can I get that?
[18:13:10] olalonde: probably some REST maniacs would say that you shouldn't output a nested object if it has its own URL
[18:14:07] jeebster: any recommendations for super-sleek yet affordable laptops for running linux?
[18:14:07] abhinavmehta: problem is, controller picks up its corresponding view, parse it and sends it as email…now what if I need my view back in controller?
[18:14:21] abhinavmehta: jeebster: Macbook
[18:14:31] slash_nick: jeebster: http://www.system76.com
[18:14:47] jeebster: abhinavmehta: I've got a macbook for work, and not unix :\
[18:14:48] slash_nick: jeebster: you don't pay the Windows tax
[18:14:58] jeebster: want something a tad cheaper, apple makes a great product though
[18:15:29] olalonde: those look pretty bulky though
[18:15:33] abhinavmehta: jeebster: hows ec2 or such vm-instance then?
[18:15:37] jeebster: slash_nick: I like the price range but definitely have some junk in the trunk
[18:17:54] jeebster: abhinavmehta: eh? not looking for vm
[18:17:54] jeebster: I guess you really do pay the cost for solid hardware. acers comparable to macbooks run almost the same price
[18:19:39] olalonde: jeebster: i heard good stuff about the asus super something let me google that
[18:19:41] olalonde: asus zenbook i think
[18:19:41] olalonde: looks like a macbook air
[18:19:41] olalonde: I use a macbook air but i will consider switching to that one when i buy a new laptop, pretty happy with macbook air though
[18:20:14] Radar: abhinavmehta: I don't understand your question.
[18:20:44] bricker: Anybody in here using a Raspberry Pi for anything interesting?
[18:20:58] slash_nick: jeebster: did you look at system 76?
[18:21:21] jeebster: slash_nick: yeah, they're fatties
[18:21:33] abhinavmehta: Radar: I'm newbie, so pardon if doing typo…the thing is, how can I get rendered view in controller..
[18:21:36] slash_nick: lol... need it to fit in your purse?
[18:22:12] Radar: abhinavmehta: Why do you want that?
[18:22:26] billiam: bricker: define interesting :)
[18:22:58] abhinavmehta: Radar: before I call mail(..), I want output of my erb referenced to some variable
[18:23:04] s2013: Radar for uploading multiple files which gem do you prefer
[18:23:07] slash_nick: abhinavmehta: http://apidock.com/rails/ActionController/Base/render_to_string
[18:23:28] Radar: s2013: paperclip, carrierwave or dragonfly
[18:23:36] slash_nick: s2013: why would paperclip vs carrierwave matter for multiple?
[18:23:39] Radar: abhinavmehta: You're still not answering the question. What problem are you trying to solve?
[18:23:51] jstrong1: slash_nick: I personally prefer carrierwave
[18:24:12] TheMoonMaster: I like both Carrierwave and Paperclip.
[18:24:15] s2013: cause i tried to use paperclip and i just couldnt get it to work. all the tutorials i see esp on railscast is for carrierwave so i might try that
[18:24:22] TheMoonMaster: I hate Carrierwave generators.
[18:24:57] tubbo: i see no reason to use paperclip anymore
[18:25:32] abhinavmehta: Radar: I've wrote some auto-mailer, now along with sending those emails, I want to store those html pages to my db for some reasons…so how to get that rendered erb.html to some variable