« Back to channel list

#RubyOnRails - 12 December 2013

« Back 1 day Forward 1 day »
[00:18:19] rhizome: or cap -d deploy:check
[00:26:04] Yatekii: guys do you see any mistakes on that line: @sales = @sales.where("name like ? and created_at >= ? and created_at <= ?", "%#{params[:search]}%", params[:starting_date], params[:ending_date]) if !params[:search].blank?
[00:26:11] Yatekii: ah mom I paste it
[00:26:55] Yatekii: http://ideone.com/0DqpkJ
[00:28:33] lethjakman: Yatekii: you need to be more specific
[00:28:39] lethjakman: what is the problem?
[00:28:46] lethjakman: error messages.
[00:28:49] lethjakman: all that stuff.
[00:28:50] Yatekii: well I want to have just the entries that are between 2 dates
[00:29:03] Yatekii: but somehow it just shows ALL the results and not just the ones in between
[00:29:06] Yatekii: no error message
[00:29:49] Yatekii: I am very very new to ruby
[00:31:09] lethjakman: Yatekii: Rails.logger.info "#{params[:starting_date]} #{params[:ending_date])}"
[00:33:25] drale2k: Does someone know a channel on IRC about web services, pricing a product etc?
[00:33:47] Yatekii: lethjakman: what do you mean by that?
[00:33:48] drale2k: subscription pricing for example
[00:34:34] lethjakman: Yatekii: log the output of that string. I want to know what starting_date and ending_date look like
[00:35:35] Yatekii: lethjakman: I have no Idea how to log but fortunately it logs all the values anyways so here they are:
[00:35:41] Yatekii: starting_date: '2013-12-12'
[00:35:41] Yatekii: ending_date: '2013-12-12'
[00:39:36] lethjakman: Yatekii: that's probably your problem.
[00:39:38] lethjakman: what DB are you using?
[00:42:45] Yatekii: lethjakman: sqlit3
[00:42:58] lethjakman: Yatekii: is that what you want to stick with?
[00:43:06] Yatekii: in the final version it'll be msql but that should not make big of a difference i guess
[00:43:35] lethjakman: I'd highly recommend moving there now, they have better date time comparison tools
[00:43:37] lethjakman: http://stackoverflow.com/questions/1975737/sqlite-datetime-comparison
[00:43:42] lethjakman: but if you want to use sqlite I'd use this
[00:43:50] lethjakman: also I'd recommend postgres just cause it's very nice.
[00:43:55] lethjakman: but that's unrelated.
[00:44:26] Yatekii: I used Date.current but I dunno how the datetime in created_at was created since I cannot find the definition oO
[00:44:45] Yatekii: well the db is not my descision
[00:46:04] lethjakman: ahh yeah I'm just saying switch now cause mysql and postgres handle dates differently. but if you want to see the type I'd use '.schema table_name' in your db.
[00:46:11] lethjakman: that will tell you what the types are
[00:47:36] lethjakman: s/postgres/sqlite3/
[00:48:03] Yatekii: lethjakman: I know to read the tables but I was wondering where rails has the definition for created_at because I cannot find the file where it's set
[00:48:11] Yatekii: still very confusing the whole thing :)
[00:48:51] lethjakman: Yatekii: oh. I don't know honestly. I just know how it works in postgres. somewhere in the migration source code probably. it's coming from the datetime in your migration though.
[00:49:29] Yatekii: hmm I use datetime() in the query now but doesn't work I guess I will try some other stuff
[00:49:34] Yatekii: thanks anyways
[00:56:40] lethjakman: has anyone ever seen anything like this? when I run cap staging git:check --trace I get this: https://gist.github.com/lethjakman/7921470
[00:57:21] Yatekii: I'm off gn8 :)
[00:57:35] lethjakman: yellow5: cya and good luck
[01:00:10] rhizome: lethjakman: what is "ip_address" and "my_app.io"?
[01:04:11] lethjakman: rhizome: that's the ip address of my server and my_app.io is the domain name of my server.
[01:04:40] platzhirsch: What if I want to cache data for a certain entity? How would I choose the key?
[01:05:18] lethjakman: platzhirsch: based off of its id with the name of the entity?
[01:05:33] lethjakman: I think you can just use the actual model for that.
[01:05:42] platzhirsch: ok, wasn't sure :)
[01:06:01] lethjakman: check me but I think if you use the model it comes out as <ModelName ID>
[01:06:36] rhizome: lethjakman so it's trying to mkdir twice on the same machine?
[01:06:44] lethjakman: rhizome: yeah....don't know why.
[01:07:34] lethjakman: want to see staging.rb or deply.rb?
[01:07:45] lethjakman: I can toss those up. have to remove my IP and domain but other than that it's good.
[01:08:33] Duckily: is there a ruby method to do this? [1, 2, 3].some_method(2) => [1,3]
[01:08:48] platzhirsch: okay, let's cache that bastard
[01:08:51] Duckily: can't find it in the long docs
[01:09:13] lethjakman: Duckily: what exactly is "this?"
[01:09:32] Duckily: lethjakman: look at the code after it...
[01:09:45] Duckily: remove an element from an array by value and return the resulting array
[01:09:58] lethjakman: are you removing the middle element, removing all 2's, randomly removing one of them? removing all even numbers?
[01:10:00] lethjakman: that could be a lot of things.
[01:10:16] Duckily: sorry, the value 2
[01:10:21] Duckily: that was a confusing example
[01:10:36] Duckily: all or just one, doesn't matter
[01:11:02] lethjakman: remove all 2's?
[01:11:23] lethjakman: I think you can do that with map...
[01:12:15] Duckily: lethjakman: ok just seeing if there was an easier way
[01:12:21] bricker: Duckily: delete
[01:12:36] Duckily: bricker: that returns the deleted value and its destructive
[01:13:05] bricker: Duckily: well you didn't specify non-destructive
[01:13:13] aarkerio: hi ! I have this query: U = User.select([:id, :name]).includes(:groups)
[01:13:30] aarkerio: how can I get a field from the model Group?
[01:13:32] bricker: Duckily: arr.tap { |a| a.delete(2) } will return the array, dup if you don't want it to be destructive
[01:14:25] Duckily: bricker: isn't that what #- does?
[01:14:43] bricker: Duckily: #- is for subtracting an array from another array
[01:15:05] Duckily: ok thanks!
[01:15:12] bricker: Duckily: alternatively, you could just use #reject, arr.reject { |e| e == 2 }
[01:15:41] bricker: Duckily: but it has to iterate so it's less performant for large arrays
[01:15:53] Duckily: bricker: yeah
[01:17:28] Duckily: bricker: what happens when you delete on a const?
[01:17:33] lethjakman: bricker: where did you get tap I don't see it in the ruby documentation?
[01:18:21] bricker: Duckily: Nothing special, but I wouldn't.
[01:18:40] bricker: lethjakman: It's a method on Object
[01:18:50] bricker: lethjakman: http://ruby-doc.org/core-2.0.0/Object.html#method-i-tap
[01:18:58] apneic: Alright, I'm building out a new feature, and I have basically the entire thing mapped out in my head. I'm trying to TDD it but I've just hit a wall and have no idea where to start.
[01:19:21] bricker: apneic: Tell me one thing about your new feature.
[01:19:34] lethjakman: bricker: so it's more effecient because it stops when it reaches 2?
[01:19:38] apneic: It basically allows users to store a hash of customizations
[01:19:39] lethjakman: rather than iterating through the whole thing?
[01:20:17] bricker: lethjakman: no, it removes them all, just in a faster way (I haven't confirmed this)
[01:20:21] platzhirsch: lethjakman: Rails.cache.fetch("#{entity.id}.distribution}, like this right?
[01:20:30] lethjakman: bricker: interesting. how does it not iterate through all of it?
[01:20:35] apneic: Over time, the user will incrementally add to this hash indirectly by using the app. The user will also have the option to completely wipe the hash and overwrite the contents.
[01:21:04] bricker: apneic: Cool, you just started writing a specification
[01:21:07] lethjakman: platzhirsch: is that the distribution object? seems about right aside from a few syntax errors.
[01:21:17] apneic: I code spiked the whole feature last night and deleted the commits. I just feel so silly saying "The object will store a hash."
[01:21:27] platzhirsch: lethjakman: yep
[01:22:05] lethjakman: perfect! what I was saying I THINK you can do thouhg is... Rails.cache.fetch(entity)
[01:22:19] lethjakman: otherwise your method will work.
[01:22:44] lethjakman: I don't remember if entity just returns the ID or if it returns the <production id>
[01:22:57] lethjakman: I thought I read that it returnde the second though
[01:23:00] Radar: lethjakman: Did you get it solved yet?
[01:23:11] lethjakman: Radar: no. can't seem to break this error.
[01:23:37] Radar: lethjakman: I typically set up a deploy key and use that for the repo
[01:24:00] bricker: lethjakman: it still does, but instead of having to evaluate a block each time, it just compares it with ==, so it's a little faster (probably)
[01:24:40] lethjakman: Radar: I think the deploy key is workign right now...however it's doubling the tasks, and it doesn't seem to be able to access github through capistrano, just through the CLI. this is my error: https://gist.github.com/lethjakman/7921470
[01:24:58] lethjakman: bricker: interesting. I'll keep that in mind!
[01:25:15] Radar: lethjakman: Looking.
[01:25:30] Radar: lethjakman: I don't see an error there :\
[01:25:37] bricker: lethjakman: here's the method if you're interested: https://github.com/ruby/ruby/blob/trunk/array.c#L2900
[01:25:48] Radar: lethjakman: Is it "DEBUG [a37ed8e8] Command: /usr/bin/env mkdir -p /tmp/my_app/" which is failing?
[01:25:50] lethjakman: "cap aborted!"
[01:26:03] sevenseacat: 'cap aborted' isnt an error, its telling you that there was an error
[01:26:05] lethjakman: Radar: no it's executing the mkdir, it's just not going any further than that.
[01:26:12] Radar: lethjakman: super weird
[01:26:17] lethjakman: sevenseacat: any clue where that error would be?
[01:26:21] lethjakman: Radar: I agree...and frustrating.
[01:26:21] platzhirsch: lethjakman: at least cache.read("#{entity}") != cache.read(entity)
[01:26:31] bricker: lethjakman: compare that to https://github.com/ruby/ruby/blob/trunk/array.c#L3068 (which uses rb_yield)
[01:26:31] Radar: lethjakman: maybe try #capistrano
[01:26:40] sevenseacat: from that log? no. try running it verbosely
[01:26:49] sevenseacat: somewhere in git:check
[01:26:50] lethjakman: Radar: I did, no one uses cap 3 lol. only cap 2.
[01:27:21] lethjakman: sevenseacat: that is verbose lol.
[01:27:24] Radar: lethjakman: lolololol
[01:27:34] rhizome: my sense is that cap 3 is not at all finished
[01:27:37] sevenseacat: doesnt seem very verbose
[01:27:45] bricker: rhizome: it is not.
[01:27:47] sevenseacat: it is, just not many people are using it yet
[01:27:50] Radar: lethjakman: My advice would then to be to find that first line of the stacktrace and see what's happening there
[01:27:52] bricker: rhizome: 3.1 release will get it closer
[01:27:52] lethjakman: sevenseacat: I agree....I ran it with --verbose though.
[01:28:00] lethjakman: rhizome: that's the feeling I'm getting.
[01:28:06] rhizome: a month or two ago they themselves recommended against using it for multi env
[01:28:11] rhizome: (the channel, at least)
[01:28:20] bricker: rhizome: I guess it depends what you mean by "finished"
[01:29:03] bricker: rhizome: for me, no, not the latest release, and I have a pretty basic deploy script. For anybody who doesn't use git, no.
[01:29:31] sevenseacat: if you dont use git, how are you using capistrano?
[01:29:43] lethjakman: I'm guessing it's saying authentication failed.
[01:29:46] bobbobbins: Hey, I'm submitting json to a create method, but the params var isn't carrying any of the values over, so nothing gets saved...can someone tell me if I'm doing something wrong here: https://gist.github.com/bobbobbins/69641af31644ad05f57f
[01:29:55] lethjakman: sevenseacat: you can really tell it to do whatever you want can't you?
[01:30:11] sevenseacat: bobbobbins: however you're submitting the values is completely wrong
[01:30:21] bricker: sevenseacat: capistrano 2 supported mercurial, svn, perforce, and several other: https://github.com/capistrano/capistrano/tree/legacy-v2/lib/capistrano/recipes/deploy/scm
[01:30:34] bobbobbins: well its a javascript plugin that is submitting them, i didn't really have any control over that
[01:30:52] sevenseacat: bobbobbins: sucks to be you.
[01:30:58] platzhirsch: lethjakman: entity as a cache is alright, but when using interpolation, it should definitely use the entities identifier, otherwise it might change
[01:31:14] sevenseacat: bobbobbins: what is the problem?
[01:31:30] Radar: I don't get why you guys are rubbishing cap3.
[01:31:41] Radar: People did the same thing with Ruby 1.9 when it was released because gems didn't work on it.
[01:31:47] Radar: Submit bug reports and work on fixing it :\
[01:31:51] bobbobbins: that json you see there is what is being passed via a javascript ajax call, but I can't seem to reference that at all in the create method
[01:32:04] lethjakman: hmmm that line is AuthenticationFailed.
[01:32:06] sevenseacat: define 'cant seem to reference it at all'
[01:32:11] lethjakman: must be something to do with my deploy key or something.
[01:32:13] lethjakman: perhaps the user.
[01:32:15] sevenseacat: preferably with an error message
[01:32:25] Radar: lethjakman: well there you go. What command is it trying to run?
[01:32:50] lethjakman: Radar: you mean line 215? it's raise AuthenticationFailed, user
[01:32:58] lethjakman: which is weird cause it's clearly acting on the server
[01:32:59] bobbobbins: well there isn't an error message, just params doesn't contain any of those values
[01:33:07] lethjakman: but not on github....
[01:33:09] sevenseacat: bobbobbins: so the hash you posted isnt params?
[01:33:18] sevenseacat: what is that hash then?
[01:33:37] bobbobbins: thats the exact data that is getting sent via ajax
[01:33:53] Radar: lethjakman: Stick a debugger in there
[01:33:54] sevenseacat: where and how? and what is the controller receiving?
[01:33:56] Radar: lethjakman: Find out what user and host are.
[01:34:07] Radar: lethjakman: should be able to replicate it then by doing ssh user@host yourself
[01:34:20] lethjakman: Radar: not sure exactly how to do that. can you point me in the right direction?
[01:34:28] Radar: lethjakman: gem 'pry' in your Gemfile
[01:34:29] bobbobbins: its just the jquery $.ajax() with a post header
[01:34:34] Radar: $EDITOR `bundle show net-ssh`
[01:34:37] Radar: Open ssh.rb
[01:34:39] Radar: Go to line 215
[01:34:45] Radar: stick binding.pry above the raise
[01:34:50] Radar: Run the command again
[01:35:00] Radar: then you will get a pry console. Find out what host and user are in there.
[01:35:01] sevenseacat: bobbobbins: code? and what is the controller receiving?
[01:35:13] Radar: Wait is bobbobbins being asked for CODE?! That NEVER happens!
[01:35:14] bobbobbins: how can I tell what the controller is receiving?
[01:35:20] bobbobbins: haha, i posted code this time!
[01:35:30] bobbobbins: now its jquery code
[01:35:31] sevenseacat: bobbobbins: either by looking in the logs or debugging your controller
[01:35:46] bobbobbins: ok, lemmie check the log
[01:35:55] sevenseacat: more people need to read debugging ruby
[01:38:56] bobbobbins: ok, i posted the relevant log info, but nothing stands out
[01:39:54] platzhirsch: In application.js.coffee I define some overarching functions I want to use in other documents. So far I have been writing everything below $ ->, but now I need to access them beforehand. Due to the loading order application.js.coffee comes last. So is the right thing to remove require_tree . here and add the dependencies in my own order?
[01:40:01] platzhirsch: or am I then doing it WRONG?
[01:40:02] helpa: Debugging Ruby, a new ebook written by Ryan Bigg. https://leanpub.com/debuggingruby
[01:40:14] helpa: platzhirsch: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[01:40:14] Radar: platzhirsch: !code
[01:40:20] bobbobbins: i do need to read that
[01:40:48] lethjakman: Radar: hmm thanks, that helps. apparently it's the user and host for my SSH credentials. which is weird cause that part seems to work, I'm getting files on my server, just not my github files.
[01:40:59] sevenseacat: bobbobbins: so your jquery code isnt posting those params
[01:41:10] sevenseacat: because your controller isnt receiving them
[01:41:18] platzhirsch: Simpler. Is it objectionable to define your own JS loading order or should you use the one induced by #= require_tree . ?
[01:41:20] bobbobbins: firebug shows it as being posted though
[01:43:20] lethjakman: ahhh it's coming from the roles.
[01:45:33] bobbobbins: not sure how else to show this from firebug, so heres a screenshot: https://www.dropbox.com/s/9v3tt1suqhquc41/2013-12-11_20-44-18.jpg
[01:45:54] lethjakman: Radar: commenting out my roles seems to fix the issue I think I was misunderstanding them. I think it was using them as users. thanks for your help everyone!
[01:47:58] Radar: lethjakman: Do you have an example of that you can show me?
[01:48:11] lethjakman: Radar: yep. one sec I'll toss it in my gist.
[01:48:46] bobbobbins: i was having some issues with cors so i think it might be related, but i installed rack-cors because i thought that would take care of it
[01:49:10] sevenseacat: i dont know what rack-cors is
[01:50:35] lethjakman: Radar: https://gist.github.com/lethjakman/7921470
[01:50:42] bobbobbins: me either really...i didn't know what cors was until yesterday either
[01:50:42] lethjakman: Radar: commenting out 8-10 and 16 fixed it.
[01:51:35] sevenseacat: cors is just cross-origin request security
[01:51:42] Radar: lethjakman: I have those too: https://github.com/radar/nf_performance_spree/blob/master/config/deploy/production.rb#L8-L10
[01:51:58] lethjakman: Radar: do you have a deploy user?
[01:52:01] Radar: lethjakman: I don't have the specific rules specified though
[01:52:04] Radar: lethjakman: Yes, I do.
[01:52:11] lethjakman: Radar: I think that's why. I don't have a deploy user.
[01:52:19] Radar: lethjakman: Ah, you're deploying with your own user?
[01:52:42] lethjakman: Radar: I'm just trying to get it working with my ec2-user then I'm probably going to set up a deploy user.
[01:52:54] lethjakman: but that makes me wonder how it's changing users like that....
[01:52:56] Radar: lethjakman: right... but how do you connect to that server? ssh <host>?
[01:53:12] Radar: lethjakman: and I gather you have some config set up for that in ~/.ssh/config?
[01:55:35] lethjakman: Radar: what makes you say I have config set up in .ssh/config? I do but nothing related to this.
[01:56:03] lethjakman: Radar: do you mean connect outside of capybara?
[01:56:08] lethjakman: errr capistrano
[01:56:55] Radar: lethjakman: How do you connect to that server?
[01:57:10] Radar: lethjakman: Yes, connect outside of capistrano
[01:57:57] lethjakman: Radar: yes I use a config but it's the equivelent of ec2-user@ip -i ~/.ssh/Oregon.pem
[01:58:08] lethjakman: add an ssh before ec2
[01:58:51] Radar: \o/ so now we have the answer.
[01:59:08] Radar: lethjakman: Where is that config located? Is that config used automatically by your "ssh" commands?
[01:59:28] lethjakman: Radar: yes it is.
[01:59:53] Radar: So you're answering your own questions :D
[02:00:16] Radar: lethjakman: How you had the roles set up before means that it's trying to use a deploy user
[02:00:26] Radar: if you just want to use the default user, then don't specify a user in that role
[02:01:19] lethjakman: Radar: I know. I figured that out a bit back. thank you for your help tough :)
[02:01:41] sevenseacat: but capistrano is still broken.
[02:01:59] Radar: hahahaha no.
[02:04:46] lethjakman: sevenseacat: the error messages certainly are
[02:05:06] sevenseacat: don't let the door hit you on the way out :)
[02:27:41] morenoh149: in a format.html {} block, how do I specify a flash[] parameter?
[02:28:21] sevenseacat: whats inside the block?
[02:28:51] diegoviola: i'm starting with capybara/rspec just now, should i just start writing the specs in spec/features? or i'm supposed to generate them with a generator?
[02:28:57] Radar: morenoh149: Same way you specify it everywhere else.
[02:29:04] Radar: diegoviola: Yes, you should just start writing.
[02:29:06] sevenseacat: diegoviola: just start writing.
[02:29:13] diegoviola: ok thank you :)
[02:33:31] sevenseacat: why do all of the decent html->pdf libraries rely on wkhtmltopdf :(
[02:36:48] pontiki: no one else has written one?
[02:36:51] pontiki: i use pandoc
[02:39:02] Radar: sevenseacat: because they're not PrincePDF
[02:39:27] sevenseacat: wkhtmltopdf is such a pile of crap
[02:42:02] mischief: how can i make 'redirect('/foo')' preserve the protocol? e.g. preserve https when https is used
[02:42:15] Radar: mischief: It should do that by default.
[02:42:16] helpa: mischief: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[02:42:16] Radar: mischief: !fake
[02:43:04] mischief: it doesn't. :-D
[02:43:35] helpa: mischief: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[02:43:35] Radar: mischief: !debug
[02:44:16] mischief: i cannot provide much more information, this program is closed source
[02:45:04] mischief: i think i know the problem.
[02:45:09] helpa: mischief: Clearly explain what is happening and create a Gist (http://gist.github.com) or Pastie (http://pastie.org) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces. A "Full Trace" as opposed to the default "Application Trace" is preferred. NO FAKE CODE. If you're under an NDA, we cannot help you with your problem. Go hire a consultant.
[02:45:09] Radar: mischief: !rule3
[02:45:16] Radar: mischief: The last part of that wall o' text.
[02:45:24] mischief: we're using nginx for ssl termination with reverse proxying to the rails app
[02:45:39] mischief: nginx probably doesn't indicate to the rails app that ssl is being used, so redirect doesn't know to go to ssl
[02:49:17] mischief: is there a way that i can indicate to the rails app that SSL is being used by the nginx reverse proxy?
[02:49:51] sevenseacat: thats outta my pay grade
[02:50:17] Radar: mischief: I have some code here but unfortunately it is closed source too :(
[02:50:26] sevenseacat: thats a shame.
[02:52:08] mischief: proxy_set_header X-Forwarded-Proto https;
[02:52:13] Giddeon: Question: I'm in the process of upgrading a 3.2.15 app to 4.0.2. I've noticed something wierd with my controller actions. My #new action is called and the #new view gets rendered. In the console output I can see the new view being rendered, bet then I immediately see my #show action get rendered - only the #new view is actually visible in the browser. Is there something about Rails
[02:52:13] Giddeon: 4 I need to be aware of? I'm not sure why this #show action would be called.
[02:52:27] Spami: So I render a map with sometimes 500k markers but processing the rails object with the 500k results into a json object takes forever, any idea how to speed up the pocess?
[02:52:48] helpa: Giddeon: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[02:52:48] Radar: Giddeon: !gist
[02:52:51] Radar: Giddeon: Show us that happening please.
[02:53:19] mischief: the more you know
[02:53:46] Radar: mischief: That's my code! HOW DID YOU DO THAT?!
[02:54:57] pontiki: "proprietary rails app" lol
[02:55:01] mischief: i wasted another 30 minutes of my life on google.com
[02:55:15] pontiki: i suggest tvtropes instead
[02:55:26] sevenseacat: wasted? you found a solution, how is it wasted?
[02:59:30] Giddeon: Radar: Here is the gist https://gist.github.com/anonymous/c37f9fe6cf5954fe1d2b
[03:00:15] sevenseacat: Giddeon: your favicon request is hitting the blogposts controller
[03:00:26] sevenseacat: are you requesting /admin/blog_posts/favicon or something?
[03:00:45] mischief: anyways, thanks for the spams Radar
[03:01:37] Giddeon: sevenseacat: I have some favicon calls in layout. <link rel="shortcut icon" href="favicon.ico" /> and <%= favicon_link_tag '/apple-touch-icon-57x57.png', :rel => 'apple-touch-icon', :type => 'image/png' %>
[03:02:01] sevenseacat: right, so the peths on them are wrong
[03:02:13] sevenseacat: the favicon.ico one anyway
[03:03:35] Giddeon: sevenseacat: yep, I removed those lines and that fixed it. Thank You
[03:03:45] sevenseacat: dont remove the favicon, just fix the path :/
[03:03:56] Radar: lol heroku specific spree preferences problem shoot me now
[03:04:06] Giddeon: sevenseacat: Yah, it was just a quick test. :)
[03:04:16] helpa: Giddeon: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[03:04:16] Radar: Giddeon: !gist-usage
[03:05:20] Giddeon: Radar: Thank You, I'll take a look
[03:07:06] Radar: $20 that this is a stupid Heroku thing where they're clearing the cache upon the dyno shutting down
[03:07:17] Radar: But then again the preference should be being persisted into the database, so ... shrug
[03:24:23] pipecloud: Radar: Why helpa no like me?
[03:24:32] helpa: pipecloud: You are not worthy of this bot!
[03:24:32] Radar: pipecloud: !unworthy
[03:25:35] pipecloud: Radar: but you ruv me doe.
[03:25:42] helpa: Nom nom. Thanks, toretore!
[03:27:44] toretore: damn it, it's too cold to get up at 4.
[03:28:27] pipecloud: I'm always up.
[03:30:22] vowel_boy: if i'm writing a unit test for a module that depends on ActiveRecord::Base#as_json, should I simply stub it out, or use a mock_model?
[03:31:03] vowel_boy: stubbing it out is easy, but it basically reduces my spec to "expect(widget).to recieve(:as_json).with(:safe, :also_safe)" which seems rather inadequate
[03:31:21] toretore: what are you testing?
[03:32:33] vowel_boy: toretore: a decorator
[03:32:52] vowel_boy: and not one specific to any particular model
[03:33:20] bricker`LA: vowel_boy: why do you have to stub it? Can you instead just test that the output of the method is correct?
[03:33:43] bricker`LA: @model.your_cool_method.should eq @model.as_json(:safe, :also_safe) , or whatever
[03:34:00] vowel_boy: bricker`LA: that's what i'm trying to decide
[03:35:01] pipecloud: bricker`LA: Lame.
[03:35:18] pipecloud: vowel_boy: In a unit test, I'd just say that it should_receive, but not include the #with.
[03:35:31] pipecloud: Unit tests should still capture behaviour not implementation.
[03:36:06] pipecloud: It'd be best if you shared the code.
[03:36:06] bricker`LA: vowel_boy: Your responsibility of the author of an API is make sure that each method returns what you claim it does, given certain arguments. Nobody cares how it gets there.
[03:36:19] Salve: I'm still trying to figure out this whole strong params thing. Will this params.permit(:id => []) let my controller receive the params[:id]?
[03:36:23] vowel_boy: your'e right, sorry guys. Let me prepare a gist.
[03:36:52] bricker`LA: Salve: params.permit(:id)
[03:37:22] Salve: Bricker`LA: where should I put that? My controller isn't related to any model
[03:37:41] pipecloud: In the controller.
[03:37:45] pipecloud: As a private method.
[03:37:56] Salve: pipecloud: where in the controller?
[03:38:29] Salve: pipecloud: because in all the examples it shows something like def user_params...
[03:38:37] pipecloud: Salve: Wherever you damn well please, but it should be a private method.
[03:38:45] toretore: so.. this whole strong parameters thing is really just Hash#values_at ?
[03:39:00] Salve: pipecloud: its in one.....so I guess it doesn't matter what I call the method def?
[03:39:23] pipecloud: Salve: Whatever you want to call it.
[03:39:32] Salve: pipecloud: Roger. Thanks man
[03:43:01] vowel_boy: okay, this is where I'm at at the moment
[03:43:02] vowel_boy: https://gist.github.com/DanCheail/7922872
[03:43:24] vowel_boy: my initial reason for stubbing as_json was to avoid having to have an actual ActiveRecord model in the spec
[03:43:42] vowel_boy: but I suspect i'm being a bit dogmatic
[03:44:03] pipecloud: vowel_boy: You're stubbing twice.
[03:44:04] pipecloud: https://gist.github.com/DanCheail/7922872#file-decorator_spec-rb-L20-L23
[03:44:57] vowel_boy: expect sets up a stub? grr.
[03:45:12] pipecloud: receive does.
[03:45:45] vowel_boy: *scratches head* that seems like a self-fulfilling prophecy.
[03:45:46] sevenseacat: that is indeed a stub and then a mock
[03:45:59] pipecloud: It's two stubs.
[03:46:16] sevenseacat: should_receive is a mock
[03:46:20] pipecloud: You can't mock messages.
[03:46:22] diegoviola: i'm trying to get some data from my development db into my test db so i can run/write my tests, but it looks like the test database is being deleted/regenerated when i run rake? I tried to do that by doing RAILS_ENV=test rake db:migrate; rake db:seed, etc, but no luck, any ideas please?
[03:46:48] sevenseacat: diegoviola: thats not how you do tests
[03:46:49] vowel_boy: diegoviola: your tests should be populating your test database as they run
[03:47:06] sevenseacat: either way, widget.as_json will return nil
[03:47:30] diegoviola: ok thanks, i misunderstood
[03:47:54] diegoviola: i'm new with testing, i'm learning
[03:48:04] helpa: diegoviola: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Steve Klabnik, Ryan Bigg, Yehuda Katz
[03:48:04] Radar: diegoviola: !r4ia
[03:48:20] Radar: diegoviola: Covers exactly the stumbling blocks you're coming up against and shows how to do testing.
[03:49:37] toretore: vowel_boy: what does double() do, return a mock object?
[03:49:46] diegoviola: Radar: ok, thanks, i'll look forward to read this book
[03:49:58] pipecloud: toretore: Yes.
[03:50:08] pipecloud: It returns a test double, which is a mock in some vernaculars.
[03:50:08] vowel_boy: toretore: yep.
[03:50:10] toretore: vowel_boy: as you're testing as_json, there's no need to get actual json encoding involved
[03:50:34] pipecloud: vowel_boy: It's unimportant to test that.
[03:50:52] pipecloud: You should say that you expect it to be called and leave it there, remove references to activesupport.
[03:50:54] toretore: (as opposed to to_json)
[03:51:22] toretore: also, your attrs should probably include unsafe atts
[03:51:30] vowel_boy: toretore: see
[03:51:45] toretore: widget.stub(:as_json){ {safe: 'foo', unsafe: 'bar'} }
[03:51:48] vowel_boy: this is my problem. I'm speccing implemenation, not behaviour
[03:52:18] sevenseacat: test inputs and outputs only
[03:52:26] vowel_boy: sevenseacat: exactly.
[03:52:32] sevenseacat: message sending is implementation
[03:52:39] pipecloud: vowel_boy: I think you should take your implementation and set it aside as a "spike", a first pass at what you wanted to happen. Then, knowing now what you know, you should test the behaviour first and write the implementation after.
[03:52:52] toretore: expect decorator.new(widget).as_json.to_not have_key(:unsafe)
[03:52:55] vowel_boy: which means i'm going to have to run my specs through AR::B#to_json
[03:52:59] vowel_boy: as_json, rather
[03:53:21] pipecloud: I bet you could write a good unit test that only tests the one object you care about.
[03:53:36] vowel_boy: pipecloud: oh, I know I can. I've done it before.
[03:53:36] pipecloud: Then write an integration test that tests integration with ActiveSupport.
[03:53:46] pipecloud: vowel_boy: Not that you can't, but you should. Every time. :)
[03:54:32] toretore: vowel_boy: what you're testing here is that your decorator correctly overrides the object's as_json/to_json to only include "safe" attributes
[03:54:36] vowel_boy: the crux of the issue is whether or not to depend on the actual implementation of AR::B#as_json in my spec or not. If I do, it makes the spec damn easy but doesn't isolate. If I stub it out, I reduce the guts of my spec to a single line.
[03:54:43] toretore: there is no expectation that object is of type AR::B
[03:55:22] toretore: only that it responds to as_json/to_json
[03:55:31] toretore: which your mock object does
[03:56:06] toretore: your decorator has nothing to do with AR
[03:56:58] vowel_boy: toretore: well, it does???it's always going to be wrapped around an instance of AR::B
[03:57:10] toretore: but your decorator doesn't know that
[03:57:18] toretore: it doesn't care
[03:57:24] pipecloud: A decorator doesn't care.
[03:57:31] pipecloud: Decorators suck anyways. :p
[03:58:16] toretore: they can be helpful. but i don't like how every pattern is always made into such a big deal, a thing of its own
[03:58:23] pipecloud: A decorator doesn't care about what's underneath, just that it responds to the messages it sends that object.
[03:58:31] pipecloud: toretore: Presenters are better, imo.
[03:58:41] toretore: what's the difference?
[03:59:24] pipecloud: http://stackoverflow.com/questions/7860301/rails-patterns-decorator-vs-presenter
[04:00:01] toretore: so.. the same
[04:00:21] pipecloud: One is a proxy, the other typically isn't.
[04:00:44] toretore: those are details of implementation
[04:01:07] pipecloud: In the same way that any pattern is in the details of its implementation.
[04:01:14] toretore: see, this is how you make a pattern into a big, rigid "thing"
[04:01:31] sevenseacat: decorators are not presenters
[04:01:50] toretore: they can well be
[04:01:50] RubyPanther: Uncle Bob describes and diagrams an OO presenter pattern done right http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
[04:01:59] sevenseacat: decorators are like 'i'll wrap a user record and add extra functionality to it'
[04:02:09] pipecloud: RubyPanther has the right link.
[04:02:34] vowel_boy: gotta love 'em
[04:02:36] pipecloud: Not really.
[04:02:40] RubyPanther: that said, a decorator is probably a mixin, and a presenter is with a boundry API
[04:02:41] pipecloud: Patterns expose intent.
[04:03:17] pipecloud: When I see a decorator, I know it's a proxy object with another object beneath it that it's adding functionality to or overwriting methods the object had.
[04:03:20] sevenseacat: technically draper is both a presenter and a decorator but i really, really dont like it
[04:03:30] pipecloud: I don't like draper myself.
[04:03:47] toretore: why would you need a 3rd party lib for such a simple thing?
[04:03:51] vowel_boy: what's the problem with draper?
[04:03:55] pipecloud: toretore: Why do you use rails?
[04:04:04] pipecloud: I convinced steveklabnik to use viewmodels.
[04:04:08] toretore: rails solves a very non-simple problem
[04:04:17] sevenseacat: maybe its just how we use draper internally, i dont know
[04:04:19] vowel_boy: toretore: saves me writing the same bloody code
[04:04:40] sevenseacat: we tend to use it strictly for generating API responses
[04:04:41] vowel_boy: sevenseacat: heh, snap.
[04:04:42] pipecloud: People use libraries for stupid reasons a lot.
[04:04:57] toretore: the gem usage is too damn high
[04:05:45] toretore: people think that as long as they use "patterns" their code will be better
[04:06:12] pipecloud: People are idiots.
[04:06:38] pipecloud: There's no reason to hate patterns though.
[04:06:46] Radar: At least 4% of the population is dumber than pipecloud .
[04:06:55] pipecloud: Radar: Probably less than that.
[04:10:06] pipecloud: A year or two ago everyone was saying that I was trying to bring java to ruby with a lot of the htings I was doing. Some of those things are pretty common stuff to do in rails now. Form objects are by far my favorite thing in a rails application.
[04:10:29] vowel_boy: form object?
[04:10:38] sevenseacat: im not a huge fan of form objects
[04:11:12] pipecloud: An object whose entire purpose is to encapsulate the behaviour of a form. Attributes, validations, error messages, etc.
[04:11:23] sevenseacat: i havent yet seen a good example of them that isnt either a) horribly convoluted to avoid duplication of logic or b) a lot of logic duplication
[04:11:43] RubyPanther: if I have to replace some idiot's code, I'd rather they had followed the wrong pattern than no pattern
[04:11:55] vowel_boy: pipecloud: so.... FormObject.new(params_from_request).etc ?
[04:12:19] sevenseacat: 'how did the database get into this totally invalid state?' 'oh.... one page used a form object with all the right validations, the other page didnt'
[04:12:30] pipecloud: I haven't seen any rails applications that didn't use form objects whose models weren't polluted with form junk.
[04:12:46] vowel_boy: define 'form junk'
[04:12:46] sevenseacat: attributes and validations arent 'form junk'.
[04:12:49] pipecloud: Sounds like inconsistency is at fault.
[04:13:02] sevenseacat: they're ensuring your data is always in a known valid state.
[04:13:13] pipecloud: Attributes of the form might always map to attributes of your business object.
[04:13:21] sevenseacat: irrespective of how the object was created.
[04:13:43] sevenseacat: and i dont think irrespective is a word but you know what i mean.
[04:13:56] vowel_boy: sevenseacat: it is.
[04:14:00] sevenseacat: oh, win for me.
[04:14:22] pipecloud: I prefer my models to care about validations on business rules, not form input. They might overlap sometimes.
[04:14:48] pipecloud: I'm not afraid of more classes when it lets me have smaller objects with less behaviour in them.
[04:15:13] toretore: pipecloud: good example of a form object implementation?
[04:15:28] toretore: the form stuff in rails sucks quite a bit
[04:15:30] sevenseacat: they're likely to overlap most of the time
[04:15:35] pipecloud: toretore: class FormObjectName; include ActiveModel::Naming; end
[04:15:55] pipecloud: sevenseacat: My forms don't map to models, that seems like a weird thing to do a lot of.
[04:15:59] toretore: i thought you were talking about something that would generate forms
[04:16:21] sevenseacat: so you either get a lot of duplication or you get messiness in extracting validations out into mixed in objects and nothing is quite where you expect it
[04:16:31] pipecloud: It's never been a lot of duplication to me.
[04:16:34] toretore: oh no, "duplication"
[04:16:39] sevenseacat: pipecloud: most webapps i make are glorified crud, so the forms map quite closely.
[04:16:50] toretore: it's not really duplication if they're two different things that look alike
[04:17:04] pipecloud: DRY isn't about code, it's about behaviour.
[04:17:06] sevenseacat: toretore: duplication sucks. period.
[04:17:13] toretore: like: form fields and model fields
[04:17:24] sevenseacat: im sick of cleaning up after people that duplicate code and then when they modify it, don't modify it in all of the places
[04:17:30] sevenseacat: leads to nasty issues
[04:17:55] toretore: i'll take "duplication" any day over tightly coupled code
[04:18:07] sevenseacat: how did coupling come into things?
[04:18:07] pipecloud: I wouldn't blame duplication of code, it sounds like people not doing due diligence and writing shitty tests.
[04:18:19] sevenseacat: pipecloud: i would.
[04:18:22] pipecloud: If your tests pass and your application breaks, your tests suck, and by extension you do too.
[04:18:30] spyzer: hey guys am trying to send HTML5 FormData in an ajax post request. The request doesn't even hit rails and in my chrome inspector FormData boundary is being set properly as well request is simply not going.
[04:18:40] helpa: spyzer: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[04:18:40] sevenseacat: spyzer: !debug
[04:19:09] pipecloud: I don't blame the car because I forgot to put on the parking break.
[04:19:17] vowel_boy: spyzer: sucks to be you!
[04:19:34] pipecloud: What's HTML5 formdata?
[04:19:43] ddd: s/break/brake/ :)
[04:19:55] pipecloud: https://developer.mozilla.org/en-US/docs/Web/API/FormData That one?
[04:20:20] spyzer: pipecloud: yes
[04:20:55] sevenseacat: pipecloud: i do if you decide to keep three parking brakes in your car and you expect it to work when any combination of them are pressed.
[04:20:58] pipecloud: It's not HTML5 though.
[04:21:23] sevenseacat: except if you press all 3. then the car must go.
[04:21:37] ddd: ooo edge case!
[04:21:43] spyzer: https://gist.github.com/abhishek0/1cee1ec1d9fef0332803
[04:21:55] spyzer: I have already handled CORS
[04:22:00] sevenseacat: doesnt look like it
[04:22:09] spyzer: this kind of error doesn;t occur with other post requests
[04:22:15] pipecloud: sevenseacat: Duplication of code is a smell of duplication of behaviour, but not all code duplication is a violation of DRY.
[04:22:34] Radar: oh good it's nahtnam
[04:22:41] nahtnam: Radar: Hey radar :D
[04:22:50] helpa: http://d24w6bsrhbeh9d.cloudfront.net/photo/aVOb5PM_460sa.gif
[04:22:50] spyzer: sevenseacat: if i change the same request to not send any formdata instead simply send a json and ignore all files then it works
[04:23:08] nahtnam: What the hell!
[04:23:08] ddd: sevenseacat, hahah you just been waiting to pop that one! ;)
[04:23:13] nahtnam: It doest work for me! :(
[04:23:19] ddd: get it? pop that one! bwahahaha! I slay me
[04:23:28] sevenseacat: toretore: i only have 6 for now
[04:23:30] pipecloud: It's so incredibly nice to use form objects with service objects.
[04:24:04] pipecloud: Then my models aren't bloated with websy shit unless the domain they cover is websy shit.
[04:24:31] Radar: nahtnam: That's because nothing works for you.
[04:24:33] spyzer: Am i missing something here, all my ajax post get and get requests work normally but the moment I am adding form data it throws me ACCESS_CONTROL_ALLOW_ORIGIN not present bullshit WHY?
[04:24:38] sevenseacat: you realize you're talking about rails apps here, that are nearly all websy shit?
[04:24:39] spyzer: I don't get it
[04:24:45] nahtnam: Radar: See! This is what I mean! NOTHING works for me :D
[04:24:49] Radar: spyzer: If you can provide us with an app that reproduces the problem then we can probably take a look at it
[04:24:52] nahtnam: Im suprised that DO works
[04:25:24] pipecloud: I've not worked on a rails application whose domain is websy shit until I started at the company I'm at now.
[04:26:09] pipecloud: Which is TLD-level network security. Even when I was doing network security at another company, the rails app wasn't about web stuff. I've done social networks and all kinds of things. The web was always just the delivery mechanism.
[04:27:07] nahtnam: I hate mac but its faster than my ubuntu computer. Which should I use?
[04:27:09] pipecloud: Some people like nice fat large objects, I don't.
[04:27:12] pipecloud: nahtnam: Meth.
[04:27:22] nahtnam: pipecloud: Breaking Bad
[04:27:38] helpa: nahtnam: What you just asked could be classed as subjective. Subjective questions often start flamewars, which are tedious and boring. Try all the available options and see which one suits you the best.
[04:27:38] sevenseacat: nahtnam: !subjective
[04:27:42] ddd: its doesn't matter if you use a mac or ubuntu. learn ruby and rails first and THEN decide
[04:28:04] ddd: cause either one will get you where you want to go, provided you know what you're doing
[04:28:04] nahtnam: ddd: They both are a pain in the a**
[04:28:17] sevenseacat: ddd: given nahtnam, thats a real big if
[04:28:20] ddd: so are you but we still deal with it
[04:28:41] ddd: sevenseacat, point and match ;)
[04:31:01] nahtnam: sevenseacat: Like I said nothing works. Every time I try a rails command on ubuntu I have to type rvm reload and on mac I have to type rvm use 2.0.0 every time I open terminal in mac
[04:31:10] pipecloud: Vim is the best operating system.
[04:31:23] pipecloud: nahtnam: That's because you're doing it wrong.
[04:31:27] ddd: if you hve to type rvm reload after every command then, again, you did it wrong
[04:31:31] nahtnam: pipecloud: Ya, sure. Lets all use text editors for os;s
[04:31:31] pipecloud: Because none of us have those problems.
[04:31:38] pipecloud: nahtnam: See Emacs.
[04:31:41] helpa: emacs rules! use emacs!
[04:31:48] nahtnam: ddd: Then rvm needs to improve their docs
[04:31:49] sevenseacat: thats not what i thought it would say
[04:31:53] sevenseacat: oh here we go
[04:31:55] ddd: you did not properly install, you did not pay attention to the docs for rvm, and i'll wager you didn't bother to read the additional workflow docs to see what TO do
[04:32:03] helpa: http://i.imgur.com/yc1b4Wa.gif
[04:32:10] ddd: nahtnam, I'm on the rvm team. Our docs are just fine
[04:32:15] ddd: so umm, next
[04:32:53] nahtnam: ddd: Ill be back in 10 min and lets find out whats wrong with my ubuntu
[04:33:05] nahtnam: Got to finish my report on Jim Crow laws :(
[04:33:25] ddd: I helped write half of them. The community submitted additional docs and helped modify,through daily usage, the docs I originally wrote to be better. We have several thousands using RVM on a daily basis with little to no trouble so I highly doubt its our docs vs your unwillingness or inability to read them
[04:34:47] ddd: and no, I'm not going to teach you to use your ubuntu. Thats a prerequisite set of knowledge before you even get into ruby or rails programming, and I would suggest you read the RVM docs, the workflow docs, at least one good ruby book, and the Rails Guides. THEN start your complaining, but I guarantee you haven't even invested THAT little bit into your own personal education
[04:34:55] ddd: so, moving on to people with REAL issues
[04:35:09] sevenseacat: ddd: my pdfkit wont print pdfs in landscape :(
[04:35:23] ddd: sevenseacat, doh! did you kick it?
[04:36:00] pipecloud: I use phantomjs for my PDFs. I don't know much about pdfkit.
[04:36:21] Radar: phantomjs does PDFs?
[04:36:47] nahtnam: ddd: This good enough? https://drive.google.com/file/d/0B90lCZlvVsaLY1pEbTE2TWdBMnM/edit?usp=sharing
[04:37:07] pipecloud: They can even evaluated JS and capture what they draw into the PDF.
[04:37:32] pipecloud: ACTION has used d3.js to draw gorgeous graphs into PDFs.
[04:40:15] ddd: woot! tomorrow is last day of this semester, then a whole month off! can't wait!
[04:40:34] nahtnam: ddd: Lucky! I still have 1 week and 2 day :(
[04:40:44] pipecloud: http://steamcommunity.com/groups/steamuniverse#announcements/detail/1930088300965516570
[04:40:45] nahtnam: Then 2 weeks off
[04:40:56] dopie: sevenseacat, got the phantomjs/poltergeist/capybara working :)
[04:40:57] bricker`LA: Sometimes I still have nightmares that it's finals time and I haven't been to class in like 3 months
[04:41:09] bricker`LA: Then I wake up
[04:41:23] pipecloud: Do you wake up to a nightmare?
[04:41:32] nahtnam: pipecloud: How much is a steam machine?
[04:41:49] bricker`LA: pipecloud: no I wake up and go to my job that I like and they give me money periodically.
[04:41:49] pipecloud: nahtnam: Ask Gabe.
[04:42:08] Radar: nahtnam: !gg gaben
[04:42:12] pipecloud: Gabe Newell.
[04:42:13] helpa: nahtnam: Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
[04:42:13] Radar: nahtnam: !rule1
[04:42:17] Radar: nahtnam: !cluebyfour
[04:42:22] Radar: 'sifn't !cluebyfour!
[04:42:40] nahtnam: Ahhhh, gabe. :D
[04:42:55] nahtnam: Oh so there is !gg
[04:43:44] sevenseacat: Radar: you should fix that
[04:43:54] ddd: they give me money periodically. heheh too funny
[04:44:00] pipecloud: Radar: What does this mean? It has come to my attention my cult of personality is getting out of hand.It has come to my attention my cult of personality is getting out of hand."
[04:44:23] pipecloud: "It has come to my attention my cult of personality is getting out of hand."
[04:44:34] Radar: pipecloud: fail.
[04:44:39] Radar: pipecloud: Did you see the retweet before it?
[04:44:55] pipecloud: Radar: No, I watch via facebook and it doesn't send your retweets, only tweets.
[04:44:59] Radar: pipecloud: Right.
[04:45:06] jrobeson: so.. looks like bootstrap-sass is moving to twbs org
[04:45:11] Radar: pipecloud: https://twitter.com/dunn/status/410910258718973952
[04:45:13] jrobeson: the official sass port of bootstrap
[04:45:17] Radar: pipecloud: By Andy Dunn. The CEO of Bonobos.
[04:45:21] Radar: You might have heard of them.
[04:45:23] jrobeson: could be any day
[04:45:30] sevenseacat: lol at reading tweets in an accent
[04:45:32] Radar: jrobeson: goodo
[04:45:50] pipecloud: Radar: I don't know what bonobos is.
[04:46:01] sevenseacat: just makes me think of 'unlike other robin hoods, *I* can talk with an english accent'
[04:46:19] Radar: pipecloud: !gg bonobos
[04:46:24] Radar: pipecloud: yes.
[04:46:27] Radar: Biiiig clothing outlet
[04:46:36] pipecloud: It sounds like it's FUBU for not "Us"
[04:46:40] jrobeson: now if only freaki nsass 3.3 will come out..
[04:46:58] jrobeson: sourcemaps ftw..
[04:47:17] jrobeson: turns out sass is still 1.8.7 compat..
[04:47:20] pipecloud: jrobeson: If you just wrote the code correctly the first time you wouldn't need sourcemaps.
[04:47:33] jrobeson: ACTION slaps pipecloud with a cold, wet trout
[04:47:46] ddd: make sure its frozen too
[04:47:55] jrobeson: nah i don't wanna injure him !
[04:48:09] ddd: damn, i was hoping for hockey like injuries
[04:48:19] ddd: i'm fiending :)
[04:48:26] pipecloud: http://cordova.apache.org/ The first time I didn't laugh at one of these kinds of projects.
[04:48:37] pipecloud: Still haven't taken it seriously, but I'm not laughing hysterically.
[04:49:10] jrobeson: i wonder if i could do a phonegap/cordova app that actually used the bluetooth connection
[04:49:36] jrobeson: be so much easier to write the stupid simple app i wanna write if i didn't actually have to learn java & objective c
[04:50:04] jrobeson: a list, a counter, and some concentric circles .. that's about it..
[04:50:08] tfittsy: jrobeson: I started a cordova app. I'm pretty sure they've got a bluetooth serial extension
[04:50:29] jrobeson: i support it's worth a day to give it a shot
[04:50:36] ddd: jrobeson, a geo splunking app or something?
[04:50:50] jrobeson: target shooting
[04:51:17] jrobeson: with a paintball/airsoft gun thing.
[04:51:41] jrobeson: i got hte hardware.. just was avoiding the actual app.. was gonna contract it out to someone else
[04:51:57] ddd: sounds neat
[04:52:12] jrobeson: yeah it's been fun..
[04:52:25] jrobeson: my first rails app was for the team version of that.. for family entertainment centers
[04:52:57] jrobeson: too bad puma is causing me so much trouble cuz it won't kill the connection.. it just spins and won't shut down when using event source :(
[04:53:31] jrobeson: probably no real problem in prod (other than having to use 2 threads for every connection ) but for dev it's really annoying
[04:53:44] jrobeson: every change means kill -9 puma :(
[04:53:54] jrobeson: there's an open ticket for this.. but ..
[04:54:05] jrobeson: also redis itself won't die :(
[04:54:22] jrobeson: i think i might wanna the event source part out to nodejs or nginx openresty
[04:55:30] pipecloud: Prototypal languages are really nice for event sourcing.
[04:55:53] jrobeson: pipecloud, i meant specifically the eventsource class for server sent events
[04:56:10] pipecloud: You mean the emitter?
[04:56:58] jrobeson: yes moving the emitter out to openresty or nodejs
[04:57:22] jrobeson: it could be anything really.. another rails app, go.. i even have a haskell version
[05:08:07] nahtnam: Wow cordova is really cool!
[05:08:53] tfittsy: I'm trying to test out RailsAdmin and after I login I get uninitialized constant CashierController. I've got a CashiersController. shouldn't it be looking for a pluralized name?
[05:09:19] helpa: tfittsy: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[05:09:19] Radar: tfittsy: !debug
[05:18:21] nahtnam: Finally done with work
[05:18:29] nahtnam: Now im going to try and see if i can get another server up
[05:19:18] sevenseacat: good luck with that
[05:19:24] sevenseacat: you could you know, try learning rails
[05:23:47] Radar: nahtnam: Any particular reason why you're COMPLETELY IGNORING my reasonable advice?
[05:24:07] Radar: It's slightly frustrating.
[05:24:17] nahtnam: Radar: Which is follow that tut? I need nginx and dont really know what software it is.
[05:24:27] Radar: nahtnam: http://guides.spreecommerce.com/developer/ansible-ubuntu.html
[05:24:32] Radar: It will work with any Rails application afaik.
[05:24:46] nahtnam: Yes, I dont know what anisable is, and does it use apache, nginx, or something else?
[05:25:12] Radar: nahtnam: !gg ansible
[05:25:22] Radar: nahtnam: The playbook from that repo uses Nginx.
[05:25:28] nahtnam: I need to learn with nginx because the place that I am trying to get an intership at marked it as an requriemnet
[05:25:51] Radar: So now please go ahead and read this guide I have linked you to for THREE DAYS>
[05:26:28] nahtnam: Oh its nginx :D
[05:27:04] Radar: +q *!*@gateway/web/freenode/ip.
[05:27:18] Radar: nahtnam: 1 day +q. Go away and do the research.
[05:27:32] sevenseacat: but that was entertaining
[05:27:38] Radar: Don't care.
[05:27:56] sevenseacat: ACTION sulks
[05:51:04] ddd: oh great, now he's hitting #RVM expecting us to figure out his stuff there
[05:51:16] ddd: time to so totally lurk
[05:54:19] Radar: ddd: lolololol
[06:09:50] luckyruby: is there a way to do a 301 redirect from within routes.rb in rails 2.3.x?
[06:23:51] tfittsy: in rails 4 I'm getting an ActiveModel::ForbiddenAttributesError on a Message model. I've followed some guides on how to setup the controller to allow those params. https://gist.github.com/tfitts/7923952 Can anyone tell what I'm doing wrong?
[06:25:06] mbuf: after database migrations, running rake db:fixtures:load has removed the database entries; is it possible to rollback database prior to loading the fixture data?
[06:27:01] sevenseacat: tfittsy: looks legit
[06:27:21] kara_sweets: is it possible that an after_create callback could cancel the db transaction of the model being created?
[06:27:32] sevenseacat: kara_sweets: probably.
[06:27:33] kara_sweets: i have a giant callback sending notifications after a post is created and on certain occasions the post never gets saved
[06:28:12] mcmillion: is there a rollback in the log?
[06:28:19] kara_sweets: mcmillion unfortunately no
[06:28:24] kara_sweets: not really showing me much in terms of the log
[06:28:36] kara_sweets: but i commented out the callback and its now saving no problem
[06:28:52] kara_sweets: i can't find a good way to move the callback to an asyn queue
[06:29:33] toretore: any exceptions raised in an after_create will rollback the transaction
[06:30:06] mcmillion: do those not show up in the log with a rollback?
[06:30:07] kara_sweets: toretore: yea thats what it seems like
[06:30:16] chirag7jain: does anyone how to set implementing retry in solr
[06:30:22] toretore: they would show up in the log, yes
[06:30:29] sevenseacat: i'm always amazed when you see the same people spend like days stuck on simple problems
[06:32:05] toretore: they spend days reading blog posts or trying copy/paste "fixes" instead of figuring out the real reason for the problem
[06:32:10] BrazenBraden: buenos dias todos
[06:32:32] sevenseacat: or just asking for advice and then not taking it
[06:32:38] sevenseacat: BrazenBraden: aloha.
[06:32:51] BrazenBraden: sevenseacat: como estas?
[06:32:58] kara_sweets: it would be a lot easier if people weren't assholes on irc
[06:32:59] sevenseacat: BrazenBraden: muy bien
[06:33:28] sevenseacat: you've just about exhausted my repertoire of espanol
[06:33:38] BrazenBraden: see if you get this one
[06:33:38] toretore: "you should learn how this problem is caused by your lack of understanding of the underlying technology" "hm, no, i think i'll continue to look for an easy solution that doesn't include any learning"
[06:33:51] BrazenBraden: hoy, tengo una pregunta para tu
[06:34:02] sevenseacat: ACTION heads to google translate
[06:34:27] BrazenBraden: ACTION translates: today, i have a question for you
[06:34:28] sevenseacat: i was about to say 'no, i am not pregnant!' but that makes more sense
[06:35:24] tfittsy: sevenseacat: any idea what else I could look at if that looks right?
[06:35:44] BrazenBraden: if i have a database from an old system and a new redesigned database for the new version of said old system where tables have been... what the word... refactored? and such.. what is the best way to go about migrating the data from DB 1 into DB 2?
[06:36:00] tfittsy: every result I can find for it says to do exactly that and they all say it finally works when their model_params looks like that.
[06:36:00] sevenseacat: tfittsy: im not sure - its not a very useful error message
[06:36:20] toretore: BrazenBraden: write a script to massage the data
[06:36:33] BrazenBraden: toretore: a ruby script?
[06:36:40] toretore: if you want
[06:36:42] sevenseacat: tfittsy: if it was me i'd probably put a debugger in and step through the strong_params code and see whats exploding
[06:37:10] BrazenBraden: toretore: hm ok
[06:37:10] toretore: data from olddb -> format -> newdb
[06:37:55] toretore: it'll be messy, but that's how these things go
[06:38:03] BrazenBraden: toretore: i am not looking forward to this part lol. The old system has 50 massive tables which have been turned into about 200 smaller tables lol
[06:38:39] BrazenBraden: NORMALISE! Thats the word i was looking for
[06:39:00] toretore: you could split it up into different "slices" of functionality if the data aren't too intertwined
[06:39:24] BrazenBraden: yea for the most part the tables are grouped into "systems"
[06:39:36] toretore: the real showstopper will be that you can't reuse the ids from the old db
[06:39:47] BrazenBraden: hmm yea.. ouch
[06:39:55] toretore: so you'll have to migrate them at the same time
[06:40:01] BrazenBraden: and you want to know the biggest problem?
[06:40:06] BrazenBraden: the old database is not relational!
[06:40:21] BrazenBraden: even though there are "relationships"
[06:40:21] toretore: what is it then?
[06:40:50] BrazenBraden: the foreign keys were just normal int fields which were manually updated
[06:40:58] BrazenBraden: * "foreign keys"
[06:41:18] toretore: well that's not much different from a rdbms
[06:42:20] BrazenBraden: ya but you know that pretty relational diagram you can have made in Workbench or whatever to help show you how everything connects to everything else? it no exists making the chore of finding what goes where a bit more painful
[06:42:30] BrazenBraden: but alas, so is the way of life :P
[06:42:43] rushed: BrazenBraden: if explicitly using the dbengine's foreign key constraint is your definition of being relational you might want to revisit if you really need to rip the whole thing up :)
[06:43:24] BrazenBraden: rushed: no i know that isnt all that makes a db relational. but it is part of it
[06:43:41] rushed: BrazenBraden: it is not
[06:45:21] BrazenBraden: anyway, without using the foreign key constraints, you lose the... ag, my mind is soggy today... consistency?
[06:45:56] BrazenBraden: but doesnt matter
[06:47:13] BrazenBraden: the "energy" in the office today is giving me heart pulpatations O.o
[06:47:57] tagrudev: palpitations :?
[06:48:19] BrazenBraden: ACTION calls on the soothing sounds of Dalriada
[06:49:39] BrazenBraden: somehow, having Laura Binder screaming in my ears is more pleasurable than those from the ladies in the office lol
[06:49:59] rushed: BrazenBraden: also, you might consider if slowly transforming the data in place would give you an acceptable outcome... there is a lot you can do slowly in place with migrations which might allow you to skip the massive conversion step you're talking about. additionally, creative use of db views can get you around non-ideal schema setups in a number of circumstances... depending on if you have a requirement to continue using the lega
[06:50:00] rushed: schema in any context or are throwing away anything that depends on the existing structure.
[06:50:57] BrazenBraden: rushed: yea it will have to be a slow migration should we wish to retain any amount of sanity
[06:51:47] BrazenBraden: http://www.youtube.com/watch?v=9F7b4skyUy4
[06:54:16] BrazenBraden: tagrudev: dont deny.. its magical
[06:54:35] tagrudev: I tried I really tried mate, but it sux
[06:54:50] BrazenBraden: different strokes for different oaks
[06:55:01] BrazenBraden: that is the "hardest" song from them though (that i can think of)
[06:55:06] BrazenBraden: you want a nicer one?
[06:55:48] BrazenBraden: tagrudev: try this one on for size: http://www.youtube.com/watch?v=4QrXSoXq4iM
[06:57:07] BrazenBraden: another one of my favourites: http://www.youtube.com/watch?v=iQQGVd3r0d4
[06:57:20] tagrudev: maybe I am just not a fan of folk metal
[06:57:21] tweeeaks: is there any reason Radar 's answer here: http://stackoverflow.com/questions/4120537/tell-if-a-controller-is-being-used-in-a-nested-route-in-rails-3 not work in rails 4?
[06:57:26] tagrudev: the second one is better though
[06:57:53] BrazenBraden: i find folk metal to be so different to what is popular out there
[06:58:04] BrazenBraden: and there are some real gems hidden in Hungary
[07:00:22] tagrudev: ACTION 've been to Hungary didn't catch any folk metal there :D
[07:00:55] BrazenBraden: yea they not very exposed which IMO is a shame
[07:01:29] BrazenBraden: but to be honest... i wouldnt go listen to dalriada live.. i watched one live performance and without the auto-tune... well...
[07:02:18] BrazenBraden: tagrudev: you see the spinning dudes?
[07:02:27] BrazenBraden: spinning dervishes?
[07:02:33] BrazenBraden: i forgets the name
[07:03:07] BrazenBraden: oh my bad.. sorry.. thats turkey
[07:03:45] BrazenBraden: get them confused... whenever I'm "hungary", could always do with a nice "turkey" sandwich :P
[07:04:20] tagrudev: true story next spring
[07:06:50] BrazenBraden: in db migration files, when you specify null: false, must you follow that up with a default: <something>?
[07:11:38] diegoviola: i'm passing an id from one controller to another via a session variable, how i'm supposed to test that with rspec/capybara when the tests are randomized?
[07:11:43] diegoviola: any ideas please
[07:11:51] ravionrails: not necessary , may be in come cases we don't know the default value
[07:13:04] ravionrails: ex. at_time should not be null it must have some value when saving to db and the value is provide by app
[07:13:12] diegoviola: i can't just tell with capybara, go to this action, click on this button, it won't maintain the session apparently
[07:13:46] BrazenBraden: ravionrails: okie thanks
[07:13:53] sevenseacat: did someone say folk metal
[07:14:44] sevenseacat: ACTION listens
[07:15:16] Zendist: *cling cling clonk*
[07:15:34] BrazenBraden: sevenseacat: a fan?
[07:16:12] sevenseacat: ooh, female screaming, nice
[07:16:47] BrazenBraden: tagrudev: ya see, you got no class XD
[07:17:12] tagrudev: I've heard that before :D
[07:17:26] BrazenBraden: ACTION sees what you did there
[07:18:19] tagrudev: the first though when I hear class is oop which is kind of sad
[07:18:37] sevenseacat: BrazenBraden: one of my fave folk metal bands is korpiklaani
[07:18:47] BrazenBraden: ACTION investigates!
[07:19:07] sevenseacat: http://www.youtube.com/watch?v=PJwo6bMKBaw
[07:19:59] tagrudev: sounds better than dalriada
[07:20:03] BrazenBraden: aaah darn internet..
[07:20:16] BrazenBraden: buffering video on 144p D':
[07:20:32] BrazenBraden: what language?
[07:20:40] tagrudev: finnish I think
[07:22:43] tagrudev: those guys are on another level
[07:23:40] tagrudev: and they sing mostly of drinking another reason
[07:23:58] sevenseacat: they do indeed
[07:24:03] sevenseacat: they love their alcohol
[07:24:29] tagrudev: as do we :D
[07:52:51] BrazenBraden: sevenseacat: they good :) I like the little inclusion of some native american goodies in that song you linked
[08:01:28] robertjpayne: is it possible to turn off strong params in rails 4?
[08:01:37] robertjpayne: I'm using Grape and really have no need for it
[08:10:49] sevenseacat: probably, its not a good idea though
[08:15:01] Macaveli: Hay! Oh my zsh returns: Upgrading Oh My Zsh Cannot pull with rebase: Your index contains uncommitted changes.
[08:15:43] dopie: how do i use a form to input text in a field without it being tied to a model??
[08:15:44] dopie: https://gist.github.com/staycreativedesign/37c6d819d8a3dae8eb52
[08:16:05] tagrudev: Macaveli, cd into oh-my-zsh and git status to see the changes it conflicts with
[08:16:24] Macaveli: tagrudev, I changed some alias but I want to keep them
[08:16:55] tagrudev: Macaveli, !google git stash
[08:19:07] Macaveli: tagrudev, nice :) I was searching for git keep :p
[08:25:43] dopie: https://gist.github.com/staycreativedesign/37c6d819d8a3dae8eb52 how do i pass the @dl variable using a form ?
[08:27:06] dopie: id use a {:action -> 'update
[08:27:37] sevenseacat: there is absolutely no context to that question
[08:27:45] sevenseacat: so it is unanswerable
[08:27:59] dopie: sevenseacat, even with the link provided?
[08:28:55] dopie: I have @dl how do i use the form to update it so @dl can have a value , @dl is no tied to a model
[08:29:00] dopie: is that a better question
[08:29:04] sevenseacat: what the crap is @dl?
[08:29:15] dopie: @donutlards
[08:29:54] sevenseacat: there is so much wrong here
[08:29:55] Macaveli: I'm going to some code and I notice the following: " if field["FIELD_NAME"] =~ /TELEPHONE/ " what does "=~" do?
[08:30:05] sevenseacat: Macaveli: matches a regex.
[08:30:59] dopie: sevenseacat, what is so wrong?
[08:31:19] sevenseacat: your complete lack of understanding of how rails works
[08:31:39] sevenseacat: ok so you have form_tag @dl, so where is this form supposed to submit to?
[08:32:21] dopie: well i want it to submit to @dl with the value
[08:32:28] dopie: in the index
[08:32:37] sevenseacat: 'submit to @dl' does not make sense
[08:32:45] sevenseacat: do you want to submit to the index action of your controller?
[08:32:59] sevenseacat: ok so set that instead of form_tag @dl
[08:33:28] sevenseacat: secondly, you have to name the fields on your form so you can actually submit them
[08:41:19] sevenseacat: i give up on pdf rendering for today
[08:47:05] sevenseacat: because wkhtmltopdf is a buggy piece of shit
[08:48:35] rhizome: it's just opinionated
[08:48:37] Phoop: We use PrinceXML for rendering PDF files. It has its price, but it has been awesome
[08:49:01] sevenseacat: its not opinionated, its buggy
[08:49:11] rhizome: tomato tomahto!
[08:49:31] sevenseacat: unless by opinionated you mean 'i want to page break here and not here because i said so' or 'i want to render this image normally and this one at 50% opacity because why the fuck not'
[08:50:01] sevenseacat: yeah i hear good things about prince
[08:50:57] Phoop: I work at an online invoicing PaaS, we are rendering all your PDF's with Prince. We even offer custom CSS so that our users can customize the output. Never had a problem
[08:53:42] sevenseacat: yeah if i was doing something like that, you'd get your money's worth out of prince
[08:54:04] sevenseacat: unfortunately i am not, it's just a little client that wants to print weekly reports that are a couple pages long
[08:54:38] Phoop: The reports are in HTML format? Or can you customize the output?
[08:55:11] sevenseacat: well the end result has to be pdf, how i get there is up to me, html->pdf seemed the quickest, it's just a header and a table
[08:56:02] Phoop: Maybe Pandoc an option/
[08:57:56] sevenseacat: thats the second time ive heard that mentioned
[08:58:41] Phoop: Then maybe it's worth a look ;)
[08:58:48] sevenseacat: yeah doing it now
[09:08:11] dopie: sevenseacat, thanks so much for the pointing on where to go... really helped out
[09:11:53] corp_: can I somehow prevent rails from looking for a template if there is no redirect_to or render in the controller action? I'd like to call them in a separate method which is being called in an after_filter
[09:15:54] BrazenBraden: how i feel when people come asking me to redo old reports on the old system which im trying to get away from... https://lh6.googleusercontent.com/-LvUBhfB0pww/Uqkutedw6-I/AAAAAAAFL5Y/EgMvLZHhPAg/s300-no/freak.gif
[09:18:00] corp_: or is an around_filter maybe a way to go for me?
[09:18:52] tagrudev: corp_, I don't get your question
[09:20:45] corp_: tagrudev, I have an engine which I want to be able to extend in the app via some callbacks which are run by the engine after and before the controller action, they are being defined via decorators in the app, but the execution stops due to missing templates before the after_filters are being run (in which I have e.g. a redirect_to)
[09:20:58] corp_: or is this bad design?
[09:26:17] corp_: it works when I manually call the methods at the end of the controller action (because it's not done yet), but then I had to include this in every action in every controller
[09:26:21] corp_: and that seems really odd to me
[09:27:41] tagrudev: basically you want to do something before and after each action in your controllers
[09:27:50] tagrudev: why don't you just do that in the application controller
[09:27:57] tagrudev: and why would you need an engine for that
[09:28:41] corp_: no the engine is already there, I just want to add the possibility to extend it
[09:29:07] corp_: so that the engine user can .class_eval the controllers and inject some methods he wants to be executed before and after the controller's actions
[09:31:32] corp_: or is there a cleaner way to add user defined logic to the engine's controller?
[09:31:33] tagrudev: can you share code ?
[09:31:55] corp_: show you some code you mean?
[09:32:36] corp_: sure, but could we then continue this conversation in query?
[09:32:49] corp_: great, thanks
[09:32:50] apeiros: hi there. "devise" still the way to go if you don't want to roll your own authorization library?
[09:34:06] toretore: i think devise mostly does authentication
[09:36:51] apeiros: and what for authorization?
[09:37:12] apeiros: so cancan + devise?
[09:38:28] corp_: common combination I'd say :)
[10:07:22] tyl: for authentication tokens for a rails backend to a mobile ios app how long before you expire the tokens usually?
[10:16:48] mikecmpbll: i'm having a stupid moment
[10:17:31] mikecmpbll: if i'm renaming path helpers on the resource using: resource :foo, as: :bar, how can i ensure that the correct path helper is resolved when using form_for @foo ?
[10:17:48] mikecmpbll: currently i'm getting undefined method `foo_path` for #<#<Class
[10:18:51] mikecmpbll: i don't really want to use the url: option on form_for for every form for Foo if i can avoid it
[10:35:08] jlebrech: is there a gem that can parse html and css for position and dimensions? and store that output in a graph structure?
[10:37:23] rushed: jlebrech: position and dimensions of what?
[10:37:42] jlebrech: rendered html/css
[10:38:05] rushed: jlebrech: you want a gem, which is also a browser?
[10:38:05] jlebrech: and then be able to query the positions and dimensions of those
[10:38:15] rushed: jlebrech: what are you actually trying to do? :)
[10:38:22] jlebrech: would it be the only way?
[10:38:40] jlebrech: I need to know where elements show on a page for a crawler
[10:38:47] dEPy: why can't I "extend" a module inside my AR model ?
[10:38:56] workmad3: jlebrech: well, the page needs to be rendered in order for all the positioning and sizing to be calculated
[10:39:19] workmad3: jlebrech: so yeah, you're kinda asking for a gemified, programmable browser ;)
[10:39:46] dEPy: this code -> https://gist.github.com/depy/c8c90d69b939ae9cdb16
[10:39:53] dEPy: why does it not work?
[10:40:18] workmad3: dEPy: how does it not work?
[10:40:39] universa1: it just doesn't...
[10:40:51] workmad3: universa1: ssh, stop trolling :P
[10:41:04] jlebrech: i wouldn't need a fulling feature browser tho, just something that can position. but maybe something fullblown is the only option
[10:41:04] universa1: ok master :-)
[10:41:10] dEPy: oh my bad!
[10:41:18] dEPy: there was actually an extra end in the module :D
[10:41:34] workmad3: dEPy: see, this is why mentioning the error message helps (also, reading them)
[10:41:55] workmad3: jlebrech: you need a fully featured browser, you just don't need a javascript engine ;)
[10:42:24] dEPy: wonderbread: my laptop screen is too small to see the whole message :D so I panicked first then scrolled to the right :)
[10:42:47] workmad3: jlebrech: you'd also need to specify things like a screen size that you're browsing at, in order for layout to go correctly...
[10:42:50] universa1: configure your terminal to soft-wrap? ;)
[10:43:07] jlebrech: mhh, yeah but then it's easy to ask js for dimensions. other wise I have to query the internal representation of the rendering in some other way
[10:43:09] dEPy: no I refuse to be blamed for anything! :D
[10:43:19] workmad3: jlebrech: exactly ;)
[10:44:10] dEPy: on the other hand it's complaning that devise is undefined method in my module, obviously, but, shouldn't modules be "evaluated" after inclusion/extension ?
[10:44:12] workmad3: jlebrech: the 'issue' is that HTML layout is rather convoluted and allows for things like re-laying out based on screen sizes, adjustment of element sizes based on content, etc
[10:44:45] dEPy: then mayhaps I should rather to "included" stuff
[10:44:53] workmad3: dEPy: no, that won't change anything
[10:45:01] dEPy: any suggestions then?
[10:45:26] dEPy: and please don't tell me to put that code into user model :S
[10:45:43] workmad3: dEPy: a) that you use consistent tabbing ;) b) that you learn a bit more about how and when module code is evaluated
[10:46:04] universa1: dEPy: are you using it in another place?
[10:46:17] dEPy: not at the moment, why?
[10:46:36] universa1: just curious about why you want it in a module then...
[10:46:43] dEPy: for separation
[10:46:48] universa1: you only obfuscate your code imho.
[10:47:11] dEPy: why do you think that?
[10:47:40] dEPy: so by your standard a model with 2000 lines of code expresses the intetion more clearly? :D
[10:48:13] jlebrech: mhh, so phantomjs would be pixel perfect. another option is to guestimate positions of element based on their class using NLP maybe? but nothing stops someone from calling their footer, header.
[10:48:19] rushed: dEPy: does you model have 2000 lines? if so, gist it up you can probably get some suggestions on what you could extract :)
[10:48:41] dEPy: rushed: not yet because it's a new project now
[10:48:43] universa1: dEPy: if your model has 2000 lines of code you failed somewhere else. but extracting devise logic from a user model
[10:49:00] universa1: if you're not even reusing it is wasted effort imho
[10:49:11] tetraktys: Hey guys, i'm trying to build a league manager and was wondering the following: in my model Match is have attributes home_team_id and guest_team_id, both (obviously) associating to the Team model. Now i'd like to find all matches a team plays in, is it really necessary to do something like where('home_team_id = ? or guest_team_id = ?', id, id) or is there a prettier solution? like defining both foreign keys in the association?
[10:49:18] universa1: dEPy: especially since the devise related stuff is a primary task for the user model
[10:49:24] dEPy: universa1: separation of concerns is not and SRP si not about reuse
[10:49:35] dEPy: - "is not"
[10:49:39] universa1: the other 1990 lines probably are not.
[10:49:48] workmad3: dEPy: splitting up into modules isn't really SRP
[10:49:55] ace_striker: hello everyone...my bootstrap code is not working ..though only custom.css.scss body padding is working.. what could be the reason...i have repository here https://github.com/igauravsehrawat/forge_ahead
[10:50:10] universa1: dEPy: you're just hiding code behind a include/extend, not moving responsibility to another place.
[10:50:13] dEPy: workmad3: then how would you do it? Because I have no idea right now
[10:50:22] workmad3: dEPy: personally? I'd put it into the class
[10:50:43] workmad3: dEPy: until that class became unmanageable, then I'd look for other classes to extract from it
[10:51:17] universa1: dEPy: if you'd move user authentication to something like UserAuthenticator then maybe you would respond to SRP, but moving it into a module and then including is not changing anything imho.
[10:51:35] dEPy: ok I must agree with that yes :S
[10:51:35] workmad3: dEPy: to me, SRP and other design decisions are things that you refactor to once you've got too much code, because at that point you have a hope in hell of ending up with a design that supports your domain
[10:51:40] rushed: ace_striker: your project is called "ruby on rails guidelines and industrystandards" but you can't get bootstrap working ><
[10:52:00] ace_striker: i am including it using @import "bootstrap" .. i iguess that's the right way.
[10:52:11] rushed: ace_striker: you guess?
[10:52:12] universa1: dEPy: but this is just my personal opinion and i'm by no means an authoritive resource ;)
[10:52:15] workmad3: dEPy: and if you never end up with the code mass to warrant such refactoring... well then lucky you :)
[10:52:20] ace_striker: rushed: thanks...i learning that way ...and the repo is not complete
[10:52:31] workmad3: dEPy: you just saved yourself from unnecessary design work ;)
[10:52:35] rushed: ace_striker: is guessing how to install something "industrystandards"?
[10:52:42] ace_striker: i am starting from scratch..
[10:52:43] dEPy: sound like a reasonable thing to do ye
[10:53:07] ace_striker: rushed: what's your point ?
[10:53:21] dEPy: I just don't like that devise stuff their because user itself is not responsible for how authentication works,either being token based or anything else
[10:54:20] rushed: ace_striker: I'm going to take that as a "no, guessing how to install something isn't following good industry standards" :)
[10:55:05] rushed: ace_striker: if you check out one of the many bootstrap gems for the rails asset pipeline you'll likely find excellent instructions on how to install it on the main repo page, one options might be: gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3'
[10:55:38] ace_striker: rushed: ok..my bad language..i have installed bootstrap and include it custom.css.scss and use the proper class name in the application.html.erb but only padding is working .. i am unable to get it..why ..i have already 30 min on that..precisely..
[10:56:37] ace_striker: rushed: i have installed gem bootstrap-sass..
[11:01:20] mikecmpbll: I can't seem to get fields_for to work with an arbitrary collection. according to the docs if I have fields_for :settings, Setting.all ... it should produce the specified fields for all of my settings
[11:01:37] ace_striker: won't bootstrap-sass do the trick of bootstrapping
[11:01:51] mikecmpbll: however I get undefined method `nice_name` for #<ActiveRecord::Relation::ActiveRecord_Relation_Setting:0x007fc930315500>
[11:01:59] mikecmpbll: nice_name is one of the attributes in the fields_for.
[11:02:15] universa1: mikecmpbll: does setting have a nice_name attribute?
[11:02:58] mikecmpbll: it seems to be yielding the whole collection to the block rather than iterating the objects.
[11:03:19] mikecmpbll: i could loop through and use fields_for on each individual object but i thought that was the whole point of fields_for
[11:03:28] universa1: mikecmpbll: fields_for :settings, Setting.all each do |fs|; fs.nice_name ?
[11:03:46] yottanami: Is any gem for managin user information like address phone and .... ?
[11:03:57] universa1: mikecmpbll: i usually only use it in a form_for @bla do |f|; f.fields_for :hasmany_association way
[11:04:05] universa1: mikecmpbll: and there it works ;)
[11:04:27] ace_striker: rushed // i have installed bootstrap-sass
[11:04:45] mikecmpbll: universa1: yeah, i use it successfully like that too. i'm trying to do some stuff with form objects and shit that doesn't relate directly to models and associations.
[11:06:17] corp_: can I somehow "inject" code to methods defined by concerns without overriding them?
[11:06:41] universa1: mikecmpbll: sry, a bit clueless, the source code also doesn't provide any direct hints
[11:07:10] mikecmpbll: universa1: no probs, cheers
[11:07:24] universa1: corp_: can you call super in a overwritten method?
[11:07:48] corp_: universa1, nope because there's no inheritance, I just have included the concern
[11:08:30] universa1: then probably aliasing the method will work... but i haven't used concerns since they seem to try to solve a problem i don't have ;)
[11:09:18] corp_: yes I thought about aliasing too, but that seems a bit unclean to me, isn't it? but if that's my last resort..
[11:10:02] workmad3: corp_: a method that's pulled in with an 'include' is the equivalent of a superclass method
[11:10:06] workmad3: corp_: and you can get to it with 'super'
[11:10:43] workmad3: corp_: however, that means that the original method needs to call 'super'... otherwise you need to alias_method_chain it
[11:11:03] workmad3: corp_: or, if you're in ruby 2 and can ensure that, you can prepend the module
[11:12:08] corp_: ok, prepend. never heard about that, will google for it
[11:13:26] IceD^: hey. let's assume classic Post has_many :comments. I want to find posts with < N comments. can't use countercache (do not want to explain why, just can't). how?
[11:15:27] universa1: IceD^: probably by thinking about the problem from a different angle, but don't want to think more about it, because just can!
[11:15:30] workmad3: IceD^: Post.references(:comments).having("COUNT(comments.id) < N")
[11:15:44] toretore: why can't you use counter cache?
[11:16:15] IceD^: because to use CC I'll need to pessimistic lock that record for update (which will kill performance)
[11:16:20] workmad3: IceD^: if you're on rails 3, change references to includes
[11:16:43] IceD^: having is not working without group by
[11:17:04] workmad3: IceD^: group_by("posts.id")
[11:17:24] spamotuve: http://stackoverflow.com/questions/20525649/undefined-method-item-with-rails-on-form-submit/20526192?noredirect=1#comment30708090_20526192 this is my issue right now with validation using scope
[11:17:43] rushed: IceD^: optimistic > pessimistic, also you don't know what kills performance until you measure :)
[11:17:53] spamotuve: at my example, how should which model look like? because I added the hint in item.rb and that wasn't really what I wanted
[11:18:11] universa1: spamotuve: validate at the item.
[11:18:29] spamotuve: so validate :item, uniqueness: { scope: :cart_item }
[11:18:46] universa1: spamotuve: no, that's wrong. what is item.item ?
[11:18:59] spamotuve: what item.item ?
[11:18:59] universa1: spamotuve: or Item.first.item
[11:19:04] workmad3: IceD^: I'm gonna echo rushed though... you don't know if it'll kill real app performance until you measure real app performance... and by not using a counter_cache, you're trading a bit of overhead on inserting comments for overhead every time you put up a comment count...
[11:19:23] spamotuve: universa1: why is that wrong anyway?
[11:19:33] spamotuve: I think that validation has to go in cart model, right?
[11:19:38] universa1: spamotuve: what do you think is: Item.first.item ?
[11:19:52] universa1: spamotuve: no.
[11:20:40] spamotuve: I'm not sure what you mean, if I'm honest
[11:20:45] IceD^: ok - let me explain "real" problem. I got set of Containers, each container can have up to N Slots assigned to it. I have 4-5K acquire/release requests per second, on each request I need to find container which can host one more slot, create slot record, return id
[11:20:54] spamotuve: first item is the first item that the user has added to the cart
[11:21:13] universa1: spamotuve: you just wrote you want to validate the item column in your Item class, so i'm asking you what the item column in your item class is.
[11:21:15] IceD^: I tried to implement it "properly", with locking - performace goes to zero, really
[11:21:44] spamotuve: universa1: I suppose I meant that I want to validate it in Cart class
[11:21:45] workmad3: IceD^: ok... that helps
[11:21:57] workmad3: IceD^: and I can tell you that you're gonna need to rethink this
[11:21:59] universa1: spamotuve: no, you don't want to validate in the cart class.
[11:21:59] spamotuve: Cart can have many items, but those items have to be unique in each cart
[11:22:12] IceD^: I _can_ rethink
[11:22:15] spamotuve: so where else do I validate then?
[11:22:18] workmad3: IceD^: because your query for one with an extra slot is gonna cause you problems as it introduces a race condition
[11:22:25] universa1: spamotuve: define a unique item per cart
[11:22:50] spamotuve: that's what I'm trying to do here, but I can't quite figure out in which model I have to add what type of validation
[11:23:00] IceD^: well, atm I'm planning to insert slot record, check if slots count for that container is ok, if not - delete record and retry
[11:23:12] universa1: spamotuve: define a unique item per cart in a non code way, just abstract
[11:23:18] workmad3: IceD^: what I'd probably consider is maintaining a separate table of containers with > 1 slot... your pool of available containers
[11:23:32] corp_: workmad3, do I have to change "included do" in the concern to something like "prepended do" (does this even exist?)
[11:23:55] universa1: spamotuve: in plain english words.
[11:23:55] IceD^: containers count is ~10K, no need to go to separate table
[11:24:31] universa1: spamotuve: what conditions have to hold that an item in a cart is unique
[11:24:47] workmad3: IceD^: you could still end up with problems, even with your strategy
[11:24:52] IceD^: problem is high concurrency - if I'll not lock all related records or will not do after check - I'll not be able to ensure sanity of data
[11:24:52] spamotuve: product id mustn't overlap
[11:25:01] IceD^: I bet I can!
[11:25:32] universa1: spamotuve: ok, so where could you validate that product_ids don't overlap?
[11:25:38] workmad3: IceD^: two requests are trying to get a slot... in lockstep, they add a record, check, see that the count is too high, both delete the record, try again, get the same container, add record, see count is 1 too high, delete, try again...
[11:26:04] IceD^: utlization is around 95%, yes
[11:26:07] IceD^: that's possible
[11:26:09] workmad3: IceD^: whereas with a pool of known available containers, you can lock-delete a single row
[11:26:12] spamotuve: oh wait, no, in item
[11:26:23] workmad3: IceD^: add your record once you've done a lock-delete
[11:26:39] workmad3: IceD^: and then check to see if that container still has available slots, if so add it back to the available pool
[11:26:58] IceD^: I can also pre-create slots, and try to lock/set as acquired/unlock
[11:27:09] universa1: workmad3, IceD^: just thinking this might be a case where doing it directly in the db might be beneficial over doing it in ruby / app-code
[11:27:27] workmad3: universa1: yeah, it might be :)
[11:27:43] universa1: spamotuve: ok, so what do you want to validate there?
[11:28:17] workmad3: IceD^: you might also be able to set up (in postgres) a table constaint that uses that having query that enforces the count
[11:28:34] spamotuve: universa1: I want to make sure that a Cart that each user has, can only hold each product only once
[11:29:06] spamotuve: universa1: so that if the user wants to modify what's in his cart, he has to click edit on the given product in his cart, but he cannot add any more through products list
[11:29:18] universa1: spamotuve: ok, do you have an idea what validation could be helpful in that case?
[11:29:36] workmad3: IceD^: if you can, then your allocation becomes 'find a container, try to save a record... save fails, find a container, save a record...'
[11:29:47] IceD^: btw - let me clarify locking here. e.g. I have slot = Slot.where(...).first. I do slot.with_lock { slot.state = :acquired } - what will happen if I'll try to change same record in different thread?
[11:29:54] spamotuve: universa1: in my opinion it should be validates uniqueness
[11:30:15] universa1: spamotuve: ok, what code do you need to write then?
[11:30:32] workmad3: IceD^: most likely? it'll wait for the lock to be released, then run the block...
[11:30:53] spamotuve: universa1: validates :item, uniqueness: { scope: :cart }
[11:31:01] IceD^: probably it's what I need
[11:31:11] spamotuve: universa1: correct? but not really
[11:31:28] universa1: spamotuve: are you sure? you want to validate that the item column is unique scoped to the cart column
[11:31:35] workmad3: IceD^: pushing the check into the database so that a save fails if all slots are used would be the best way, probably
[11:31:42] IceD^: I can't lock containers (== performance hit), but I can lock individual slot (there are 5-10 slots per container, probability of collision is WAY lower)
[11:31:45] workmad3: IceD^: assuming that the constraint can be written like that
[11:32:12] workmad3: IceD^: optimistic lock them ;)
[11:32:17] universa1: spamotuve: the second sentence was a question ;)
[11:32:51] universa1: spamotuve: keep in mind that most rails validations work on database columns, not on associations.
[11:32:57] IceD^: let me try ;]
[11:33:01] spamotuve: universa1: ok, but then what would you suggest?
[11:33:02] universa1: simply speaking.
[11:33:35] universa1: spamotuve: which database has to be unique in the item class?
[11:33:43] universa1: *database column
[11:33:52] workmad3: IceD^: as yeah, that should work... if you have multiple processes grab the same slot (at v1), one of them will save it first and increment the version, then the next will try to save and fail (as the slot is now at v2)
[11:33:57] spamotuve: universa1: cart_id
[11:34:18] workmad3: IceD^: you might need to check the optimistic locking code in rails to see whether it's atomic though
[11:35:01] universa1: spamotuve: really? i probably should have said which "database columns or combination of database columns" should be unique in the item class
[11:35:39] IceD^: well, using state_machine here, it'll just change state
[11:36:18] spamotuve: universa1: well then I'm thinking product_id
[11:36:34] workmad3: IceD^: yeah, but if two processes get the same slot at the same time, they'll both be in the same state
[11:36:48] universa1: spamotuve: so in all records of item, you only ever want to have each product_id to occur only once?
[11:36:50] workmad3: IceD^: then one will transition, but that won't touch the already loaded slot for the other
[11:37:00] spamotuve: universa1: no
[11:37:17] universa1: spamotuve: ok, then waht do you want?
[11:37:32] IceD^: retry_it unless slot.with_lock { slot.acquire }
[11:37:36] spamotuve: universa1: I want each record of item to show only once per cart
[11:37:56] workmad3: IceD^: what does slot.acquire do?
[11:38:13] universa1: spamotuve: can you please stay in the item class and on the level of database columns?
[11:38:13] workmad3: IceD^: and you'll need to reload the slot inside the lock block
[11:38:22] IceD^: it's state_machine event. basicly it'll do slot.state = "acquired"; slot.save
[11:38:24] universa1: spamotuve: that is an abstract functional requirement.
[11:38:31] universa1: spamotuve: what you just said
[11:38:58] workmad3: IceD^: should work, as long as you reload the slot inside the block
[11:39:01] universa1: spamotuve: and to be honest, how you formulated it has nothing to do with validation.
[11:39:06] corp_: now that is really strange (to me): prepend Signup::Concerns::Controllers::AccountAssignmentsController brings: wrong number of arguments (1 for 0)
[11:39:13] corp_: prepend takes 1 argument, doesn't it?!
[11:39:16] spamotuve: universa1: what else has it got to do with in that case?
[11:40:10] universa1: spamotuve: well you just said you want each item to only show once per cart, if that's really what you want you're done. no need for validations, just loop over cart.items
[11:41:41] universa1: spamotuve: that way you get each item exactly once
[11:42:00] spamotuve: universa1: yes, but the user can still add more than one
[11:43:01] universa1: spamotuve: sure, but still each item is only displayed once. i think you're having problems thinking in your problem domain and are mixing up item with other meanings, which are not in your code
[11:43:55] IceD^: workmad3: with_lock does reload as I understand (actually, it does select for update)
[11:44:58] universa1: spamotuve: i can give you the code to solve your problem, but that doesn't really help you imho, i would really prefer if you'd actually udnerstand why you need what code
[11:45:18] spamotuve: I wouldn't mind understanding that either
[11:45:44] spamotuve: universa1: because at the moment I have this idea that I could display only one item and the sum of all count columns for that item if it has been added more than once
[11:45:51] spamotuve: but that would screw up editing that item afterwards
[11:45:57] spamotuve: (editing in cart)
[11:47:00] IceD^: cart_item(item_id, count). done
[11:47:00] universa1: spamotuve: ok maybe an example helps you: User workmad has a shopping cart. He puts product Popcorn into it. What happens in your database?
[11:47:21] workmad3: wait... why am I buying popcorn?
[11:47:34] universa1: workmad3: because you're silently watching all the time :p
[11:47:46] universa1: and this can only be because you're eating popcorn :p
[11:47:49] workmad3: universa1: yeah... but I can't stand popcorn...
[11:48:11] universa1: workmad3: then you're buying popcorn for sevenseacat ;)
[11:48:15] workmad3: tastes like stale cardboard with sugar or salt on it...
[11:48:27] workmad3: universa1: I'm not sure my wife would approve of me buying popcorn for another woman :P
[11:48:27] spamotuve: in my database: User(name="workmad") has_one Cart has_many Items (title="Popcorn", count="1")
[11:49:09] universa1: spamotuve: what would your just created Item record look like?
[11:49:35] IceD^: spamotuve: cart has_many cart_items. cart_item belongs_to item
[11:49:59] universa1: IceD^: s/cart_item/item/ and s/item/product/ and you've his setup
[11:50:02] IceD^: adding item to cart - either add new cart_item or modify count
[11:50:17] IceD^: in this case I don't see problem ;]
[11:50:49] rushed: spamotuve: are you going to be playing with people money at some point? if so you might consider http://spreecommerce.com/ or point and click http://www.squarespace.com/
[11:50:51] spamotuve: IceD^: yeah I know, I just want to figure out how to modify count, I'm a complete noob in rails and programming in such, basically a few days ago I started out agile development with rails
[11:51:35] universa1: IceD^: yeah, for a somewhat experienced developer this is perfectly easy to solve ;)
[11:52:05] universa1: just trying to get spamotuve to find and understand the underlying problem and solution himself/herself
[11:53:52] universa1: spamotuve: what would your just created Item record look like? what values do your database columns have?
[11:54:44] spamotuve: https://gist.github.com/anonymous/f1ac7ae79a077b1386c8 my db
[11:55:02] universa1: spamotuve: that's not what i meant.
[11:55:27] spamotuve: well basically
[11:55:36] universa1: spamotuve: if someone puts a product into his cart, what kind of record do you create and what values does it have?
[11:55:37] spamotuve: I have to modify the count if a user adds another item
[11:55:45] spamotuve: it creates a record Item
[11:55:54] spamotuve: and that Item has values product_id and count
[11:56:00] spamotuve: and cart_id
[11:57:01] universa1: spamotuve: ok. so please forget about modifying the count for now. what happens if that person puts the same product into his cart again?
[11:57:45] spamotuve: he has two identical items in his cart with different counts
[11:59:40] universa1: spamotuve: ok, with which columns of which class / record could you check that he already has that product in his cart
[12:00:09] IceD^: I'm not experienced rails dev (heck, I HATE web development), but cart is something really trivial
[12:00:27] spamotuve: IceD^: well I'm sorry for being a newb
[12:00:32] IceD^: na, it's ok
[12:00:41] IceD^: I was asking newbish questions here like 10 mins ago
[12:01:40] universa1: we usually don't care about the level of the question as long as the person asking follows basic netiquette(?) and the rules expected in here
[12:02:08] spamotuve: so am I following those two? :)
[12:02:18] IceD^: def add_item_to_cart(cart, item, count) { cart_item = CartItem.where(cart: cart, item: item).find_or_create; cart_item.count ||= 0; cart_item.count += count }
[12:02:45] IceD^: and, well, cart_item.save
[12:02:59] universa1: IceD^: ok, now explain all you've done :p
[12:03:36] spamotuve: this is sort of evil from IceD^ now
[12:03:54] spamotuve: now I sort of have the code
[12:04:10] universa1: spamotuve: you still haven't used your validation problem
[12:04:35] universa1: spamotuve: ok, with which columns of which class / record could you check that he already has that product in his cart
[12:04:49] IceD^: well, it's really simple code - first it's checking if this item is in cart already and creates new cart_item if it's not
[12:04:54] IceD^: after that it just modifies counts
[12:05:01] spamotuve: IceD^: yeah I get that part
[12:05:22] spamotuve: universa1: imho I could check Item class
[12:07:06] universa1: spamotuve: which columns?
[12:08:49] spamotuve: product_id and cart_id
[12:09:23] universa1: spamotuve: ok, so: validates :database_column, uniqueness: {scope: :another_column}
[12:10:34] spamotuve: validates :cart_id, uniqueness {scope: :product_id} ?
[12:10:34] IceD^: btw - another question. is it good idea to move logic into model
[12:11:08] IceD^: e.g. model Server - should I keep actual server launch code in model or find another place for it?
[12:13:15] universa1: spamotuve: even though that should work, don't you want to make sure that the product(_id) is unique scoped to the cart(_id)
[12:13:45] universa1: spamotuve: your way is wrong, my mind is starting to getting confused ;)
[12:14:21] yottanami: How can I create a gem that extents an engine which is a gem by itself ?
[12:15:30] rushed: yottanami: you might check out examples of gems which extend common Rails engines (Spree, Forem, etc) and see how they're configured
[12:16:01] universa1: spamotuve: you want: validates :product_id, uniqueness: {scope: :cart_id}
[12:16:37] spamotuve: I had one possible mistake to make and I nailed it like a champ
[12:16:41] universa1: spamotuve: even though the other way around should actually also be fine
[12:19:36] yottanami: rushed: Can you introduce me some samples gems ?
[12:21:40] ace_striker: no luck to me...2 hours still...can't make bootstrap-sass working with my code..pity.on me.
[12:21:46] rushed: yottanami: hard to suggest something relevant without knowing what the engine does and what you're trying to override, for example is it views, models, look at feel, api, everything?
[12:22:13] rushed: ace_striker: if only someone had linked you to a working solution with installation instructions... oh wait I did :)
[12:22:50] ace_striker: rushed: does bootstrap-sass has any other dependecy..?
[12:23:12] universa1: ace_striker: none that bundle does not resolve.
[12:24:26] ace_striker: then still i got no bootstrapping with sass...https://github.com/igauravsehrawat/forge_ahead what it could be. all structures arre fine
[12:24:32] yottanami: rushed: I try to extend some of my engines and I'm looking for a sample gem as much as easier to understand as possible.
[12:25:27] rushed: yottanami: engines that do what? extend in what way? lacking that I'd say what I said before checkout any add ons for popular engines :)
[12:25:45] universa1: ace_striker: why is the manifest at the bottom of your file? and why are you using a sass import in a non sass/scss file?
[12:26:02] universa1: ace_striker|brb: your code is faulty. that is.
[12:27:48] yottanami: rushed: Here is my Engine : https://github.com/Yellowen/Red_Base It creates a dashboard and base needs of a web application.
[12:27:49] yottanami: now I want create a addressbook gem for it
[12:31:32] rushed: yottanami: why do you think that belongs in a gem? have you considered just building your application and extracting functionality you want to reuse in the future as needed?
[12:32:50] yottanami: rushed: What do you mean by your first question ?
[12:33:04] yottanami: Yest I considered that before
[12:39:49] Macaveli: If you don't want a migration to happen
[12:39:55] Macaveli: can you simply remove the migration file
[12:40:09] lxsameer: Macaveli: yeah
[12:40:23] rushed: Macaveli: you'd probably want to revert the migration for any databases you care about that you've applied it to first, but then yes
[12:43:54] kumar_rails: i upload images to aws bucket
[12:44:29] kumar_rails: how to i retrive that images in my view page, i am using <%= image_tag(message.http://s.enprobe.io.s3.amazonaws.com.url(:medium).to_s) %>
[12:46:51] rushed: kumar_rails: what gem did you use to get the image on s3, it likely describes how to build a reference to it
[12:47:52] kumar_rails: <rushed>i used gem 'fog'
[12:48:32] rushed: kumar_rails: manually? no carrier wave or anything? are these for user uploaded images?
[12:51:09] kumar_rails: <rushed>i used carrierwave,rmagick,fog,unf,excon and aws-sdk to store files in aws i created fog.rb
[12:55:34] universa1: kumar_rails: your image tag example looks tiotally broken with the url in there.
[12:57:58] kumar_rails: <universa1> i am uploading images dynamically from front end after uploading i need to show them,i am confuse totally
[12:58:52] rushed: kumar_rails: you might find working examples helpful http://railscasts.com/episodes/253-carrierwave-file-uploads http://railscasts.com/episodes/383-uploading-to-amazon-s3
[12:59:05] universa1: kumar_rails: <%= image_tag(message.http://s.enprobe.io.s3.amazonaws.com.url(:medium).to_s) %> ?? what is the s3 url doing there?
[12:59:19] tyl: does anyone know why i am getting this error in capybara
[12:59:20] tyl: before {sign_in user, no_capybara: true}
[12:59:32] tyl: wrong number of arguments (2 for 1)
[12:59:46] universa1: tyl: because sign_in doesn't take a second argument.
[13:00:04] kumar_rails: <universa1> s.enprobe.io in my amazon bucket
[13:00:05] tyl: http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#top
[13:00:20] tyl: universa1 i am following the michael hartl tutorial
[13:00:43] tyl: apparently in the integration test they can take the 2nd argument
[13:00:55] tyl: i have added minitest-metadata but it didn't work
[13:01:15] universa1: tyl: where have you defined sign_in ?
[13:01:30] tyl: in applicationhelper
[13:01:31] rushed: kumar_rails: you can't just paste it in near the place that does something related to images and expect it to magnetically click into place :) check out the examples I linked or the docs for the gems you're using :)
[13:01:49] universa1: tyl: o0, that is not the sign_in method used in your specs.
[13:02:23] tyl: universa1 oh wait i meant utltilies.rb
[13:02:52] universa1: tyl: so how does it look like?
[13:03:02] universa1: how are you requiring it in your specs?
[13:03:14] tyl: http://pastie.org/8547136
[13:03:28] universa1: tyl: where is the second argument?
[13:03:59] universa1: tyl: don't skip parts of the tutorial...
[13:04:07] tyl: http://pastie.org/8547137
[13:04:10] tyl: universa1 i didn't
[13:04:23] tyl: before {sign_in user, no_capybara: true}
[13:04:41] universa1: tyl: you did. that is how you call it, but where in your definition is the second argument?
[13:04:49] universa1: you defined a method which only takes one argument.
[13:04:53] tyl: universa1 this is a capybara test
[13:05:05] tyl: i think the minitest is supposed to allow it
[13:05:19] universa1: tyl: so what? now methods magically take a second argument, even though they've only be defined with one?
[13:05:31] tyl: in capybara yes
[13:05:36] tyl: not normally
[13:06:04] universa1: tyl: and the computer magically figures out what you mean by no_capybara: true?
[13:06:15] tyl: it doesn't magically find it out
[13:06:17] universa1: tyl: can it also figure out: send_me_money: 1000000$ ?
[13:06:29] tyl: universa1 your getting incredbily condescending
[13:06:31] universa1: tyl: you're saying it does. computers are actually quite stupid.
[13:06:35] tyl: calm down
[13:06:35] rushed: universa1: you have to put the currency symbol at the front :)
[13:06:42] universa1: rushed: damn...
[13:06:47] universa1: tyl: look at Listing 9.6
[13:06:54] universa1: tyl: since you obviously missed it.
[13:12:38] universa1: but happy to help, was a pleasure. no need to say thank you...
[13:15:08] RxDx: i installed nginx using passenger gem.. now when i run "pgrep -l nginx" there are two process running.. is it normal?
[13:15:45] rushed: RxDx: depends on your configuration and how many there were before :)
[13:16:05] RxDx: rushed, i dont know how many were there before =/ hehe
[13:24:23] AxonetBE: If I use sti for my lists, do I have to repeat the word list in my child class? Like FavoriteList < List because when I don't do this, I have some relations that can be interpreted wrong. Example : https://gist.github.com/DriesS/375ab6f5782f32f7a878
[13:24:48] AxonetBE: you see that User has_one favorite, but it means in fact 1 favorite_list, how can I solve this following the ruby conventions?
[13:26:27] mikecmpbll: AxonetBE: what's the problem?
[13:27:12] AxonetBE: mikecmpbll: That for the moment I have user.recently_viewed that gives me a list back that has_many :list_items
[13:27:37] mikecmpbll: that doesn't sound like the description of a problem, unless i'm missing something
[13:27:53] AxonetBE: a new developer will expect that it gives back a recently_viewed item
[13:28:13] AxonetBE: so the question is, how do you guys manage this?
[13:28:24] AxonetBE: Do you repeat the parent class name in the child ?
[13:28:32] AxonetBE: like RecentlyViewedList < List
[13:28:57] AxonetBE: I'm just searching the best practice
[13:29:04] mikecmpbll: still don't understand the problem: "user.recently_viewed that gives me a list back that has_many :list_items" doesn't really mean anything to me.
[13:30:50] AxonetBE: mikecmpbll: what do you expect to get if you see user.recenlty_viewed
[13:31:04] mikecmpbll: a single object of type RecentlyViewed
[13:31:31] AxonetBE: ok then it's clear:)
[13:31:50] mikecmpbll: is that not the case?
[13:33:21] AxonetBE: yes, but I want to search a way that you know that you will receive a recently_viewed object that inherits from list
[13:35:39] mikecmpbll: uh, if it's just a question of naming, then sure, calling it RecentlyViewedList makes more sense.
[13:37:26] hendricius: Question - it seems the database.yml timeout option is being ignorest by postgres.
[13:37:46] hendricius: is this a setting we need to add to postgres directly?
[13:39:30] mikecmpbll: hendricius: i always assumed timeout was a sqlite only setting
[13:39:44] mikecmpbll: just from the fact it's in the default sqlite db config but not the default for any of the other adapters.
[13:43:06] rushed: hendricius: why do you think it's being ignored? any chance you're conflating a connection timeout window with a query execution timeout window?
[13:44:29] hendricius: rushed: we are getting some errors in sidekiq: could not establish a connection within 5 seconds, but it is set to 20000 in the database.yml
[13:48:51] Fire-Dragon-DoL: What's the opposite of 2.years.ago in activesupport? need 2 years after today :S
[13:49:28] rushed: Fire-Dragon-DoL: 2.years.from_now
[13:50:52] rushed: hendricius: is it possible you've maxed your connection pool?
[13:54:40] hendricius: rushed: yep. can i increase it in rails directly, or postgres?
[13:56:04] rushed: hendricius: not sure, I would see what the sidekiq repo/docs/etc suggest
[14:12:17] alex88: hi, is it possible to create multiple routing resources linked to the same controller and there, depending on the parameters, know how to filter? like /teams/1/players returns players of team 1, /players returns all user player?
[14:22:38] alex88: thanks toretore
[14:52:33] Yatekii: hi guys can you tell my what this exactly means? no implicit conversion of nil into Integer in this line: Time.new(temp_date[2], temp_date[1], temp_date[0], temp_time[0], temp_time[1])
[14:52:49] saikyun: hello! is there any way to display rails standard error messages when using Redmine? I tried asking on their irc channel but no one seemed to be there
[14:53:17] Yatekii: because none of those values is 0
[14:53:32] erichmenge: Yatekii: nil != 0
[14:54:46] universa1: Yatekii: nil in ruby is what in Java is null
[14:55:10] Yatekii: but none of those values is null
[14:55:20] Yatekii: that is the fun part
[14:55:20] erichmenge: Yatekii: Ruby seems to disagree.
[14:55:33] Yatekii: I just printed them
[14:56:06] erichmenge: Yatekii: Well, none of us can help you. You basically are asking this: "Which one of these values is nil? temp1, temp2, temp3, or temp4?"
[14:56:21] erichmenge: Gist up some code.
[14:56:29] universa1: Yatekii: gist the output of temp_date.inspect and temp_time.inspect and the code.
[14:56:44] Yatekii: gotta leave train :S
[14:56:49] Yatekii: I will investigate
[14:56:51] Yatekii: thanks anyways :)
[14:58:01] erichmenge: Guys, I only have like 30 seconds. Halp!
[14:58:19] erichmenge: Also, how do I Ruby?
[14:59:07] erichmenge: workmad3: I've never asked. What is the significance of the 3 in your moniker?
[14:59:23] workmad3: last digit of the year I started uni
[14:59:43] erichmenge: Oh, I see. So it was your university username?
[14:59:54] erichmenge: That's a pretty nice username.
[15:00:03] workmad3: yeah, autogenerated too :)
[15:00:27] workmad3: 6 letters from surname, first letter of first name, last digit of year you started
[15:00:51] workmad3: there was supposedly a foreign student called K. Wan in the year before me...
[15:01:49] mechanicalfish: /msg nickserv help
[15:02:04] erichmenge: /msg nickserv login mechanicalfish passw0rd
[15:02:18] workmad3: mechanicalfish: no spaces ;)
[15:02:23] workmad3: mechanicalfish: also sasl auth ftw!
[15:02:36] saikyun: um, did anyone see my question? :x
[15:02:40] mechanicalfish: typo, sorry about that :)
[15:02:41] tagrudev: /msg tagrudev id password
[15:03:07] erichmenge: saikyun: Yep
[15:03:17] workmad3: tagrudev: done
[15:03:31] tagrudev: ur password I like it
[15:03:38] workmad3: that's my 'special' password ;)
[15:05:30] tweeeaks: is there any reason Radar 's answer here: http://stackoverflow.com/questions/4120537/tell-if-a-controller-is-being-used-in-a-nested-route-in-rails-3 wouldn't work in rails 4... just trying to problem solve
[15:06:35] saikyun: but no one knows anything about it? :(
[15:06:49] erichmenge: saikyun: No.
[15:06:50] saikyun: I've tried googling redmine with a lot of stuff, but can't really find anything about it
[15:07:03] tagrudev: tweeeaks, nope
[15:07:12] saikyun: it's really annoying, you just get a "internal error" and have to look in the log files
[15:07:40] tweeeaks: tagrudev thanks, thats what I figured :/ back to the drawing board
[15:07:47] tagrudev: tweeeaks, maybe use before_action since that's the new way in rails 4
[15:08:00] tagrudev: but it should work as that
[15:11:01] tweeeaks: tagrudev will do.. should I always use before_action w/ rails 4?
[15:11:39] tagrudev: seems to be the new way
[15:12:12] erichmenge: Yeah, before_filter was renamed to before_action and before_filter was aliased to before_action
[15:17:31] saikyun: disconnect
[15:18:48] tagrudev: workmad3, another disturbing video (read the comments too) https://www.facebook.com/photo.php?v=567921219953766
[15:20:48] universa1: tagrudev: W T F
[15:21:35] tagrudev: the force is strong in this one
[15:21:48] universa1: tagrudev: very much so...
[15:22:08] Fire-Dragon-DoL: Are there any suggestion/guide on how to test rails helpers? I'm writing a gem which should share some view helpers, but I don't know which is the correct way to test them. Should I only use feature tests with capybara + rspec? Or maybe it's better if I test some functionality like with models
[15:24:02] mikecmpbll: lmfao at that video.
[15:24:23] erichmenge: His meat looks a little old.
[15:25:30] tagrudev: the guys has some issues though
[15:25:38] erichmenge: Hey that looks like real pee at the end.
[15:28:19] Fire-Dragon-DoL: workmad3: wtf is that video, is terrible
[15:30:52] mcmillion: this video is blowing my mind
[15:30:52] workmad3: Fire-Dragon-DoL: ask tagrudev, not me
[15:32:01] Fire-Dragon-DoL: workmad3: he left room xD
[15:34:48] IceD^: another crazy and newbish question
[15:36:13] IceD^: same situation - have container has_many :slots. each slot got state (string). I want to fetch containers ordered by available slots count.
[15:36:53] Fire-Dragon-DoL: IceD^: what is available slots count? you mean state: 'available' ?
[15:37:41] IceD^: Container.where(some_not_related_condition).order("count(container.slots where slot.status=available)")
[15:38:06] Fire-Dragon-DoL: IceD^: and it's not that easy, it's a query with a subquery, I suggest you to first come with a valid SQL query on sqlfiddle
[15:38:10] Fire-Dragon-DoL: and then translate it into rails
[15:38:25] IceD^: I really don't want to write any sql ;]
[15:46:06] CorySimmons: Anyone have any idea why this will render with binding.pry but not when I'm actually viewing the ActiveAdmin page? http://i.imgur.com/IyyuC15.png
[15:47:01] CorySimmons: That is, when I remove the binding.pry it doesn't appear in the ActiveAdmin index. :(
[15:55:28] workmad3: CorySimmons: I assume you mean that the link_to doesn't appear in the output?
[15:58:08] tewlz: What's a good way to put logic in a footer that asks 'if in this view, do this'
[15:58:15] workmad3: CorySimmons: right... it's because the output doesn't get added to anything
[15:59:40] Cork: what would be the correct params.permit to allow an array of files?
[15:59:53] helpa: Cork: You haven't shown any code. You haven't shown the full error. You haven't shown any logs. You're making it really, really hard for us to help you.
[16:00:26] dcope: hey all. i'm seeing weird behavior in production where simple AR fetches take ~4000ms. Eventually, the problem goes away for a few days then randomly comes back up. Anyone know what's going on? Perhaps it's my db host
[16:01:33] bobbobbins: hey, i asked this last night but didn't find a solution, maybe someone could help...im posting those params at the bottom to the create method, but the params are always blank for some reason....any idea why? https://gist.github.com/bobbobbins/69641af31644ad05f57f
[16:01:35] Fire-Dragon-DoL: What's the correct way to provide helpers from a gem to a rails app? I've found on_load include helper or create ApplicationController (in an engine) and add helper MyEngine::MyHelper
[16:01:44] Cork: i have params "files" it is an array of ActionDispatch for file uploads
[16:01:52] Cork: params.permit(???)
[16:02:04] Cork: not sure what code to show
[16:02:24] Fire-Dragon-DoL: mh maybe files: []
[16:03:20] momomomomo: https://github.com/rails/strong_parameters#require-multiple-parameters
[16:03:40] dEPy: why do i get Unable to autoload constant Devise::Mailer when tryin to create a user using factory girl in my rspec test? O_O
[16:03:40] momomomomo: oops wrong link
[16:03:54] Cork: momomomomo: the files is optional
[16:04:44] momomomomo: guides.rubyonrails.org/action_controller_overview.html#outside-the-scope-of-strong-parameters
[16:04:52] Fire-Dragon-DoL: Cork: https://github.com/rails/strong_parameters#nested-parameters
[16:06:59] bobbobbins: anyone know what I'm doing wrong?
[16:07:17] Fire-Dragon-DoL: bobbobbins: watching the horrible video that was posted=
[16:07:52] Fire-Dragon-DoL: (16:16:27) tagrudev: workmad3, another disturbing video (read the comments too) https://www.facebook.com/photo.php?v=567921219953766
[16:10:46] bobbobbins: jeez, thats weird
[16:11:52] momomomomo: bobbobbins: render 'action', locals: { my_variable: 'value' }
[16:13:17] bobbobbins: momomomomo: I'm not using render...I'm calling create via an js ajax call
[16:13:46] momomomomo: Tell me, bobbobbins what https://gist.github.com/bobbobbins/69641af31644ad05f57f is then
[16:14:55] bobbobbins: the json is what is being posted to create via the ajax...and the create method is up there, but params is empty when I call Annotation.create()
[16:15:21] momomomomo: paste your entire controller
[16:15:40] krawchyk: anyone know of a fix for 100% cpu usage when using guard-livereload?
[16:16:49] tubbo: krawchyk: it's times like these when i wish rails 4 didn't drop live reloading using SSE :(
[16:17:07] bobbobbins: momomomomo: its updated
[16:17:16] krawchyk: tubbo: sse?
[16:17:16] momomomomo: bobbobbins: rails version
[16:18:04] momomomomo: bobbobbins: https://github.com/rails/strong_parameters
[16:18:16] momomomomo: bobbobbins: http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html
[16:19:07] tubbo: krawchyk: server sent events
[16:19:30] bobbobbins: thats a requirement?
[16:19:35] tubbo: krawchyk: in some early demos of rails 4 functionality, you could make changes in your editor and if you were running in development locally, the change would refresh on the page automatically.
[16:19:37] tubbo: it was pretty cool!
[16:19:45] tubbo: no external livereload component necessary
[16:19:47] krawchyk: tubbo: it is!
[16:20:00] krawchyk: tubbo: that's too bad it wasnt included in the 4 release
[16:20:00] tubbo: krawchyk: maybe you could implement it yourself :) https://developer.mozilla.org/en-US/docs/Server-sent_events
[16:20:09] krawchyk: tubbo: haha i was just looking at that
[16:20:28] momomomomo: bobbobbins: a little bit of google does you good : http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters
[16:20:40] krawchyk: tubbo: sadly i dont have time for that, i really dont care about 100% cpu except that my fans are going off the charts and annoying me
[16:20:52] krawchyk: anyone had trouble using guard and high cpu usage?
[16:21:21] momomomomo: krawchyk: my advice would be to create an issue on the guard page, or check their issues
[16:21:31] tyl: universa1 thanks for the help just now
[16:21:43] krawchyk: momomomomo: i have checked the issues, ill create one thanks
[16:23:36] tubbo: test-unit 2.x is fucking crazy
[16:24:09] Fire-Dragon-DoL: krawchyk: I do have a lot of troubles
[16:24:20] bobbobbins: momomomomo: so i set that up, and quote is being passed, but now the strong params thing errors because it says one of the ones being passed isn't there
[16:24:32] Fire-Dragon-DoL: krawchyk: overheated my pc 3 times (laptop) before I noticed it, and consider that this laptop do not overheat when playing games
[16:24:36] tubbo: Fire-Dragon-DoL: http://imgur.com/nS2OoLM
[16:24:38] helpa: bobbobbins: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[16:24:38] momomomomo: bobbobbins: !code
[16:25:02] krawchyk: Fire-Dragon-DoL: haha well glad i noticed it before it got to that point!
[16:25:16] tubbo: test output is really wonky
[16:25:22] krawchyk: Fire-Dragon-DoL: pc... im on osx 10.9 what are you using?
[16:25:45] Fire-Dragon-DoL: krawchyk: debian wheezy
[16:26:56] Fire-Dragon-DoL: can someone tell me a gem with some helpers that do get imported into rails app so maybe I can find out which is the correct way to import them through a gem?
[16:27:22] Fidelix: Hello, can someone help me understand the concept of how the rails magic happens with model relationships? The documentation for this is extremely poor. These are my models/migrations: http://paste2.org/5XdyMs6j
[16:27:28] tubbo: Fire-Dragon-DoL: helpers is a really vague term. what are you talking about?
[16:27:30] tubbo: like rails helpers?
[16:28:04] helpa: Fidelix: http://guides.rubyonrails.org/association_basics.html - Active Record Association Basics by Mike Gunderloy
[16:28:04] tubbo: Fidelix: !associations first of all, have you read that?
[16:28:06] Sylario: Fidelix : what are you trying to do?
[16:28:19] tubbo: Fidelix: because if you haven't, then you can't say the "documentation for this is extremely poor" :P
[16:28:34] Fire-Dragon-DoL: tubbo sorry I mean VIEW helpers
[16:29:06] tubbo: Fire-Dragon-DoL: right, so the ones in ./app/helpers? you can just do `rails plugin new <name> --mountable` to get an example of that. it's called a "mountable engine", and basically its a convention for rails plugins/engines.
[16:29:25] Fidelix: tubbo: I have read that doc
[16:29:52] Fidelix: I still don't understand if rails creates the table columns automatically for me or if I should create them myself in the migration
[16:29:53] tubbo: Fire-Dragon-DoL: basically you create a `YourPlugin::Engine < Rails::Engine`, and then Rails knows to include any of the code in ./app in your plugin's gem path
[16:30:07] tubbo: Fidelix: on which field?
[16:30:28] bobbobbins: updated: https://gist.github.com/bobbobbins/69641af31644ad05f57f
[16:30:30] tubbo: Fidelix: ohh right, yeah you need to create it in the migration: `t.references :title` should do it.
[16:30:31] Sylario: Fidelix: you have to create the foreign id in migrations
[16:30:39] Fire-Dragon-DoL: tubbo: so you mean what is in mygem/app/helpers/myengine/myhelper_helper.rb gets auto imported by the engine into my rails app?
[16:30:42] tubbo: Fidelix: that is, in the create_subtitles migration
[16:30:50] tubbo: Fire-Dragon-DoL: yup.
[16:31:18] tubbo: Fire-Dragon-DoL: it's a little complex now but i always turn to Devise as the "model engine" when i have questions. Devise "just works": https://github.com/plataformatec/devise
[16:31:34] tubbo: and by model i mean great example, not data model..hah
[16:31:40] Fidelix: tubbo: so all the associations I write in the models do is define a relationship so rails can access stuff more easily?
[16:31:51] Fidelix: And so it can differentiate an array from a single item?
[16:32:28] Fire-Dragon-DoL: tubbo: good point, I usually watch at devise but I thought devise didn't have any viewhelper
[16:32:45] tubbo: Fidelix: pretty much. it defines the ruby code for an association that already exists in the database. the convention is *_id.
[16:32:49] tubbo: for the fk name that is
[16:33:20] tubbo: Fidelix: belongs_to :title basically just does define_method(:title) { Title.where(this_model_id: id).first }
[16:34:09] tubbo: Fire-Dragon-DoL: https://github.com/plataformatec/devise/blob/master/app/helpers/devise_helper.rb
[16:35:41] bobbobbins: momomomomo: hey, i updated my gist if you have a minute
[16:35:55] krawchyk: Fire-Dragon-DoL: i bundled guard using the github url in my Gemfile... seems to have fixed the problem
[16:36:17] Fidelix: tubbo: oh now it all makes sense. Thanks man. Someone else recommended me a book just to understand this...
[16:36:41] erichmenge: Books are for chumps.
[16:36:54] tubbo: erichmenge: +1
[16:37:16] tubbo: ACTION has yet to finish a book on programming...so dry, just makes him want to get into the code and break shit
[16:37:30] AntelopeSalad: the official rails guide is great for the basics
[16:37:45] Fidelix: AntelopeSalad: I find it the opposite. It sucks bad.
[16:37:51] Sylario: one of the best official doc/book i read is the one from git
[16:38:16] Fidelix: AntelopeSalad: it sucks so hard... It's the worse framework doc I have ever read in my life, to be honest
[16:38:25] tubbo: is ` session[:user_id] = @user.id
[16:38:28] AntelopeSalad: Fidelix: are you looking at the api docs or the guide?
[16:38:38] AntelopeSalad: because they are much different
[16:38:46] tubbo: is `session[:user_id] = @user.id` the proper way of forcing session params in a controller test (rails 2.3)?
[16:38:46] Fidelix: AntelopeSalad: what I managed to learn so far was from "Pragmatic.Agile.Web.Development.with.Rails.4.Sep.2013"
[16:38:49] tubbo: or is there a better way
[16:39:01] Fidelix: AntelopeSalad: the guides.rubyonrails.org
[16:39:17] Sylario: Fidelix : i started with this one (but for 3), it sucked
[16:39:32] tubbo: Fidelix: meh, once you get good enough you don't really need docs anymore. click "show source" :P
[16:39:41] Fidelix: AntelopeSalad: but that book also fails to connect many important concepts together, like the one I was struggling with.
[16:39:52] AntelopeSalad: Fidelix: how can you say this is bad? http://guides.rubyonrails.org/association_basics.html
[16:39:56] AntelopeSalad: it covers so much
[16:40:08] Fire-Dragon-DoL: krawchyk: I may try it later on, but I had some dependency issues because I was using jekyll
[16:40:11] _spiderman: If I have a form for creating an object, how do I associate that object with a user? Would I embed the user id in the form and send it back with the params or would I create it based on the current user in the controller
[16:40:15] Fidelix: AntelopeSalad: the same reason, it fails to connect the concepts together.
[16:40:28] erichmenge: AntelopeSalad: My guess is it doesn't do enough hand holding. People want to be able to copy-paste code.
[16:40:28] tubbo: Fidelix: i mean, not trying to be a dick but if you really think about it for 5 minutes it's kind-of common sense...
[16:40:32] Fidelix: AntelopeSalad: it is well written, and for someone who is not new to Rails it might make 100% sense, but not for me
[16:40:40] tubbo: Fidelix: that is, if you understand what the rails model layer is doing
[16:40:44] erichmenge: That's what writing software is today. You look at tutorials, and copy/paste.
[16:40:49] lethjakman: tubbo: that's what I used in test unit.
[16:40:57] tubbo: Fidelix: which i think has been lost on the current generation of rails newbs
[16:40:59] erichmenge: The guides have all the information, but they don't give you a complete app to copy/paste from.
[16:41:15] Fidelix: tubbo: thats the thing. it might make sense for you, you understand how stuff works from the inside out.
[16:41:16] tubbo: Fidelix: the guides are for people who are 100% new to rails.
[16:41:17] AntelopeSalad: Fidelix: i used the guide combined with a free pass to codeschool to learn rails from ground 0
[16:41:40] tubbo: Fidelix: people who are experienced usually just go to api.rubyonrails.org...they already understand the concepts, it's just syntax they need a refresher on.
[16:41:56] tubbo: Fidelix: also, many people who use rails came from MVC backgrounds...so it's really just "learning how the magic works".
[16:42:05] tubbo: lethjakman: awesome.
[16:42:15] Fidelix: I managed to learn Symfony 2 with scarce, but well-written docs that never leaves stuff to explain later.
[16:42:17] AntelopeSalad: yeah to be fair i had some experience working with other libs/frameworks
[16:42:23] Fidelix: That's the problem with the rails guides, IMO
[16:42:38] AntelopeSalad: there's always railscasts too
[16:42:39] tubbo: Fidelix: change them. https://github.com/rails/docrails
[16:42:43] tubbo: Fidelix: the docs are open source.
[16:42:51] tubbo: (guides are in there, too)
[16:42:53] Fidelix: tubbo: I intend to. But I want to learn first :)
[16:42:58] tubbo: Fidelix: good man!
[16:43:03] tubbo: or woman i guess :P
[16:43:08] tubbo: ACTION has no concept of gender
[16:43:27] Fidelix: So far Rails is much easier than Symfony 2, no question about that.
[16:43:42] AntelopeSalad: my mental image of tubbo is a pale that you would put sand in
[16:43:56] tubbo: AntelopeSalad: well you got the "pale" part right...
[16:43:56] erichmenge: Mine is a fat kid
[16:44:06] erichmenge: Tubbo is a pretty handsome guy though to be honest.
[16:44:12] tubbo: <3 erichmenge
[16:44:14] AntelopeSalad: i have no idea why either
[16:44:15] erichmenge: Awesome beard.
[16:44:24] tubbo: erichmenge: ....and it's shaved :D
[16:44:35] erichmenge: You removed the beard?
[16:44:35] tubbo: https://0.gravatar.com/avatar/0f985a758113f6502f668b09d2b15fc2?d=https%3A%2F%2Fidenticons.github.com%2F374776f1076b693ab82c7efccb1cf1c2.png&r=x&s=440
[16:44:40] tubbo: feels good man
[16:44:46] erichmenge: ACTION retracts handsome comment
[16:44:52] erichmenge: That's definitely a downgrade bro.
[16:45:00] tubbo: ACTION looks in his phone at the dates with 3 different women and shrugs.
[16:45:06] lethjakman: tubbo: you look a lot like one of my friends.
[16:45:25] tubbo: lethjakman: does your friend live in philadelphia? because i might be him :D
[16:45:33] lethjakman: lol no. that'd be weird though.
[16:45:50] lethjakman: but you can be my friend anyways.
[16:47:26] tubbo: here's an old pic of me with the beard, lethjakman http://www.topito.com/wp-content/uploads/2013/01/code-08.gif
[16:47:53] lethjakman: thanks tubbo
[16:47:57] lethjakman: I needed that
[16:48:02] lethjakman: that's going in my sexy fat man portfolio
[16:48:10] AntelopeSalad: that guy can clearly program
[16:48:13] Fidelix: tubbo++ thanks for the help man.
[16:51:55] dcope: Why are AR selects all over the place in terms of time to complete? http://pastie.org/private/cgyo5upqmz9fom8phauqa
[16:52:09] dcope: sometimes it takes 100ms, other times it takes 1200ms... what gives?
[16:52:35] AntelopeSalad: dcope: where is your production server hosted from?
[16:53:08] tubbo: dcope: yeah is the db local?
[16:53:09] lethjakman: dcope: varying load?
[16:53:33] AntelopeSalad: line 1 says production env. so i thought maybe he was loading up a console on his server
[16:53:48] dcope: tubbo: nope, remote
[16:54:06] dcope: my web app has times where everything is slowed down and scoutapp claims that AR is to blame
[16:54:10] AntelopeSalad: i notice on my micro ec2 instance i get wildly different response times, even if requests are seconds apart
[16:54:35] _spiderman: How would I approach a master/detail view in rails?
[16:54:49] _spiderman: "click on this post, load this content onto right side"?
[16:54:50] dcope: It's so weird... my web app runs fine for days and then all the sudden there's a ton of slowness out of nowhere. and it's not load.. load is the same.
[16:54:56] _spiderman: Would I be using links that load a partial?
[16:55:11] _spiderman: dcope: memory leak?
[16:55:14] lethjakman: interesting. I bet it's blaming AR because of the load time from the database. I bet this is actually something going on with your DB server.
[16:55:20] dcope: _spiderman: nope
[16:55:28] helpa: davidcelis
[16:55:30] AntelopeSalad: so what host do you actually use dcope?
[16:55:35] dcope: lethjakman: i restarted postgres
[16:55:53] dcope: AntelopeSalad: right everything is on linode. a couple app servers, 1 balancer and 1 db server.
[16:55:53] AntelopeSalad: because noisy neighbords are a big problem with a lot of cloud providers
[16:55:58] lethjakman: dcope: do you get similar response times when querying through psql?
[16:56:11] dcope: lethjakman: hm i haven't tried that yet. i will though.
[16:56:23] lethjakman: where are you hosting?
[16:56:52] dcope: lethjakman: linode
[16:57:14] jstrong: can you define inner classes with ruby through class eval? I seem to be having trouble doing so
[16:57:26] momomomomo: bobbobbins: where's the error
[16:57:27] AntelopeSalad: dcope: which plan do you use?
[16:58:00] lethjakman: dcope: that could just be shared hosting too. I believe those response times are on the response from the db server not AR. are you using sidekiq or anything similar that could be taking a lot of your DB pool?
[17:00:28] dcope: lethjakman: i'm using delayed_job but i dont believe any jobs have been queued up this morning.
[17:00:38] bobbobbins: momomomomo: updated with the error
[17:00:59] dcope: so psql seems to be moving pretty quickly but i can't figure out how to time requests
[17:01:24] momomomomo: bobbobbins: This is in the annotations controller, why are you requiring the 'quote' param
[17:01:49] momomomomo: bobbobbins: Spend some time reading the links I pasted you earlier
[17:01:50] momomomomo: https://github.com/rails/strong_parameters
[17:01:51] bobbobbins: because quote should always be passed from the json
[17:02:00] momomomomo: http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html
[17:02:04] lethjakman: dcope: I think EXPLAIN ANALYZE works.
[17:02:28] bobbobbins: well I'm a bit confused, because it doesn't seem like you have to use strong parameters, so I'm just adding an extra layer to something that already isn't working without it
[17:03:05] momomomomo: best of luck bobbobbins
[17:04:08] dcope: lethjakman: yeah that does, think im seeing increased times because of everything its doing though
[17:05:04] dcope: the only thing that i can imagine is something going on at linode.
[17:05:14] dcope: because this has happened twice over about 1 month now
[17:05:27] dcope: and it's not like it happens right after a deploy... it will randomly happen then resolve itself
[17:08:37] davidcelis: tubbo: (???_???)
[17:10:33] j0llyr0tten: i have a general question. i have about 350 thumbnails, so my page takes about 18 seconds to load, how can i speed this up?
[17:10:41] j0llyr0tten: page in question is: http://leto.electropoiesis.org:3301/items/slice?aspect=group_chronologically
[17:11:07] rushed: j0llyr0tten: sprite common thumbnails?
[17:11:17] jragon: How can I store 00978 as an int? It comes up as 978 rather than 00978
[17:11:43] j0llyr0tten: i tried using ImageMagick to stick all the thumbnails together and i got a 17MB gif file :/
[17:11:52] FallLine: jragon: huh?
[17:12:00] j0llyr0tten: rushed: what's a sprite common thumbnail?
[17:13:01] FallLine: jragon: int stores as int, not a string.... what I presume you probably want to do is left pad that field with X zeros
[17:13:27] j0llyr0tten: is there a way to progressively load images? should i break the page into pieces? should i ...?
[17:13:31] FallLine: i.e., presuming all such fields should come out the same
[17:13:51] FallLine: jollyr0tten, where or how are you loading your images from?
[17:13:57] rushed: j0llyr0tten: spiriting is how you deal with too many individual image loads on a single page
[17:14:53] j0llyr0tten: rushed: like i said, i got a 17MB gif file when i appended them all together, so that's not gonna work
[17:15:02] Zendist: Hey everyone
[17:15:09] Zendist: I love you. That is all.
[17:15:22] rushed: j0llyr0tten: don't be silly
[17:15:39] rushed: j0llyr0tten: "I tried one thing so that must be the only possible result"
[17:16:03] jragon: FallLine: each field is 5 chars long. So if there aren't enough it could be spaced with 0. But what if the user accidentally puts in 3 would it instantly become 00003 rather than validate the error
[17:16:38] rushed: j0llyr0tten: also, before you do anything make sure you use a good page speed analysis plugin and measure where the problems actually are and focus there :)
[17:16:52] FallLine: jragon: well you can validate the input as an int or as a string
[17:17:26] jragon: FallLine: Just tried 05555 and it says that the input is too short. So would I validate it as a string and then do a before save?
[17:17:30] FallLine: but if you want to store it natively in that format you could just store it as a string and use a bit more space (probably not an issue for you)
[17:17:35] GeekOnCoffee: j0llyr0tten: why do you have 350 thumbnails on one page?
[17:17:49] jragon: FallLine: that sounds easier
[17:18:01] ddd: ACTION wishes he could zipline home from school. Would be infinitely more fun than driving the icy curvy roads
[17:18:19] FallLine: you can add a validating to validate it as a regex, I'm pretty sure
[17:19:22] j0llyr0tten: GeekOnCoffee: these are all thumbnails of scans in an archive
[17:19:30] jragon: What would I do for the alter table? Last time I changed a column type postgres through an error, but it worked fine in sqlite
[17:19:35] j0llyr0tten: GeekOnCoffee: the archive is comprised of items
[17:19:46] j0llyr0tten: GeekOnCoffee: each item has one or more scans
[17:19:52] FallLine: something like '^\d{5}$'
[17:20:09] j0llyr0tten: GeekOnCoffee: i show the first scan for an item to give a flavour of the item
[17:20:19] j0llyr0tten: GeekOnCoffee: and that's just how many there are
[17:20:41] GeekOnCoffee: j0llyr0tten: I've seen sites that don't try and load images until they come into the viewport
[17:21:02] jragon: the error was omething about type casting
[17:22:04] j0llyr0tten: GeekOnCoffee: that'd be an idea, how could that be done do you reckon?
[17:22:26] j0llyr0tten: GeekOnCoffee: you make me want to have coffeee
[17:22:39] adtaylor: Hi. Can someone point me in the right direction of how I can add a dynamic attribute to a model? I have a Post model with a haml attribute set; I'd like to convert that to html and provide that as well when I send out the json.
[17:22:40] GeekOnCoffee: maybe look at something like that
[17:23:15] FallLine: jragon: umm
[17:23:24] FallLine: just use alter table...
[17:23:30] GeekOnCoffee: j0llyr0tten: you could probably do something with http://plugins.jquery.com/appear/
[17:23:42] GeekOnCoffee: j0llyr0tten: http://www.appelsiini.net/projects/lazyload
[17:23:54] alex88: can someone explain me this? http://i.imgur.com/9vAWrfM.png it means that 78% of the request is inside the spawn_thread function of puma?
[17:24:42] jragon: FallLine: okay
[17:25:00] FallLine: you can use the USING method in postgres to automatically cast and validate it
[17:25:09] jragon: FallLine: I think the error was because I was changing a string to an int which caused some casting errors
[17:26:47] FallLine: it'd be soothing like: ALTER TABLE yourTbl ALTER COLUMN yourCol SET DATA TYPE varchar USING lpad(yourCol::varchar,5,'0')
[17:27:28] FallLine: then, if you want, you can add a check constraint on the column to ensure it fits that
[17:28:49] _spiderman: How would someone go about implementing master/detail view in rails?
[17:31:28] crankharder: _spiderman: say more words
[17:31:59] _spiderman: I have a link, when it is clicked, it will render a partial on the same page instead of trying to render a view.
[17:32:41] _spiderman: It keeps trying to navigate to the URL which makes sense, but not what I want
[17:33:11] helpa: _spiderman: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[17:33:11] crankharder: _spiderman: !gist
[17:33:39] ddd: hey its a crankharder !
[17:34:00] crankharder: do i know you? ;)
[17:34:21] ddd: idk, I'm the bougyman. No one knows me
[17:34:35] FallLine: jragon: ALTER TABLE yourTbl ADD CONSTRAINT validNum CHECK ( yourCol SIMILAR TO '\d{5}')
[17:34:46] lethjakman: is rb-readline slower?
[17:34:49] _spiderman: crankharder: https://gist.github.com/anonymous/7931997
[17:34:56] FallLine: assuming you want the DB to enforce that :P
[17:35:02] lethjakman: apparently my ruby on my server compiled without readline and I'm not sure if I should recompile ruby or not
[17:35:06] _spiderman: Those lines generate the link
[17:35:07] ddd: readlne is slower yes, but more compatable
[17:35:20] jragon: FallLine: I just migrated on PG with the column_type and it worked fine :) Thanks
[17:35:24] ddd: compatible? compatable?
[17:35:24] _spiderman: I'm not even sure of the terminology but I want that link to render content on the same page
[17:35:50] FallLine: jragon: did you tell it to left pad the string?
[17:36:02] FallLine: because if not, it most certainly would not
[17:36:07] crankharder: _spiderman: i see that those lines generate the link... do you think there may be other parts of your app I'd be interested in seeing?
[17:36:23] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[17:36:48] jragon: FallLine: There's no data in the db
[17:37:10] _spiderman: crankharder: Oh right! Thanks! https://gist.github.com/anonymous/7932050
[17:37:24] _spiderman: crankharder: Notably, the show action. Which is what the link currently directs to
[17:37:26] FallLine: something to consider if you're pushing that migration change to a production that already has data though :P
[17:37:31] _spiderman: I've tried some hacky ways to make master/detail work
[17:37:56] _spiderman: Like populating a variable in the show action, and checking for the presence of the variable in the view(which then renders it)
[17:38:09] _spiderman: Sounds extremely hacky which is why I am asking here
[17:40:14] rushed: _spiderman: you might find a high level overview helpful http://railsforzombies.org
[17:41:48] _spiderman: rushed: Thank you for the suggestion but I do not think rails for zombies will help me here
[17:42:21] crankharder: _spiderman: you're missing a handful of things. if you want a link to ultimately add some markup to the existing page, you'll need to look into jquery_ujs
[17:42:33] crankharder: your link needs 'remote:true' added to it
[17:42:39] crankharder: your controller needs to render json
[17:42:51] crankharder: and you need to add an 'ajax:success' event handler to the link
[17:43:05] _spiderman: crankharder: Oh. Javascript, we meet again.
[17:43:33] _spiderman: Thanks crankharder, I'll look into ujs
[17:52:26] EminenceHC: How would I sort @var.sort_by(&:date) in decending order?
[17:55:03] crankharder: what's wrong with reverse?
[17:56:51] momomomomo: EminenceHC: is @var from a query? you could just do that in the db
[17:57:08] momomomomo: otherwise, EminenceHC http://www.ruby-doc.org/core-2.0.0/Array.html#method-i-sort
[17:57:47] youl: I use Single Table Inheritance, say "User" and "SubUser < User"
[17:57:52] EminenceHC: momomomomo: It is not, but I just did it with: @var.sort_by(&:date).reverse
[17:58:09] youl: is there a way to make a User.all without retrieving the SubUsers ?
[17:58:23] momomomomo: y u sort twice in one line? :/
[17:58:29] youl: like User.just_them.all
[17:58:38] EminenceHC: momomomomo: me?
[17:58:45] momomomomo: or actually, I'm sure that's not how reverse works
[17:58:58] crankharder: youl: maybe User.where(type: 'User') -- but STI is the worst. you should just not use it.
[17:59:23] youl: @crankharder why ?
[18:00:00] youl: @crankharder I made a scope who works like this, nothing better for doing that
[18:06:10] ddd: hrmm. can someone explain this difference? In spec/models/shelter_spec.rb I have (outside of a context) expect(subject).to be_a_new Shelter #this format is from Rails::RSpec
[18:07:10] ddd: I changed that to expect(subject).to be_an_instance_of Shelter # this format is from RSpec::Matchers and it works
[18:08:34] ddd: the first does not. Its part of the global as in not confined to a context. I get this: https://gist.github.com/ddd/7932559 when I use the be_a_new
[18:08:41] ddd: sorry took a minute to generate the gist
[18:09:40] ddd: I'm fine with using the be_an_instance_of over be_a_new I'm just wondering what the actual difference is since as you can see from the output the Shelter object is the same as the subject object. It seems a difference in output format of that object (and thus changing the comparison
[18:10:18] ddd: anyone see what I'm missing, and thus not understanding wrt the difference?
[18:11:44] ddd: I'm trying to refactor the model test such that I have a single global test, and 2 contexts. persisted and instantiated contexts. the features tests will test the models via integration. All I care about is that they are actually instances and whether they can be persisted or not.
[18:12:59] ddd: this is the shelter_spec.rb here: https://gist.github.com/7932618
[18:17:21] CorySimmons: Anyone familiar with ActiveAdmin have a moment to offer some advice? I have a model (Proposal) that has some db columns. I'm listing the ones I want in ActiveAdmin but I'd like to push the "archived" ones (a db column) to the bottom of the list, or to a separate panel, but I'm having trouble figuring out how to do this in ActiveAdmin. Any advice?
[18:18:12] ddd: grr reload that gist https://gist.github.com/ddd/7932618 I goofed the addition of the output and the related line in the spec. fixed
[18:18:54] Spami: Hey guys anyone has some feedback about the gem Figaro ?
[18:20:23] lethjakm1: would there be any bad effects from setting RAILS_ENV=staging and just creating a new DB connection to a staging server?
[18:21:00] ddd: no, you would then just have to manually set RAILS_ENV='staging' rspec spec/features etc
[18:21:15] ddd: just would have to make sure you set the RAILS_ENV= at the cmd line
[18:21:30] ddd: so long as you have the db defined in config/database.yml it should be fine
[18:21:52] jds: Is there a sane way of having an HTTP-cachable page that can be logged into, short of having different urls for logged in users?
[18:21:54] ddd: the rspec spec/features was just an example command
[18:22:03] jds: I'm currently sending Must-Revalidate
[18:22:36] ddd: lethjakm1, also be sure that anything you need in staging for way of gems is also set in the group :staging do ... end in Gemfile
[18:22:53] ddd: like anything you need from :development or :test for example
[18:22:54] lethjakm1: ddd: sounds good. thanks!
[18:23:33] ddd: ok, back to specs I go &
[18:23:46] EminenceHC: With devise, is there a way to let a user change their password automatically on first login?
[18:36:41] platzhirsch: How would I test a shared view component? Render it in the test and run expects on its components?
[18:50:51] helpa: platzhirsch: Your question has just been deemed vague; please consider rewording it. It may also help to give us any relevant code or errors so that we may better assist you.
[18:50:51] tubbo: platzhirsch: !vague
[18:51:08] platzhirsch: oh no... *cry*
[18:51:18] platzhirsch: it's alright, I figured it out
[18:51:53] CorySimmons: Can anyone help with ActiveAdmin? I'm trying to scope some results by default http://pastie.org/private/0jwrqdewyylqafavkunqya but first, the url I think it's going to scope to, doesn't scope (although the results are correct) notice the button isn't indented: http://i.imgur.com/mgqlz1Y.png If I click on the button, and go to the scoped URL, it becomes indented and the results are accurate: http://i.imgur.com/INABOLw.png And worst
[18:52:26] CorySimmons: If I remove the default scope stuff the archived button returns it's 2 results.
[18:54:26] nobitanobi: Hi. I want to test some code that I have under /lib. I have placed this file https://gist.github.com/novito/7933394 in /test/lib/image_manipulation_test.rb but it seems to not be taking it into account when running rake
[18:54:27] helpa: CorySimmons: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[18:54:27] tubbo: CorySimmons: !gist your admin dashboard.
[18:54:39] tubbo: CorySimmons: that's the app/admin/* file that controls this page
[18:54:57] hendricius: i have been using rails for a few years now. but i have an issue. i use SQL everywhere in my controllers or views directly. can you help me find the issue in this code? https://gist.github.com/9119fed6eeac6096e088
[18:55:35] rhizome: nobitanobi: /lib is not autoloaded anymore
[18:55:43] bricker: hendricius: lol
[18:55:48] CorySimmons: tubbo: Correct
[18:55:54] planetexpress: Advice question: if I'm running a posts feature with master detail, should I build only in Rails or should I use Ember.js for the posts feature and keep everything else on Rails?
[18:56:07] rhizome: what is "master detail"?
[18:56:08] nobitanobi: rhizome, you mean the tests under /test/lib ?
[18:56:18] rhizome: nobitanobi: nope, i mean Rails.root/lib
[18:56:23] tubbo: CorySimmons: does not post code, will not help :P
[18:56:35] tubbo: CorySimmons: POST YOUR CODE
[18:57:00] planetexpress: rhizome: master detail in the sense that I click on post and it expands on the same page to more details about the post: ie. content, time of post, user, etc.
[18:57:16] CorySimmons: tubbo: I did post code.. :[
[18:57:33] rhizome: what do you mean, "expands"? or really, "post" for that matter.
[18:57:34] tubbo: CorySimmons: lawl i am a dummy
[18:57:41] CorySimmons: http://pastie.org/private/0jwrqdewyylqafavkunqya ;)
[18:57:49] hendricius: sorry, here is the code: https://gist.github.com/hendricius/9119fed6eeac6096e088. can you tell me what is wrong??? plsss. dont tell me this is bad manners. kkthxbye
[18:58:01] planetexpress: rhizome: really post
[18:58:04] tubbo: chrisan: hmm....when you visit the page, what does the SQL query look like?
[18:58:04] hendricius: bricker: https://gist.github.com/hendricius/9119fed6eeac6096e088
[18:58:11] tubbo: blah sorry chrisan
[18:58:14] CorySimmons: tubbo: This guy seems like he's experienced the same problem: http://blog.codingspree.net/2011/06/18/scoping_resources_in_activeadmin.html
[18:58:19] tubbo: CorySimmons: hmm....when you visit the page, what does the SQL query look like?
[18:58:34] CorySimmons: It fetches all
[18:58:40] tubbo: CorySimmons: do you have a default_scope?
[18:58:42] CorySimmons: When I go to localhost:3000/admin
[18:58:57] tubbo: CorySimmons: ok, so on this page, you're not seeing the scope actually being applied?
[18:59:02] CorySimmons: tubbo: Yeah I tried adding it, but I think I need to do some funky scope_to: stuff in my admin/proposal.rb
[18:59:19] bricker: hendricius: oi, dude, sorry but you're going to have a hard time finding someone to help you debug huge SQL queries in a Rails channel.
[18:59:24] CorySimmons: tubbo: Right, on localhost:3000/admin it's not applying a default scope. If I navigate to either of the scopes, it displays them.
[18:59:27] tubbo: CorySimmons: that article talks about a workaround for default_scope. is that what you're using?
[18:59:38] bricker: hendricius: maybe try #mysql, and describe the specific problem you're having
[18:59:39] rhizome: planetexpress: at the end of the day, it doesn't matter what you choose. you can change it later.
[18:59:41] CorySimmons: Yeah pretty much the same problem
[18:59:56] CorySimmons: tubbo: "Cool! But now all those ???deleted??? posts are hidden for admins too. Not cool???"
[19:00:02] planetexpress: rhizome: so basically if I create a post I should be able to clikc on it from a list and the content and time of post, etc. would load in the same page
[19:00:12] tubbo: CorySimmons: ah okay. dunno what to tell you, imho your problem is that you're *using* default_scope. unfortunately it's one of those things that you really need to know what you're doing first before using it.
[19:00:14] CorySimmons: Pretty much exactly my problem. I just can't seem to get the solution working.
[19:00:18] helpa: CorySimmons: http://www.innovationontherun.com/activerecord-default_scope-is-an-anti-pattern/
[19:00:18] tubbo: CorySimmons: !default_scope is an anti-pattern.
[19:00:31] rhizome: some people like default_scope, some don't
[19:00:34] tubbo: CorySimmons: basically think of it like "mostly_permanent_scope". it stays there unless you call 'unscoped' on it.
[19:00:39] bricker: rhizome: yeah well those people are WRONG!!!
[19:00:43] helpa: (ノಠ益ಠ)ノ彡┻━┻
[19:00:44] tubbo: rhizome: but it *is* an antipattern. it is *not* a "default" scope.
[19:00:46] rhizome: KILL THE WRONG PEOPLE
[19:00:53] CorySimmons: I think my problem is I'm using ActiveAdmin in the first place.
[19:01:05] bricker: that's always the problem
[19:01:08] bricker: that and Devise
[19:01:09] rhizome: a poor craftsman blames his tools
[19:01:14] tubbo: CorySimmons: nah, activeadmin is okay as long as you're just using it internally. otherwise, you might want to just make your own admin interface
[19:01:26] tubbo: rhizome: i don't use default_scope, so it's not MY tools. i blame your tools. :)
[19:01:29] hendricius: bricker: :D sry was just trolling
[19:01:38] bricker: hendricius: no shit :)
[19:01:48] tubbo: CorySimmons: so default_scope is applied when you try to get a collection of the model. it's the "starter" scope. to get around that, you have to call unscoped
[19:01:48] hendricius: bricker: i saw that code in a clients application and felt mentally raped
[19:02:03] bricker: hendricius: It's not your fault. *hugs hendricius*
[19:02:20] tubbo: CorySimmons: it is not useful as a "default" scope because that implies it's possible to override. not the case. you have to check whether the scope(s) you're applying to the query will override the default scope, and call unscoped if so. but you have to know that BEFORE you start using the scopes
[19:02:29] aarkerio: Hi!! how can I know what hashing method my app is using to encrypt passwords? I mean if is Digest::SHA1.hexdigest or Digest::MD5.hexdigest ??
[19:02:29] tubbo: so if you never have that problem it's not a huge deal
[19:02:49] tubbo: but imho you're intentionally crippling your software and destroying developer understanding by using it
[19:02:51] tubbo: just my two cents :P
[19:02:53] CorySimmons: tubbo: Ok thank you.
[19:03:00] CorySimmons: I don't know what else to do tbh
[19:03:01] bricker: aarkerio: using has_secure_password?
[19:03:08] tubbo: CorySimmons: what is the default_scope doing?
[19:03:09] CorySimmons: Seems like the ActiveAdmin convention for this kind of functionality :(
[19:03:19] CorySimmons: It's just showing -only- the proposals that are Active
[19:03:27] tubbo: CorySimmons: did you try what the blog post told you to do?
[19:03:29] CorySimmons: And the Archived Proposals go on another scope
[19:03:32] lethjakman: hrm in my nginx passenger there's no init.d...is there an easy way to restart it? I'm trying to point it at my app at this point.
[19:03:42] CorySimmons: Yeah trying it, but I'm kinda of a newb so I'm having a hard time getting it to work
[19:03:53] bricker: lethjakman: you want to restart nginx?
[19:03:58] lethjakman: bricker: yeah.
[19:04:05] bricker: lethjakman: /etc/init.d/nginx or service nginx
[19:04:09] bricker: depending on your platform
[19:04:15] lethjakman: bricker: doesn't exist.
[19:04:26] CorySimmons: tubbo: Here's how I'm trying to implement it: http://pastie.org/private/azjpugv9zqo4qlgdg0dna
[19:04:39] bricker: lethjakman: How did you start nginx in the first place?
[19:04:43] aarkerio: well, the hashing is handled by devise
[19:04:46] lethjakman: bricker: just installed it and it started.
[19:05:14] lethjakman: there's an sbin directory, but it just has the executable in it
[19:05:36] lethjakman: actually wait. I used the gem to install it
[19:06:14] tubbo: CorySimmons: my advice to you is to not use the default_scope. just rename the scope to :unarchived and apply it when you need it.
[19:06:28] tubbo: CorySimmons: you only want default_scope if you absolutely NEVER want to return records that don't match teh query..
[19:07:18] CorySimmons: Why would you even have those records appear anywhere then?
[19:07:50] CorySimmons: I just already know my senior dev is going to say "Why do I have to click on 'Active Proposals'? Shouldn't this be the default?"
[19:08:04] tubbo: CorySimmons: in the case of complicated data structures...let's say i have an 'accounts' table with about 100 columns. but i want to make a 'pending_account' table that only needs a small subset of that data, which is when is_pending = 't' on the account row.
[19:08:48] tubbo: CorySimmons: perhaps if you find active_admin is getting too hard to deal with, i feel like you should just write your own. you'll have more control. basically, if you have to ship this product to ANYONE other than you, somebody's going to have a feature request that you won't be able to fix because that's just not how AA does things.
[19:08:54] tubbo: s/fix/fulfill
[19:09:20] CorySimmons: tubbo: I completely agree and thoroughly hate ActiveAdmin ;)
[19:09:41] tubbo: it's useful for building a quick admin interface.
[19:09:45] tubbo: i've used it in the past
[19:09:48] CorySimmons: I actually was the one who suggested trying it out, but now that I'm using it I realize how complicated and constraining it can be.
[19:10:09] CorySimmons: Yeah, I have to get into doing some crazy stuff with slides and such as well soon??? yay.
[19:10:17] Fidelix: CorySimmons: what do you use instead?
[19:11:05] Fidelix: CorySimmons: good to know. Don't you even use a template or something?
[19:11:25] CorySimmons: Although I'd be interested to know if there is anything else out there that is less constraining and doesn't depend on it's own weirdo dsl
[19:11:37] CorySimmons: I'm new to Rails so I don't have templates for stuff like that
[19:11:50] lethjakman: bricker`LA: interestng. I figured it out if you're interested. apparently you just use the executable in /opt/nginx/sbin and just execute it to start it then use -s to perform actions on it
[19:11:53] CorySimmons: But it takes me about 10 minutes to do the markup and styling for an admin panel
[19:14:09] diegoviola: i'm trying to write capybara/rspec tests for this code: https://gist.github.com/diegoviola/7933340 -- however, how i'm supposed to do this when ProjectStepsController#update is expecting session[:project_id] to exist, and that session variable is being set in another controller: ProjectsController#create. If I go to /project_steps/summary I'm getting "Couldn't find Project without an ID" which is obvious
[19:14:12] diegoviola: since there is no session variable, any ideas please?
[19:15:02] christo_m: What do people here recommend for Cloud hosting? I've pretty much heard that the best right now is Digital Ocean
[19:15:10] christo_m: at least price and performance wise against things like AWS and Heorku
[19:16:13] tubbo: hah that's interesting
[19:16:25] tubbo: after_save :method_name => method_name doesn't exist, rails 2.3 does nothing? :D
[19:16:28] tubbo: oh wait i never saved it :P
[19:20:00] tubbo: christo_m: what are you trying to do?
[19:20:06] tubbo: christo_m: they're all good for different stuff.
[19:20:21] christo_m: well i know heroku to be veyr expensive
[19:21:10] tubbo: christo_m: not if you use the free tier.
[19:21:20] christo_m: which is what im using right now, until i validate my idea
[19:21:22] tubbo: i use heroku b/c it's the cheapest way to run an app that doesn't need to be super fast 100% of the day
[19:21:32] tubbo: but you have to deal with its shit sometimes
[19:21:40] ddd: hehe my hubot is on a heroku deployment. i test on travis and deploy demos on heroku., works great
[19:21:52] AntelopeSalad: what happens if you go over your limit on heroku's free tier? do they just shut you off?
[19:22:03] christo_m: tubbo: well, so thats the disadvantage i see to something like digital ocean, you have to set stuff up yourself, but there is a tool called Dokku you can use which is basically a mini heroku-type platform
[19:22:04] Spami: soahccc, sometime rails won't read the env, any idea why this could happen ?
[19:22:36] ddd: either get a digital ocean account for prod, your own server(s), or use AWS. and aws is more expensive depending on traffic than heroku is so take your pick on the financial damage (even though heroku uses aws on their backend)
[19:22:54] christo_m: ddd:digital ocean actually gives better performance than AWS, for cehaper
[19:23:03] ddd: christo_m, i agree
[19:23:05] christo_m: at least according to the data ive seen
[19:23:23] diegoviola: any ideas please?
[19:23:27] christo_m: i'm just curious what people use, its clear for rail devs that heroku is go-to for how quick it is
[19:23:35] ddd: and no, not just because of the touted SSDs either though that helps for pulling initially from the fs
[19:23:48] AntelopeSalad: i am using ec2 atm only because i'm using the free tier (first year is free)
[19:23:58] christo_m: but then i hear bad things like Rap Genius talking about heroku switching from intelligent routing to random routing, and im like, do i really want to pay more for a shittier experience?
[19:23:59] ddd: my 1y free just ended
[19:24:13] ddd: though i'm sure i could create an additional account and get another year, but thats cheating
[19:24:31] AntelopeSalad: i'm not overly happy with the performance of the free one but it's fine for a low traffic site imo
[19:24:32] christo_m: actually not only did they switch the routing scheme, they didnt tell anyone nor update the docs
[19:24:48] ddd: investigate it yourself
[19:25:00] christo_m: i think for prod, if my idea gets some signups, i will go to digital ocean
[19:25:09] ddd: seriously, for someone as large and as well known as heroku, it behooves you to give a benefit towards doubt of negatives.
[19:25:32] AntelopeSalad: heroku scares me because once you start wanting somewhat standard features the cost sky rockets to out of control
[19:25:38] ddd: not saying its not true, saying you should err on the side of doubting the negative and see for yourself
[19:25:39] christo_m: AntelopeSalad:exactly what im saying
[19:25:54] ddd: now that is a proven. and its a valid complaint
[19:25:56] christo_m: you start adding some packages and then its like 100 bucks a month to run a rails production app with a database and SSL
[19:26:00] ddd: i think they've overpriced themselves.
[19:26:07] ddd: but that is me personally
[19:26:09] AntelopeSalad: yeah christo_m, that's what i found too
[19:26:24] christo_m: ddd:the rapgenius complain is valid also, i mean they had heroku issue an apology
[19:26:29] AntelopeSalad: and even that $100/month is very little computing power, it's an accumulation of a bunch of 15-20/month add-ons that are essential
[19:26:51] ddd: their pricing structure kills the little guy. like they're strictly targeting the big companies, and using the smaller guys as their guinea pigs
[19:26:55] ddd: which i don't like
[19:27:12] christo_m: so thus, being a startup, the obvious choice is probably not heroku
[19:27:31] christo_m: im trying to minimize costs here, if i have to tinker with a server and some configs to save myself a few thousand a year, ill do it.
[19:27:46] lethjakman: christo_m: what have you chosen?
[19:27:55] mdpatrick: I run passenger-install-apache2-module... it indicates that it succeeds... however, nowhere does it actually create the mod_passenger.so file
[19:27:56] ddd: which is why i have such an issue with RedHat. I don't agree with what they did with libc, gcc, and reason they created fedora project. Having worked for Red Hat personally, I've other reasons as well. but i'll keep those to myself
[19:28:13] ddd: christo_m, try DigitalOcean for a bit. see if its a fit
[19:28:16] ddd: worth a try at least
[19:28:31] lethjakman: I've heard very good things about digital ocean
[19:28:40] AntelopeSalad: having the ability to auto-scale on demand seems good but i don't know if you would need that until you're a smashing success
[19:28:59] ddd: i use them. however, one big thing to note is none of my stuff on them has high traffic volumes.
[19:29:11] lethjakman: AntelopeSalad: it's incase you're a smashing success
[19:29:20] ddd: exactly
[19:29:22] lethjakman: plan for the worst and hope for the best :)
[19:29:31] AntelopeSalad: lethjakman: yeah but how many things really go from nothing to super popular instantly?
[19:29:46] AntelopeSalad: even services like twitter took years of being unknown before they got big
[19:29:47] ddd: always a good way to go. if planning for the worst ahead of time, easier to manage if it actually goes that route
[19:30:03] ddd: awesome results when it goes the other way to smashing success
[19:30:04] lethjakman: AntelopeSalad: it doesn't have to be instantly. do you know how easy it is to scale this way verses buying new servers configuring them changing them.
[19:30:14] lethjakman: the convenience of "click stop" "clicke upgrade" "click start" is unbelievable
[19:30:29] lethjakman: I personally am setting up in EC2 and it has a LOT of nice features
[19:30:34] AntelopeSalad: lethjakman: i've provisioned a few servers before, with automated tooling it's not too bad
[19:30:57] AntelopeSalad: i feel like if you were to buy a few $20-30/month DO droplets that would get you a very very very long ways
[19:31:02] lethjakman: it's not horrible, but it's still not as convenient as ec2 is. especially with something like rubber (which I unfortionately couldn't get working.)
[19:31:17] ddd: thats how i looked at it (with DO)
[19:31:43] ddd: once large enough to *really* have to decide how to properly scale for YOUR app's needs and YOUR clientel, then worry about it
[19:31:47] ddd: Digital Ocean
[19:32:15] AntelopeSalad: for $20/month you get 2 gigs of ram, 2 cores and a 40gb ssd
[19:32:31] lethjakman: yeah I agree they probably will go a ways.
[19:32:43] BrazenBraden: holy crap what an effort!!!
[19:33:00] tubbo: christo_m: i would suggest learning Chef or Puppet, as well as Vagrant, when getting started on AWS and DO. they make your life a whole lot easier.
[19:33:01] j0llyr0tten: what's the difference between node and bower? what are the different use cases? they seem to overlap ...
[19:33:02] AntelopeSalad: really depends on the app tho tbh
[19:33:11] j0llyr0tten: i mean, between npm and bower
[19:33:17] christo_m: tubbo: yaaa
[19:33:20] ddd: even if you got a couple of the $10 a/m 1GB .. its a good start!
[19:33:37] tubbo: christo_m: although Heroku is phenomenally easier, Chef + AWS/DO is going to be the way you deploy eventually, so you might as well learn it now :P
[19:33:43] tubbo: j0llyr0tten: npm is for node.js, and bower is for the browser.
[19:33:45] AntelopeSalad: VPSs usually kill you on how they choose to scale the hardware
[19:33:45] ddd: get 3, set up load balancing between 2 using the 3rd as the HA
[19:33:46] christo_m: like i said im going to be using dokku
[19:33:50] christo_m: not setting up things manually myself
[19:33:51] tubbo: j0llyr0tten: that is, client-side JS
[19:34:10] AntelopeSalad: for example you might have a lot of data, so you might want 16 gigs of ram, but if you want 16 gigs of ram with DO you have to opt-in for a ton of cpu/HD that you might not need
[19:34:11] ddd: you wouldn't take a steep lag penalty, and you'd have a rudimentary scale
[19:34:20] tubbo: christo_m: i wouldn't consider dokku a great solution for a digital ocean VPS. instead, you should spin up a new droplet for each app server you need, and use Chef to build them.
[19:34:23] ddd: AntelopeSalad, they ALL have downsides
[19:34:27] j0llyr0tten: tubbo: ah, so that's why i used npm to install bower, and then use bower to install jquery plugins
[19:34:30] tubbo: christo_m: dokku is best used at home, for your own development needs.
[19:34:35] j0llyr0tten: tubbo: *hat tip*
[19:34:41] tubbo: j0llyr0tten: bower is written in JS, so yeah. you could've also just looked this up :)
[19:34:45] AntelopeSalad: ddd: yeah, in some cases ec2 might work. i think they have a huge ram instance with low'ish (decent) cpu and a medium amount of hd space
[19:34:48] ddd: they're ALL going to give you more of something you really don't need to get what you really do. Its a facet of the technology AND a facet of busineess
[19:34:50] tubbo: j0llyr0tten: fwiw, you can use NPM in the browser with browserify
[19:34:54] ddd: err business even
[19:35:20] tubbo: busy knees
[19:35:41] tubbo: AntelopeSalad: that's pretty much how VMs work. it's hard to customize unless you build your own on bare metal.
[19:35:58] ddd: there is no reason you can't set up several EC2 instances in an HA web cluster, backended by multiple DO droplets
[19:36:03] ddd: mix and see
[19:36:05] ddd: :shrug:
[19:36:11] AntelopeSalad: DO seems pretty solid tho, i don't work for them but i bet if you had a unique case they would try to set it up for you
[19:36:21] ddd: AntelopeSalad, I KNOW they would
[19:36:26] AntelopeSalad: i've talked with their tech support a few times, they are really nice people
[19:36:32] ddd: i don't work for them either, however, i do know many members of DO's team
[19:36:39] j0llyr0tten: tubbo: now you're confusing me :(
[19:36:58] BrazenBraden: if in my migration i have a t.date field.. and i want to use simple_form but also jquery datepicker (which works on a as: :string field), how do i get my model to accept that?
[19:37:00] tubbo: j0llyr0tten: don't shoot the messenger, man. i didn't make this shit. :P
[19:37:09] tubbo: j0llyr0tten: http://browserify.org/
[19:37:22] ddd: i know them from irc and outside-of-their-work so i know the quality of their personal fibre. i'd wager my entire military disability they'd gladly work with you when/should you need expansion
[19:37:57] tubbo: BrazenBraden: parse the param in your controller to the format that the date/datetime field expects.
[19:38:08] j0llyr0tten: tubbo: 'k dude, i had a quick peep but i'll stick with bower for now ^^
[19:38:16] tubbo: BrazenBraden: that is, of course, the main purpose of controllers...parsing params and connecting your model with your view template
[19:38:25] ddd: anyways, time to grab some more coffee and then back to writing test specs
[19:38:33] tubbo: j0llyr0tten: please do. :) bower is a much better tool.
[19:38:47] tubbo: j0llyr0tten: also, please help me make it better for rails :) https://github.com/tubbo/bowery
[19:38:57] AntelopeSalad: tubbo: do you have an opinion on engines?
[19:39:00] j0llyr0tten: tubbo: i'll try
[19:39:08] tubbo: AntelopeSalad: they're certainly better than horse-drawn carriages!
[19:39:18] ddd: check out EngineX for starters
[19:39:20] ddd: go from there
[19:39:34] AntelopeSalad: i'm trying to determine if the juice is worth the squeeze
[19:39:48] tubbo: AntelopeSalad: what are you trying to do?
[19:39:54] tubbo: engines are a great solution to a number of problems
[19:40:01] tubbo: but nothing is good for everything
[19:40:12] AntelopeSalad: well, i'm noticing my app is absolutely 4 distinct mini-apps, it seems like a good candidate to engine'ize them
[19:40:12] ddd: https://www.ruby-toolbox.com/projects/enginex
[19:40:29] BrazenBraden: who wants a lol?
[19:40:30] christo_m: wait whats wrong with dokku?
[19:40:37] christo_m: i shouldnt use dokku for production?
[19:40:57] AntelopeSalad: i'm not sure if it's worth making them an engine tho, or if i should try to make them stand alone api servers that get consumed by a parent app
[19:41:38] BrazenBraden: im offering a free ROFLMAO experience here
[19:41:43] CorySimmons: Anyone have any tasks laying around that will generate a bunch of dummy database content?
[19:41:52] mechanicalfish: BrazenBraden: I could use that
[19:41:58] stringoO: how do i write a route for all actions of just one controller?
[19:41:59] AntelopeSalad: CorySimmons: check the Faker gem
[19:41:59] cored: which is the common notation to rename fields with migration, rails genrate migration FieldNameToOtherNameInTableName ?
[19:42:04] stringoO: I've tried -> match 'post_data/:action', controller: "post_data" ,via: :all
[19:42:13] cored: stringoO: why do you want to do that?
[19:42:40] benlieb: I'm porting an old rails 2.1.1 app to rails 4. It relies on several plugins that have no gem equivalents. How would I get these working in rails 4?
[19:42:47] BrazenBraden: on another channel.. this guy thinks (in all honesty) that he has made an amazing website for himself...
[19:42:48] BrazenBraden: http://govindtiwari.blogspot.com/
[19:43:01] stringoO: cored: I'm defining some custom actions, and trying to get to these actions
[19:43:15] cored: benlieb: I suggest you to first try to get your app working on Rails 3
[19:43:44] cored: stringoO: as far as I know you will have to define each route one by one, I don't know anything as :all
[19:43:46] CorySimmons: AntelopeSalad: Yeah but I need to setup all the tasky stuff of creating tables, etc. I was just wondering if any of you had something floating around that I could just run that would magically create a dummy db to play with
[19:43:53] stringoO: I'm trying to do something like get ':controller(/:action(/:id))' but just for one controller
[19:44:07] cored: BrazenBraden: I think that's a joke
[19:44:11] stringoO: the :all is just referring to post, get, etc. (it's in the rails outisde in document)
[19:44:14] benlieb: cored: I appreciate the suggestion. But I still would like to know how to get plugins working in rails 4.
[19:44:30] AntelopeSalad: CorySimmons: creating the table depends on what you want to be in the table
[19:44:39] stringoO: I'm trying to do seciton 3.1 - bound parameters, but just for one controller - http://guides.rubyonrails.org/routing.html
[19:45:12] CorySimmons: AntelopeSalad: Right, but just some big dummy db with a few tables and relations, etc.
[19:45:17] tubbo: AntelopeSalad: personally, i'm a fan of multiple apps and a consistent service API.
[19:45:33] BrazenBraden: cored: i hope so.. with all my heart
[19:45:35] christo_m: tubbo: i heard of people using dokku just fine in production?
[19:45:41] stringoO: this seems to work - get 'post_data/:action', controller: "post_data"
[19:45:48] AntelopeSalad: tubbo: so instead of engines you would just go all out and make them api services with no views?
[19:45:51] CorySimmons: AntelopeSalad: For instance, http://dev.mysql.com/doc/sakila/en/index.html
[19:45:55] Yatekii: how is the call-cycle in rails, is it controller > view > controller > view etc?
[19:46:07] tubbo: AntelopeSalad: yup. 1 app handles the frontend, but most of your app is just interfaced with APIs.
[19:46:36] AntelopeSalad: tubbo: that seems like the architecture that is the holy grail, lately i've been seeing talks/blog posts about just using engines instead but i didn't get their appeal
[19:46:43] tubbo: christo_m: interesting. if you know people who use it in prod and don't have many problems, then yeah go do it and write about it so we can figure it out too! :)
[19:46:49] AntelopeSalad: it seemed like all they did was force you to write decoupled code (which is nice) but you still have 1 big app
[19:47:13] tubbo: christo_m: personally, i always thought dokku was kinda like shared hosting rails, and since ruby apps aren't known for their efficiency usually...you might run into slowness if you keep deploying new apps to the box.
[19:47:16] christo_m: tubbo: i just dont wanan dick around with chef just yet.
[19:47:18] tubbo: christo_m: that is, unless your droplet is really big
[19:47:40] christo_m: tubbo:theres no way to have multiple dorplets and have dokku know about it?
[19:47:44] christo_m: and make use of them
[19:47:51] AntelopeSalad: CorySimmons: ah, hmm yeah i dunno. i never looked into that
[19:48:07] tubbo: AntelopeSalad: my golden rule with engines is "if i'm doing the same exact thing in > 3 apps, make it an engine"
[19:48:23] tubbo: AntelopeSalad: because i believe 3 apps is a good baseline for knowing whether a lib can be re-used efficiently.
[19:48:35] AntelopeSalad: tubbo: but aren't all 3 of those apps incapable of running on their own?
[19:48:39] tubbo: AntelopeSalad: for example.. https://github.com/tubbo/zen_garden
[19:48:47] tubbo: AntelopeSalad: no, they do entirely different things.
[19:49:06] AntelopeSalad: the way i see it, you might want a blog on 3 different sites but the views would be much different for each one
[19:49:09] tubbo: AntelopeSalad: my engine zen_garden just adds a few Rake tasks. these are tasks that I pretty much copied into each of my apps prior to this, then i just realized "hey i do this every damn time" so i just made it a gem.
[19:49:29] AntelopeSalad: which made me start to think, why should the engine even have views
[19:49:38] tubbo: AntelopeSalad: yeah, like if you wanted to make a blogging engine (though `rails g resource blog_post subject body:text` is pretty much just that..
[19:49:46] BrazenBraden: cored: it was a joke! im so relieved... just recovering from my epileptic fit...
[19:50:03] AntelopeSalad: tubbo: i only used a blog engine as a quick and dirty example
[19:50:07] tubbo: AntelopeSalad: you'd maybe find that more useful than i would though, especially if you do freelance work.
[19:50:12] AntelopeSalad: but it's much more than that, and you know it haha
[19:50:13] diegoviola: I'm trying to write capybara/rspec tests for this code: https://gist.github.com/diegoviola/7933340 -- but ProjectStepsController#update is expecting session[:project_id] to exist, and that session variable is being set in ProjectsController#create. So how I'm supposed to test it?
[19:50:15] tubbo: AntelopeSalad: but yeah, you get the general idea.
[19:50:43] diegoviola: when I go to /project_steps/summary it says there is no ID or something, since the session var is not set
[19:50:55] AntelopeSalad: tubbo: i'm checking your repo now
[19:51:15] cored: BrazenBraden: well, I was calling him to get my brother in law blog done, he asked me to and I just hate him
[19:51:20] cored: BrazenBraden: I said, yes of course, bro
[19:51:29] tubbo: diegoviola: thanks to your gist, i just realized why that wizard framework was called 'Wicked'. :P
[19:51:34] AntelopeSalad: tubbo: i'm noticing i'm getting to the point where i do want to automate a lot of things
[19:51:35] BrazenBraden: cored: good move
[19:51:52] AntelopeSalad: like the default rails new isn't cutting it because i find myself wanting to have like 20 little adjustments in every app
[19:52:03] tubbo: AntelopeSalad: oh yeah, you want an app template then.
[19:52:09] diegoviola: tubbo: any ideas though?
[19:52:19] s2013: if i have a scope, hwo do i check if a record satisfies that scope?
[19:52:21] tubbo: AntelopeSalad: mine is somewhat complicated: https://github.com/tubbo/dots/blob/master/etc/rails/template.rb
[19:52:21] AntelopeSalad: i still don't get how they don't have inline errors as the default haha
[19:52:27] s2013: only way i acn think of is to do an include but that might be inefficient
[19:52:31] Yatekii: ok rails does pretty huge bullshit, I'm sure now ...
[19:52:50] rhizome: Yatekii and a cry for help
[19:53:02] diegoviola: tubbo: not my desire to use that gem, i wish the manager i work for wasn't so much of an idiot
[19:53:04] Yatekii: nah it's just fucked
[19:53:24] AntelopeSalad: tubbo: so every line in this template is an override to what rails does by default?
[19:53:27] rhizome: have fun with whatever you choose!
[19:53:52] tubbo: diegoviola: nothing wrong with it ;) anyway, have you tried just doing before { session[:project_id] = @project.id }?
[19:54:14] tubbo: i think rspec lets you mock out session data like that...because that's how devise/test_helpers works IIRC (it also sets some request.env properties)
[19:54:20] diegoviola: tubbo: like in a before hook?
[19:54:24] tubbo: diegoviola: yes
[19:54:29] tubbo: diegoviola: in your test
[19:54:44] diegoviola: tubbo: i haven't tried that yet, i'll give it a try, thanks
[19:55:09] tubbo: diegoviola: fwiw...using the session to define per-user behavior is somewhat of a fool's errand (re: `Project.find session[:project_id]`)
[19:55:33] tubbo: diegoviola: because if the browser sucks or your app doesn't set sessions correctly, things break and those cases will be VERY hard for you to reproduce
[19:55:47] tubbo: diegoviola: because it's not trivial to set up the session in such a way..
[19:56:01] diegoviola: tubbo: yeah so what do you suggest for me to do instead?
[19:56:05] tubbo: i don't know.
[19:56:18] tubbo: diegoviola: is this how wicked wants you to do it
[19:56:19] diegoviola: tubbo: i got that idea from a railscast
[19:56:30] Yatekii: I have a date which I convert to a human readable string with strftime and in the controller I set the date back to a date-format (splitting of the human readable string) (works properly (tested in the console)) but then the view gets an error because it tries to strftime the human-readable string instead of the converted which means that one time the controller is called before the view and then the view before the contr
[19:56:31] Yatekii: oller like WTF @rhizome
[19:56:33] diegoviola: tubbo: i would think so... not sure though
[19:56:45] tubbo: diegoviola: you should be OK then, that's probably how Wicked expects you to code..
[19:57:18] diegoviola: tubbo: yeah i think it uses some kind of state machine under the hood, it does some sort of magic behind the scenes, i'm not sure about it
[19:57:30] helpa: Yatekii: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:57:30] tubbo: Yatekii: !gist your code...you wouldn't happen to be overriding the date method on your AR object would you? :D
[19:57:31] diegoviola: tubbo: personally, i don't think i even need a "wizard", but hey the manager disagrees...
[19:58:14] tubbo: Yatekii: because from a birds-eye view it sounds like it's just *always* strftime'ing the value that came out of the DB, so it might not be possible for the controller or view to "see" the right data, since your code is blockading that.
[19:58:41] tubbo: diegoviola: i've found wizards are the easiest to make with a JS framework, because you're really solving a view problem here.
[19:58:45] Spami: For some reason, rails won't read my environment variables.
[19:58:58] Yatekii: tubbo it just stftime sthe value it gets, yep but that value should be ALWAYS a date.
[19:58:59] tubbo: diegoviola: so you have the JS framework change "pages", but all it's doing is showing different parts of a gigantic form.
[19:59:17] rhizome: Yatekii: why are you parsing the browser-supplied string instead of relying on the value in the object that you're strftime'ing in the first place?
[19:59:19] helpa: Yatekii: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:59:19] tubbo: Yatekii: !gist your code
[19:59:30] tubbo: Yatekii: controller, view, mdoel
[20:00:06] Yatekii: tubbo: https://gist.github.com/Yatekii/06c79938f608b48caba9
[20:00:13] AntelopeSalad: the only problem i see with a JS wizard is you would probably want to post each step to your db?
[20:00:27] AntelopeSalad: just so you can measure how many people start filling out your form but stop
[20:00:43] Yatekii: https://gist.github.com/Yatekii/44903bde700f3a69e4f2 https://gist.github.com/Yatekii/040067f1ea437f189e92 sorry had the wrong higlighter on, tubbo
[20:00:48] rhizome: Yatekii: please read POODR!
[20:01:02] Yatekii: https://gist.github.com/Yatekii/1aa706339a981c43c6e4
[20:01:29] Yatekii: rhizome: wtf browser based string wtf
[20:01:44] tubbo: AntelopeSalad: why? just send GA events when people click the submit button.
[20:01:44] rhizome: you know you can put multiple files into a single gist...
[20:01:48] triptec: hello, using multiple unicorn worker_processes does that require using sockets so they don't listen on the same port?
[20:02:02] rhizome: Yatekii: just relying on the detail of your description
[20:02:22] Yatekii: what should a browser based string be oO
[20:02:31] Yatekii: I just stftime the param I get from the controller
[20:02:34] Yatekii: nothing else
[20:02:35] rhizome: Yatekii: where in all this is the problem?
[20:02:38] Yatekii: and that param is time by default
[20:02:40] jokke: i'm having some trouble with following code: https://paste.jreinert.com/CqFP4H/ruby
[20:02:46] AntelopeSalad: tubbo: you mean when they click the next step button? yeah that's a good approach
[20:02:50] jokke: i'm using mongoid and carrierwave
[20:02:52] Yatekii: type(Time)
[20:03:04] rhizome: complete sentences help
[20:03:34] tubbo: Yatekii: ah okay, so you probably want to check out `Date.parse`.
[20:03:38] jokke: when i save a model which embeds another model which in turn mounts an uploader the carrierwave part is always nil
[20:04:10] diegoviola: tubbo: right
[20:04:14] tubbo: Yatekii: because what you're doing is reinventing Date.parse right now. actually i think there's a `strptime` that does the opposite of strftime...you give it a string and you tell it where each data point is...then it spits back a Time-ish (Date, Time, DateTime, etc.) object back at you
[20:04:39] Yatekii: tubbo: apparently just Time works b/c the db has some datetime and it does not match with date ... don't ask me ^^but ok I'll take a look
[20:05:07] Yatekii: tubbo: ya, but my parsing works, that is not the issue
[20:05:10] jokke: on line 11 cam_pic is correctly initialized
[20:05:18] Yatekii: there is some troubles with model-view-communication
[20:05:36] tubbo: Yatekii: well i'm just saying, you should remove code that reinvents the wheel. just because it works today does not mean it will work tomorrow, or next week, etc.
[20:05:36] jokke: i'm just wondering because usually i couldn't even save an embedded document
[20:06:07] jokke: so i thought when i save the embedding one the embedded document gets saved automatically with it
[20:06:24] Yatekii: tubbo that's right but it doesn't solve my real problem :)
[20:07:29] lethjakman: hrm has anyone ever had experience with passenger not changing its root on reload/reboot?
[20:09:06] tubbo: Yatekii: where are you actually doing the strftime?
[20:09:16] tubbo: Yatekii: i'm pretty sure the code you showed me doesn't include your problem :D
[20:10:05] Yatekii: ok tubbo I solved it
[20:10:11] Yatekii: and yes, my code included the problem
[20:10:14] tubbo: Yatekii: where was it?
[20:10:38] Yatekii: well I forgot some else and therefore it didnt format it in the else case but tried it in the if so it failed everytime :S
[20:10:47] christo_m: http://www.cloudatcost.com/pricing.php <- how is this legit?
[20:11:00] Yatekii: btw tubbo thanks for the better wheel ;) works great!
[20:11:00] ddd: triptec, they go into a pool if you mean the actual worker processes
[20:11:06] christo_m: 140 dolalrs one time ?
[20:11:07] ddd: the only one that listens is the master
[20:11:21] Yatekii: hmm tubbo problem is that I actually have no clue how to simply log some text or a number :S
[20:11:26] Yatekii: was pretty easy in php tho
[20:11:39] Yatekii: or c++ or java or whatever the fuck u choose ^^
[20:11:50] tubbo: Yatekii: logger.info "im in ur shell br0"
[20:11:56] ddd: triptec, unicorn creates a bunch of worker processes, the master process listens on the pool, the connection comes in, the master process selects a worker and connects the two endpoints on a random different port
[20:11:59] tubbo: Yatekii: you also get logger.debug, logger.error and logger.warn
[20:12:03] Yatekii: if I could have done that I could have checked which clauses it actually enters :S
[20:12:26] Yatekii: tubbo: but does this logger log to the browser too? :)
[20:12:29] ddd: triptec, it does this over and over, and reharvests the completed workers (or kills them and spawns a replacement)
[20:12:38] jokke: ah.. it's a bug
[20:12:40] jokke: http://benscheirman.com/2010/07/using-carrierwave-with-mongoid/
[20:13:18] ddd: triptec, I meant the MASTER listens on the *port*, not the pool.
[20:13:18] tubbo: Yatekii: no, it logs to your console. you never want to log to the browser, that's bad practice.
[20:13:32] tubbo: Yatekii: and don't tell me "oh everyone does this in PHP" because that's not an excuse for bad behavior.
[20:13:42] tubbo: Yatekii: ;) i come from PHP land myself
[20:14:03] ddd: triptec, the pool itself is basically just a grab-bag of worker processes it can assign to any one inbound connection
[20:14:21] ddd: tubbo++
[20:14:39] christo_m: tubbo:http://www.cloudatcost.com/pricing.php can you explain this to me?
[20:14:45] christo_m: tubbo: this seems like its too good of a deal
[20:16:19] tubbo: christo_m: lol they LITERALLY stole DO's idea *and* design :D
[20:16:22] triptec: ddd: thanks
[20:16:27] ddd: triptec, np
[20:16:33] christo_m: tubbo:except its super cheap.. i mean, its a one time payment
[20:16:44] tubbo: christo_m: who knows? :) digital ocean was considered "too good to be true" (still is, kinda) at one point.
[20:17:15] christo_m: tubbo: yes but thisi s a onetime cost..
[20:17:20] christo_m: you just have the server forever i guess?
[20:17:21] tubbo: christo_m: that $1/mo plan might move me off of DO. all i use my droplet for is for IRC and redirecting http://mysite.com requests to http://www.mysite.com
[20:17:36] christo_m: ah naked domain forwarding stuff
[20:17:43] tubbo: christo_m: that doesn't make any sense to me, actually.
[20:17:52] Yatekii: tubbo: well php sucks
[20:18:00] Yatekii: but it sucks to have console + browser too
[20:18:01] tubbo: christo_m: by paying for a service monthly, i'm partially ensuring that the company who's hosting my shit doesn't go down.
[20:18:09] tubbo: Yatekii: get used to it. :)
[20:18:11] christo_m: tubbo: ya so, whats going on here
[20:18:16] christo_m: tubbo: i read their faq it doesnt explain it well either
[20:18:18] tubbo: Yatekii: in fact, most of my work is done without a browser at all.
[20:18:21] tubbo: christo_m: no idea.
[20:20:00] christo_m: tubbo: now im really confused..
[20:20:04] christo_m: i was pretty sold on DO
[20:20:34] ddd: its a money grab. unsustainable long-term money model. i'd avoid it
[20:20:42] ddd: common sense alone tells us that
[20:20:45] tubbo: christo_m: i'd still go with DO if i were you. nobody knows whether cloudatcost is going to be around in a few years
[20:20:55] tubbo: christo_m: but people run production sites on DO, and pay for them. DO is gonna be around..
[20:20:56] christo_m: well, you cant be sure anything will be around
[20:21:11] christo_m: the thing is, these guys run from an ISP here in canada
[20:21:15] christo_m: so as long as the ISP is around, they are too
[20:21:19] tubbo: christo_m: i have more confidence in DO because it's been there longer and i know people that work there. also, they seem to be rolling in it since they can't stop sponsoring ruby confs :P
[20:21:29] tubbo: christo_m: that's not true at all.
[20:21:31] ddd: christo_m, no but there IS a FAR more likelihood that DO will be based on their model than on cloudat or wtf their name is
[20:21:40] tubbo: christo_m: if they stop paying their bandwidth bills you won't have a site anymore
[20:21:58] christo_m: you know, i had these kind of doubts just before bitcoin shot up
[20:22:02] ddd: their money model speaks volumes that its just a short-term money grab with mid-term longevity
[20:22:02] christo_m: and im still kicking myself
[20:22:06] christo_m: but i will once again, listen to reason
[20:22:08] tubbo: christo_m: are you canadian?
[20:22:22] tubbo: christo_m: so is http://www.fibernetics.ca/ a good company? have they been around for a while?
[20:22:28] tubbo: they seem to be the parent holder of cloudatcost
[20:22:39] christo_m: to be honest, i never heard of them till today
[20:22:40] christo_m: so i cant be sure
[20:22:44] christo_m: they're probably a reseller for a bigger company here
[20:22:46] ddd: ahh so its a spinoff saas
[20:22:49] tubbo: christo_m: that should tell you everything you need to know lol
[20:23:23] christo_m: DO it is, and i will learn chef i suppose
[20:23:32] ddd: shef and possi bly puppet
[20:23:33] christo_m: but that wont be for a while, heroku for now because its free
[20:23:33] tubbo: christo_m: tell me, what exactly do you plan to do with the $4/month you save by going with cloudatcost? buy an extra cup of coffee? ;) IMO, just wait for cloudatcost to start churning their PR machine so people get more confident in them.
[20:23:43] ddd: err si\ b/ib/
[20:23:44] stringoO: I'm trying to simulate a json post with sample data. I keep getting an additional paramter created called "receive_datum" - is this normal? In the server I see for the request {"name"=>"Test", "controller"=>"test", "action"=>"test", "receive_datum"=>{"name"=>"Test"}}
[20:23:44] tubbo: use heroku until it no longer makes sense
[20:24:22] ddd: and since its all free, there's no real penalty financial-wise to moving as needed
[20:24:29] christo_m: chef puppet vagrant, no idea what those things are
[20:24:30] bricker: stringoO: how are you sending the request?
[20:24:30] christo_m: but i will learn.
[20:25:00] CorySimmons: Newb question, I've created a few models. I'd like to set their editable fields in one fell swoop.
[20:25:08] CorySimmons: I don't have controllers associated with them
[20:25:09] ddd: and you can use DNS to add additional providers to your pool by including their IPs via A records (and simply add code to the pool members to redirect to a single IP machine for https requests)
[20:25:10] stringoO: bricker: with Net:http:post - I'll gist the code
[20:25:34] CorySimmons: Is there anyway to set a bunch of attr as accessible via a permit array or something?
[20:26:10] bricker: stringoO: I have never heard of that and cannot find "receive_datum" anywhere on google. You must be doing it yourself without realizing it.
[20:26:18] stringoO: bricker -> https://gist.github.com/surajreddy/6496497df6b4f8324d98
[20:27:20] ddd: christo_m, by using the DNS pool idea you also allow for systems to come in and out of the pool if you use the lowest set of TTLs as well, so say cloudatacost goes byebye, at most you have thos epool members in the pool for an hour
[20:27:23] rushed: CorySimmons: strong params, built in in 4, gem in 3 ex: http://railscasts.com/episodes/371-strong-parameters
[20:27:54] bricker: stringoO: try using set_form_data instead of request.body
[20:28:02] ddd: which sucks for that hour of course, but remember, they are randomly fed to the wild so it'd be intermittent behavior for an hour or less if your DNS provider allows lower TTLs
[20:28:11] CorySimmons: rushed: Don't you have to specify a controller (isn't that what required is?)?
[20:28:22] ddd: I would NOT go less than an hour because many DNS servers upstream won't recognize anything less than 1 hour
[20:28:54] ddd: they'll sed the TTL setting to 24h or silently drop that dns zone record for a day
[20:29:04] stringoO: bricker: will do. I was following the suggestion in http://stackoverflow.com/questions/10919287/make-this-http-post-request-in-ruby
[20:29:20] ddd: i don't remember who controls and but they're a first tier. they were doing that for awhile
[20:30:28] stringoO: bricker: set_form_data works great, thanks!
[20:31:00] bricker: stringoO: Can you post the server log where you were seeing `receive_datum`? I want to figure it out
[20:31:06] CorySimmons: Can anyone clarify if strong params require a controller?
[20:31:11] bricker: stringoO: maybe it's the server you're using
[20:31:23] bricker: CorySimmons: yes, absolutely
[20:31:27] CorySimmons: Looking for a way to quickly set permitted params in model w/o needing a controller
[20:31:44] bricker: CorySimmons: that's the point of StrongParams, it took mass assignment protection out of the model
[20:31:55] CorySimmons: That's what I thought
[20:32:03] CorySimmons: Is there any other way to do this?
[20:32:17] rushed: CorySimmons: why do you think you want a different way?
[20:32:28] CorySimmons: Just trying to quickly fill a db
[20:32:33] stringoO: bricker: https://gist.github.com/surajreddy/6496497df6b4f8324d98
[20:32:34] CorySimmons: For screwing around
[20:32:39] CorySimmons: Will never go production
[20:32:53] bricker: CorySimmons: if you wanted to, you could define `self.permitted_params` on the model to return an array, and then call that from the controller. But IMO that's worse than doing in the controller.
[20:32:56] stringoO: bricker: it's just standard rails s
[20:33:53] bricker: stringoO: that is bizarre. Google literally has 0 results for "webrick receive_datum"
[20:34:03] stringoO: bricker: I know :(
[20:34:14] CorySimmons: bricker: Yeah I don't want to have any controllers
[20:34:28] bricker: CorySimmons: Then what do you need StrongParams for?
[20:34:34] rushed: CorySimmons: if you have no controllers how did you end up with tainted params that need permitting?
[20:35:56] nettoweb: guys, I have a checkbox_tag and it's a bool collumn, but seems it generate a string value
[20:36:07] nettoweb: is there a way to return true or false to save in my db
[20:36:26] rushed: nettoweb: why do you think it's not working?
[20:36:46] nettoweb: rushed: the value never changed in my db
[20:36:51] nettoweb: other infos save
[20:37:08] ddd: wow, rubymine open for say 12h i start seeing SERIOUS lagging of my system. As soon as I close it, all the issues goes away.
[20:37:40] nettoweb: I debug and always get 'publico: t' checking or not cheking the checkbox
[20:37:40] jokke: hm am i doing something obviously wrong here? https://paste.jreinert.com/a13/ruby
[20:37:48] jokke: in line 11
[20:38:05] jokke: this is the model: https://paste.jreinert.com/tFHL86/ruby
[20:38:14] rushed: nettoweb: you might gist a log of the request that didn't change anything along with the related controller & model
[20:38:20] rhizome: jokke: cam_pic is not saved. use .create
[20:38:24] ddd: time to do some reporting to jetbrains
[20:38:38] jokke: rhizome: cam_pic is an embedded document
[20:38:46] rushed: ddd: restart every six np~
[20:38:59] diegoviola: i'm trying to set a before { session[:project_id] = @project.id } in my rspec test but i get undefined local variable or method `session' for #<RSpec::Core::ExampleGroup::Nested_1:0x007f6d5619f698>
[20:39:07] rhizome: jokke: oh, it's some mongo type thing. no idea.
[20:39:07] ddd: rushed, hehe
[20:39:15] diegoviola: any ideas? is there a way to get access to the session in a test?
[20:39:26] jokke: the thing is the first cam_pic is saved
[20:39:32] rhizome: diegoviola: what kind of test?
[20:39:33] jokke: the following aren't
[20:40:09] diegoviola: rhizome: rspec/capybara spec
[20:40:31] Yatekii: tubbo so how ya know it works properly? ;)
[20:41:03] rushed: diegoviola: then you don't access the session, you interact with your app using capybara's browser :)
[20:41:23] Yatekii: btw tubbo works like a charm now
[20:41:34] Yatekii: just gotta find out how the regex works
[20:41:39] CorySimmons: How can I get the value of a hash nested within an array and vice-versa?
[20:42:08] dnyy: has anyone used select2's createSearchChoice with rails? If you type something that's not an option, it sends the text over as the value of the field. i'm not sure how to use find_or_create with it, though. if the record exists, it sends the id, if it doesn't, it sends the name they typed. i feel like i worded that super shitty, but hopefully it makes sense.
[20:42:34] rhizome: CorySimmons: which hash?
[20:43:16] tubbo: Yatekii: i make sure my tests cover everything. you know, the tests you're supposed to write. you DO write tests, don't you? :)
[20:43:49] Yatekii: tubbo: nah
[20:43:54] Yatekii: how and why oO
[20:43:58] tubbo: Yatekii: when i first started learning all this, i of course did not write tests. it was useful to learn how the framework was working first, then you learn how to solve problems with it.
[20:44:03] s2013: is the to_xls gem still valid? it hasnt been updated in 4/5 years
[20:44:07] s2013: but i tihnk they are using it at work
[20:44:21] tubbo: Yatekii: the "why" will become apparent very quickly...because you'll see yourself stressing out over deploys while your peers can let the UPS guy push the button.
[20:44:23] diegoviola: rushed: yeah that's easy, but when i do just do and i go to e.g. /project_steps/summary, then it will tell me that no ID exists, the thing is that this action is expecting a session[:project_id] to exist, and that session variable is actually being set in another controller/action.
[20:44:35] diegoviola: when i do just that*
[20:44:49] tubbo: s2013: lol does it work? i mean, if your app doesn't change and the gem doesn't change, how can it break? :)
[20:45:13] s2013: i mean just in general. i wouldnt ideally install a gem thats 4-5 years old
[20:45:17] tubbo: Yatekii: the "how", OTOH, can be easily learned via the Hartl tutorial or various books on the subject especially WRT ruby
[20:45:28] CorySimmons: rhizome: http://i.imgur.com/2ZpxlPu.png
[20:45:33] s2013: or is there a better gem for generating excelfiles
[20:45:36] tubbo: Yatekii: in ruby, testing is very important...and trust me, you WANT to write tests.
[20:45:37] rushed: diegoviola: so go to the other controller/action first to get your whatever set as part of the test
[20:45:53] CorySimmons: rhizome: Just trying to figure out how to pick and chose what fields and such I want
[20:46:15] rushed: diegoviola: the whole point is to test via browser interaction, if you want to twiddle behind the scenes and test other things you should be in a controller test or something other then a request spec :)
[20:46:17] tubbo: s2013: *generating* XLS? never heard of anything that does that, i'll keep to_xls in mind. incidentally, Excel reads CSV so if someone wanted data "in Excel", i'd just give them a CSV. they don't know the difference.
[20:46:38] s2013: nah we have some formatting and stuff
[20:46:42] s2013: in the excel
[20:46:52] s2013: i prefer csv as its easier to deal with but meh
[20:47:02] tubbo: seems like to_xls is what you want
[20:47:14] s2013: the to_xls is working but i need to modify it but i hvae no clue how.. and documentation is sparse
[20:47:20] diegoviola: rushed: i tried that but it doesn't maintain the session
[20:47:45] platzhirsch: When using a named route like magazine_add_path it is sufficient to just pass one parameter/value pair to switch to another entity, because the generator completes the rest from the currently set params hash. I want to write a test for a partial using a named route in this way. Any idea how I can stub the action controller parameters here?
[20:47:58] rushed: diegoviola: you tried that, in the context of the same test?
[20:48:40] rhizome: CorySimmons: what fields do you want?
[20:49:24] tubbo: s2013: to the code!
[20:50:01] blitz: I'm having issues figuring out how to sort a list of objects on multiple fields using sort_by
[20:50:29] CorySimmons: rhizome: Nm figured it out, just have to keep diving deeper d['actors']['records'][0][1]
[20:50:36] CorySimmons: ^ gets me first name
[20:51:31] benlieb: is there a way to generate test files, or do I have to make them manually?
[20:52:47] ddd: benlieb, if you set up say rspec correctly it will autogenerate when you make a model/controller etc. otherwise if you're using minitest you can rails g test etc
[20:53:10] rhizome: CorySimmons: generally, i'd recommend turning that into a better data structure
[20:53:34] stringoO: bricker: I think I know what's going on
[20:53:35] ddd: sorry that woud be rails g test_unit
[20:53:41] ddd: see rails g test_unit for more info
[20:54:02] ddd: if you're using rspec and you're not getting the specs created then you didn't do the additional work after adding to GEmfile
[20:54:07] bricker: stringoO: please share!
[20:54:22] ddd: there is more to do, like configuring config/application.rb and running rails g rspec:install etc
[20:54:40] stringoO: bricker: It's pluralising the controller name and sticking the variables to it
[20:54:45] pipecloud: I don't use that install task anymore, myself.
[20:54:52] benlieb: ddd: Could not find generator test
[20:54:52] pipecloud: I just make helper files.
[20:54:53] stringoO: bricker: https://gist.github.com/surajreddy/76dc1ff617124372de31
[20:54:59] ddd: benlieb, see my next comment
[20:55:08] stringoO: bricker: I'm not sure why, it might be something normal
[20:55:11] ddd: and if its rspec, see my comment after *that*
[20:55:13] Yatekii: regexe in rails is weird :(
[20:55:18] bricker: argggg! I missed the controller name in your other gist
[20:55:22] bricker: stringoO: ^
[20:55:37] stringoO: bricker: in the other one i changed the controller name though, so you wouldn't have seen it
[20:55:44] bricker: Yatekii: it is?
[20:55:46] stringoO: bricker: any way to avoid this?
[20:55:58] benlieb: Could not find generator test_unit
[20:56:01] Yatekii: bricker: just to me ^^ I guess I got it now
[20:57:34] bricker: stringoO: Check what `data.to_json` is going. It might be adding in a root node that you don't want.
[20:57:58] CorySimmons: rhizome: Yeah I agree
[21:00:48] nettoweb: rushed: well, I finished trying to update my code, was very old (rails2.3), now I'm with rails3, but my app dont use nested resource mapped in routes.rb ... is there a way to update two object even this way?
[21:01:58] Yatekii: btw tubbo I don't think my app needs that extensive testing :)
[21:02:07] ddd: benlieb, what rails version
[21:02:59] stringoO: bricker: data.to_json just does this -> "{\"name\":\"Test\"}"
[21:03:04] ddd: benlieb, then this should work. https://gist.github.com/7935386
[21:03:07] stringoO: I'll keep looking at it
[21:03:16] ddd: see the bottom for both rspec AND TestUnit (whjich is really minitest)
[21:04:06] ddd: well its really minitest if you're using ruby (1.9|2.0) which if you're using rails 4.x you'd have to be
[21:04:12] bricker: stringoO: Try passing just the Ruby hash (not to_json) to the request. Net::HTTP will convert it for you.
[21:04:33] stringoO: bricker, I get a NoMethodError (undefined method `bytesize' for {"name"=>"Test"}:Hash):
[21:04:54] benlieb: ddd: I've added my output of rails generate as a comment: https://gist.github.com/7935386
[21:05:08] benlieb: I don't have the same number for test_unint generators you do.
[21:05:18] stringoO: bricker: it seems to work with set_form_data, but not response.body.
[21:06:04] ddd: benlieb, could be because I'm using rspec so it adds those.
[21:06:05] bricker: stringoO: hm.
[21:06:43] ddd: but you can create a directory name ./tests/ and add your tests there in the format of <model|controller>_test.rb and then use MiniTest/Testunit in them
[21:06:46] benlieb: ddd: probably. I've never used rspec. I tend to want to do rails as much out of the box these days, so I'm actually converting someone's old rspec to minitest
[21:07:04] ddd: then you can add minitest-rails
[21:08:04] ddd: benlieb, then see https://github.com/blowmage/minitest-rails and http://blog.crowdint.com/2013/06/14/testing-rails-with-minitest.html for how to use MiniTest with rails
[21:08:08] benlieb: ddd: I thought rails 4 came with this by default?
[21:08:17] ddd: Rails doesn't, RUBY does
[21:08:56] benlieb: ddd: there's a test_helper.rb in my app. What is that then? I don' t have the minitest gem.
[21:09:35] benlieb: ddd: this is from the guides: "There are a bunch of different types of assertions you can use. Here's an extract of the assertions you can use with minitest, the default testing library used by Rails. "
[21:09:41] ddd: that is for integration with your tests. your tests default to using minitest
[21:09:45] benlieb: http://guides.rubyonrails.org/testing.html
[21:10:27] benlieb: ddd: I'm confused, if it uses it by default, why do I need the gem? Or does that add new functionality.
[21:10:30] ddd: yeah, what i'm saying is rails defaults to integrating with minitest meaning it allows access to MinitTest
[21:10:41] ddd: it adds integration helers
[21:10:45] ddd: makes it easier to work with
[21:11:20] ddd: benlieb, see http://blog.crowdint.com/2013/06/14/testing-rails-with-minitest.html and look at: For Rails 4 we do the same as for Rails 3, but we leave out the line that requires active_resource/railitie unless we have included the gem for it and our project requires it.
[21:12:54] jragon: How can I get the path the redirect_to :back generates?
[21:13:00] tubbo: benlieb: iirc you don't need the gem at all.
[21:13:08] tubbo: rails/test_help works just fine without the gem
[21:13:17] tubbo: *but*, the gem does offer a more up-to-date version which is probably better!
[21:13:22] ddd: benlieb, also see rake -T output for anything related to minitest once you follow that tutorial. I am not using minitest directly, I am using rspec which handles all the integration for me.
[21:13:31] ddd: thats why this is different
[21:13:49] tubbo: oh wait i guess it's not really MiniTest, it's still Test::Unit but pretty much based off MiniTest
[21:13:56] benlieb: ok, after about 4.5 years with rails, I've learned to love gems in the short term and hate them in the long term.
[21:14:09] ddd: tubbo, No its MiniTest's compatability layer
[21:14:24] ddd: its still minitest but it defaults to presenting the TestUnit ompatability later directly
[21:14:30] benlieb: If I don't need a gem, I'll probably not use it.
[21:14:32] ddd: err compatibility even
[21:14:52] benlieb: is there anything I would need that gem for?
[21:14:54] ddd: the minitest-rails allows to bypass the compatibility layer and use minitest directly
[21:15:02] Yatekii: can someone tell me what the error tries to say me: http://grab.by/sO9W ?
[21:15:16] ddd: rather than dealing with MT's compatibility layer
[21:15:24] ddd: tubbo, make sense?
[21:15:45] benlieb: ddd: if I bypass that layer, will the info here still work, or would I have to change something: http://guides.rubyonrails.org/testing.html
[21:16:02] ddd: because of the transition from TestUnit to MiniTest, MiniTest defaults to exposing a TestUnit compatibility layer.
[21:16:08] erundook: hey guys, anyone has idea why 111111111111100000000 sent as via post suddenly becomes number 430646668842690304 in controller's params?
[21:17:41] ddd: benlieb, I honestly can not say. I believe it would not use the compatibility layer making testing.html wrong. ActiveSupport::TestCase *is* using MiniTest, but through its' TestUnit compatibility laer
[21:17:55] ddd: so I would suspect bypassing would break that page's instructions
[21:18:26] Yatekii: fuck rails is so difficult :(
[21:18:39] ddd: I would follow what that page is telling you. Its still MiniTest in all instances, just whether you're using MiniTest specific testing instructions or its TU compatibility indstructions
[21:18:39] benlieb: ddd: interesting. I'm going to stick with the guides then because documentation is at a premium.
[21:18:42] ddd: err instreuctions
[21:19:02] tubbo: ddd: oh i see
[21:19:04] ddd: benlieb, thats fine. (sorry for all the typos. I'm typing fast and goofing)
[21:19:22] lethjakman: how do you usually handel the secret key in capistrano?
[21:19:32] nettoweb: guys, can I update two objects in my db with just one form using nested fields? I'm not using routes.rb to create the resources
[21:20:23] ddd: benlieb, the project i'm building now, I was planning on backfilling in MiniTest specifics, so I'll need to go through that as well.
[21:21:00] ddd: I'm specifically using rspec at the moment which 'covers up' MT with what it exposes to me. I've rspec specific infrastructure in place.
[21:21:15] ddd: so we'll both be picking it up, just I'll be doing it at a later date than you :)
[21:21:30] platzhirsch: When using a named route like magazine_add_path it is sufficient to just pass one parameter/value pair to switch to another entity, because the generator completes the rest from the currently set params hash. I want to write a test for a partial using a named route in this way. Any idea how I can stub the action controller parameters here?
[21:23:13] ddd: lethjakman, I've a project that uses creating a secret key for it. give me a sec to pull it from the private repo. probably can morph to use it for capistrano
[21:24:11] ddd: lethjakman, I use this for SignedForm in my .travis.yml file. See if it will work for you to gen your secret. echo "SignedForm.secret_key = '$(rake secret)'" > config/initializers/signed_form.rb
[21:24:46] lethjakman: ddd: interesting, thank you!
[21:24:48] lethjakman: I'll mess with it
[21:25:08] lethjakman: smart way to do that.
[21:25:16] ddd: it was the only way I could use travis for testing since you add the initializer to your .gitignore
[21:25:20] lethjakman: it'll deauth any users that were currently logged in when I deploy though won't it?
[21:25:37] ddd: thats why you create it early in your sequence
[21:25:44] ddd: before anyone is logged in
[21:25:52] ddd: and before you start the app itself
[21:26:11] lethjakman: I'm talking about when I update my app though
[21:26:13] lethjakman: on production
[21:26:38] ddd: yeah it should do that. you WANT that to happen if you're going to force the app to use a secret like that
[21:26:49] _spiderman: How can I inject a user's location(HTML5) into every request to the backend?
[21:26:59] _spiderman: I suspect I will inject these into the params hash?
[21:27:21] terrellt: Spiderman works for the NSA!
[21:28:13] ddd: lethjakman, and remember that unless that app is in a private repo which is never exposed to the public and which uses a secret key stored in an initializer saved in the repo, the key will change every time using my way
[21:28:20] ddd: that can be both a good thing and a bad thing
[21:28:41] lethjakman: interesting, very good to know. I appreciate your help ddd!
[21:28:50] ddd: good since its never the same key on app start/restart, bad because its a moving target
[21:29:27] ddd: personally i'm ok with the moving target as i don't have to worry about key security as much. but thats totally me
[21:29:43] ddd: and i don't have to worry about the key being in the repo
[21:31:03] lethjakman: ddd: I'm kinda thinking about simlinking it in my deploy process.
[21:31:18] lethjakman: that way I don't force all my users out every time I update.
[21:32:06] ddd: ehh, i don't like that but thats me personally. and you have what? a handful of your total userbase? a better suggestion would be to redeploy during your absolute lowest usage period to minimize its affects
[21:32:53] ddd: and bear in mind, thats not a minimal impact feature either. you're affecting the entire application, not just a partial work flow
[21:33:07] erundook: anyone can explain how this can happen to the "rate" parameter? https://gist.github.com/erundook/7935851
[21:33:09] ddd: the key touches the entire operations flow
[21:33:35] s2013: hmm i have this weird issue with pdfkit. my html report looksfine.. but the pdf version has couple of charts missing.. i mean the charts are there, the points arent. its supposed to be exact replica of the html report. anyone ever faced a similar issue?
[21:34:09] erundook: s2013, you might want to add timeout before the render happens to let the JS do its job
[21:34:20] ddd: brb dogs are fscking up
[21:34:25] s2013: where would i add timeout
[21:34:29] lethjakman: ddd: interesting. I'll have to think on that a bit...
[21:34:39] s2013: in the respond_to block?
[21:34:54] erundook: s2013, nope, look in pdfkit parameters
[21:35:13] s2013: k let me check it. thanks
[21:35:54] erundook: i am not sure if it has such a parameter but i'm sure thats the problem. your chart was not fully rendered at the moment it takes the snapshot
[21:36:43] ddd: grr, dogs drive me nuts sometimes
[21:36:47] s2013: erundook, hmm i cant seem to find a parameter. whats weird is that it was working fine before yesterday.. and some of the chras show up . only the line graphs dont
[21:37:10] ddd: ANY person walks BY the house and they howl a storm. Dudes, Ladies, ONLY when they are ON the property! sheesh
[21:37:25] erundook: anyone can help my with this? https://gist.github.com/erundook/7935851
[21:37:41] erundook: this number conversion is pissing me off
[21:37:51] erundook: look at the rate param
[21:37:53] ddd: give details. just pasting a link and saying help me is NOT effective help-asking
[21:38:28] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[21:38:30] erundook: ddd, i'm passing 111111111111100000000 via POST parameter and at the controller i suddenly get 430646668842690304
[21:39:03] platzhirsch: How can I stub a controller with environment in RSpec?
[21:40:13] ddd: looks to me like you have something set somewher ein your app that overrides on post
[21:40:47] bricker: platzhirsch: Maybe this will help: https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/anonymous-controller
[21:40:50] erundook: ddd, removing two 1's from that parameter makes it look proper in controller
[21:40:50] ddd: like you have a random generator, OR you didn't expose rate properly for mass assignment
[21:41:04] _spiderman: erundook: Maybe overflow?
[21:41:14] platzhirsch: bricker: Ah right the anonymous controller, I forgot about it again :)
[21:41:32] ddd: ok, then you're overflowing and you set up rails to generate a fill-in in its place
[21:41:47] erundook: _spiderman, though so too, but an empty app with scaffold doesn't have that issue
[21:41:55] erundook: so i'm wondering what could cause this
[21:42:42] _spiderman: Check any before_filters as stated and check if anything could be intercepting the params value before hitting the controller
[21:42:52] ddd: go back and check your controller and model definitions as well as your before_* filters if any
[21:43:04] ddd: what _spiderman said hehe
[21:43:38] erundook: i only have devise's before_filter authorize_user!
[21:43:44] erundook: i'll try disabling it now
[21:44:17] erundook: nope, didn't help
[21:44:47] erundook: is there a way to get a chain of param filters?
[21:44:54] erundook: so i can go over all of them
[21:48:39] EminenceHC: Is there a way to count table rows in a .each block? Total rows that are displayed after conditionals that is..
[21:48:53] erundook: EminenceHC, each_with_index
[21:49:15] EminenceHC: erundook: I tried that but it counts everything regardless if the row is in a conditional statement.
[21:49:32] erundook: then use classic i=0 and i++ on condition
[21:50:33] erundook: ddd, so i've tried adding before_filter to ApplicationController that logs params, and it seems like it's already modified there
[21:50:57] erundook: also, the webrick logs show the modified value
[21:51:25] erundook: so this should be somewhere in rack then i guess...
[21:52:21] erundook: so how do i get the rack processing stack?
[21:53:33] rhizome: EminenceHC: use a partial and use the partial counter
[22:00:43] platzhirsch: When stubbing a controller how do I set the parameters of the controller? There is controller.params and controller.en['action_dispatch.request.path_parameters']
[22:11:31] Dreamer3: is there any sane way to make rails autoloading work with modules inside your application module?
[22:12:06] Dreamer3: MailProcessing::Campaigns is loaded from app/concerns/mail_processing/campagns.com??? and that's nice but what if i want MailProcessing under MyApplication module
[22:13:10] tubbo: TIL about `git remote rename $OLD $NEW`
[22:13:40] Dreamer3: app/concerns/my_app/mail_processing/campaigns.rb works, but that's hugely redundant
[22:14:26] Dreamer3: since the whole ROOT is my app
[22:16:27] tubbo: Dreamer3: module MyApplication; module MailProcessing..
[22:16:40] Dreamer3: i know how to write the ruby
[22:16:44] tubbo: Dreamer3: call it like MyApplication::MailProcessing
[22:16:46] Dreamer3: i'm asking about the autoload paths
[22:16:54] tubbo: Dreamer3: should still work if it's in ./app/**
[22:17:05] Dreamer3: it doesn't work with having a my_app directory
[22:17:09] Dreamer3: which is stupid and redundant
[22:17:09] tubbo: rails auto-requires everything in ./app iirc
[22:17:19] Dreamer3: it auto loads as needed based on the name
[22:17:29] Dreamer3: well maybe in production it autorequires
[22:17:36] Dreamer3: i forget how it works these days
[22:17:38] tubbo: Dreamer3: oh, well i would argue that it's stupid and redundant that you're surrounding a module that only lives in your app with your app's module. but that's just my opinion :)
[22:17:55] Dreamer3: tubbo: namespacing
[22:17:57] tubbo: Dreamer3: even so, why does it matter? is require 'my_app/concern' really that big of a deal?
[22:18:16] Dreamer3: having an extra folder is dumb, yes
[22:18:26] Dreamer3: since i'm already in the scope of my app
[22:18:29] tubbo: ah, are you trying to use the same class name as a 3rd-party tool?
[22:18:40] Dreamer3: tubbo: dunno, that's why you namespace :)
[22:18:56] tubbo: Dreamer3: actually that's premature optimization. YAGNI.
[22:18:58] tubbo: you invented this problem :)
[22:19:30] Dreamer3: no it's not
[22:19:31] tubbo: Dreamer3: i would say until you actually clash in naming and see problems happen, don't worry about namespacing your app code.
[22:19:45] Dreamer3: if i want to start using simple names you need to worry about conflicts
[22:19:58] tubbo: Dreamer3: well, Mail is a lib in your app already...so that's different.
[22:20:03] tubbo: Dreamer3: but MailProcessing isn't.
[22:20:11] Dreamer3: right, but it's only a matter of time
[22:20:18] tubbo: Dreamer3: YAGNI.
[22:20:31] tubbo: this problem doesn't actually exist.
[22:20:36] Dreamer3: i've had to change the name of things before
[22:20:38] tubbo: ACTION waves his magic hand
[22:20:41] Dreamer3: conflicts do happen
[22:20:49] tubbo: true, but changing the name of a class is not the end of the world
[22:20:59] Dreamer3: it is if i happen to like the name
[22:21:08] Dreamer3: this is exactly the problem namespaces were invented to solve
[22:21:09] tubbo: Dreamer3: and neither is getting around rails autorequire woes by doing `require 'my_module'`.
[22:21:25] tubbo: Dreamer3: your problem is that rails isn't picking up the right autorequire path
[22:21:27] Dreamer3: it could be a ton of modules
[22:21:45] Dreamer3: you are right i could write a stub to do all the requires
[22:21:45] tubbo: Dreamer3: so just explicitly require it. problem solved.
[22:22:03] tubbo: Dreamer3: or you could just be a man about it and write the damn require line :P
[22:22:15] Dreamer3: it's not one line
[22:22:17] tubbo: instead of trying to fight the framework to get it to happen automagically
[22:22:32] parndt: shout out to #rubyonrails on https://twitter.com/DoPodcast/status/411258371057012737 :-)
[22:22:36] Dreamer3: oh you mean where it's used i could require it manually
[22:22:41] Dreamer3: like in the good old days :)
[22:23:27] Dreamer3: yes that might work
[22:23:32] tubbo: Dreamer3: yes. that's what i do actually, i almost never trust Rails' auto-require. if i am using an object outside the MVC of my app, i *always* require it explicitly.
[22:23:58] Dreamer3: auto-require is very nice once you understand it, but if you try and not do things it's way it balks :)
[22:24:05] tubbo: Dreamer3: i kinda think it's better than to rely on magic which may change/break in the future. plus, it's really for documentation purposes...so a dev will know what file to look at if there's a problem with one of the objects my code uses.
[22:24:07] parndt: you mean autoload ?
[22:24:08] Dreamer3: i looked into "Fixing it" but last time i looked it was a mess :)
[22:24:20] tubbo: Dreamer3: pretty much. "don't fight the framework", or rails will make you pay.
[22:24:29] Dreamer3: tubbo: auto require has a consistent naming convention, it's not hard to find files
[22:24:34] tubbo: Dreamer3: if you have to do things outside the framework, put it in lib/ and control everything.
[22:24:40] tubbo: true, but sometimes it breaks down
[22:24:54] Dreamer3: if it breaks down auto requires doesn't work :)
[22:25:01] Dreamer3: i should look into this again
[22:25:11] Dreamer3: i'd really like an exception case for MyApp
[22:25:24] Dreamer3: such that the path could be either the full path or shortened (without my_app)
[22:30:48] tubbo: Dreamer3: no, i mean sometimes there are bugs with it when you do things with autorequire that the creators didn't intend.
[22:31:16] Dreamer3: sure like this??? but that doesn't mean it's bad to use as a practice??? anyone doing rails should be familiar with it
[22:31:25] Dreamer3: and it's the "preferred" way :)
[22:31:29] tubbo: Dreamer3: so you want all of us to change the framework's features just so you can solve a problem that doesn't even exist yet? please.
[22:31:59] tubbo: most people aren't going to namespace their own app in a concerns dir.
[22:32:05] Dreamer3: funny thing is it actually works, but rails isn't expecting the result so it still errs
[22:32:07] tubbo: this just isn't a common paradigm
[22:35:04] Vocino: any reason i would be getting blank white screens in safari but not chrome when browsing localhost?
[22:35:12] Vocino: some kind of odd caching issue?
[22:35:27] Vocino: rails log shows that it's loading the views and everything
[22:38:54] rhizome: no normal reason
[22:39:15] rhizome: rails log probably shows that they were rendered, but that doesn't say antyhing about the browser
[22:42:21] Vocino: must be some safari caching crap because works
[22:44:25] Dreamer3: nil # Gee, I sure wish we had first_match ;-)
[22:44:28] Dreamer3: cute comment
[22:44:48] Dreamer3: why not just write first_match on AS#array then
[22:46:44] bobbobbins: hello, I'm trying to post json to a create call, and it doesn't seem to be working...params is always blank...can someone tell me what I'm doing wrong here... https://gist.github.com/bobbobbins/7936921
[22:46:59] bobbobbins: you can see my curl calls and what works and what doesn't at the bottom
[22:47:50] elaptics: bobbobbins: it will be useful to see your rails log output too
[22:48:01] bobbobbins: elaptics: ok, one second
[22:49:25] bobbobbins: updated...you're right, that is pretty helpful
[22:50:24] elaptics: bobbobbins: so you can see it's being escaped in the 2nd version
[22:50:44] bobbobbins: yeah, i see that now...any idea why it would do that?
[22:52:04] drocsid: rails fenerate scaffold LineItem product: refernces cart:belongs_to <- I see this line in the agile web dev book, and do not understand the 'refrences' part. It looks like it creates a LineItem model with belongs_to method for both product and cart, but what does refrences do, and why isnt it product:belongs_to and cart:belongs_to ?
[22:56:13] Dreamer3: tubbo: not as hard as i remember
[22:56:29] Dreamer3: you have to patch Dependencies#search_for_rile and Dependencies#autoloadable_module?
[22:56:41] tubbo: Dreamer3: heh :D
[22:57:02] drocsid: http://guides.rubyonrails.org/migrations.html#active-record-and-referential-integrity
[22:57:07] drocsid: ok found something here
[22:57:14] elaptics: bobbobbins: try curl -i -X 'POST' -H "ContentType: application/json" -H "Accept: application/json" http://localhost:3000/annotations -d '{"quote":"test3","text":"test4"}'
[22:57:23] drocsid: what a crap book, i don't care for handwaving...
[22:58:19] ddd: references created an integer field for an association that you mention. so that one would create t.integer cart_id
[22:59:37] bobbobbins: elaptics: well that didn't work, but in the log the processing as */* changed to JSON, unfortunately, the values were still escaped
[23:01:06] ddd: drocsid, in the *migration* it will still show as t.references :cart but the actual *db* entry will be a t.integer cart_id
[23:02:49] mmun: I have timestamps set up in the usual way (t.timestamp in the migration). is it possible to override the updated_at attribute when saving a record?
[23:03:31] elaptics: bobbobbins: try this instead: curl -v -H "ContentType: application/json" -H "Accept: application/json" -X POST -d ' {"quote":"test3","text":"test4"}' http://localhost:3000/annotations
[23:03:52] dcope: in my model, i have an after_save method to run. is there a way to ignore this if a specified attribute is changed?
[23:04:31] Dreamer3: dcope: add exception code in your after_Save
[23:05:05] dcope: Dreamer3: what do you mean exception code?
[23:05:36] elaptics: dcope: like do_stuff unless thing.changed?
[23:05:42] drocsid: ddd: thanks, i still don't quite get it. is the references function applied to cart or product?
[23:06:09] dcope: elaptics: looks like i can use model.attribute_changed?
[23:06:17] drocsid: I'll go ahead and look at the code it generates
[23:06:21] ddd: neither. cart refers to product
[23:06:24] bobbobbins: i think it might be a problem with my ajax function
[23:06:32] ddd: all you did was generate an integer field like :id is
[23:06:46] ddd: and its used for when you store the id of an association in THAT particular model
[23:07:23] ddd: like if address were a model and user was a model. address would have the t.integer user_id which is the belongs_to side of the association.
[23:07:30] elaptics: dcope: yes, but not after the save I don't think
[23:07:37] bobbobbins: never mind, that makes no sense, since I'm using curl
[23:08:03] ddd: SELECT FROM addresses WHERE 'user_id' == ?, user or something like that
[23:08:08] Dreamer3: callbacks should also support :if and :unless
[23:08:15] ddd: building it in my head isn't doing so well hehe
[23:08:26] elaptics: dcope: to be clearer, once the save has happened checking what's changed will not work unless you record it first
[23:08:38] Dreamer3: see the docs for #set_callback
[23:08:55] ddd: basically the belongs_to side of a has_many gets the cart:references when you gen the migration
[23:08:56] elaptics: dcope: read the info here http://api.rubyonrails.org/classes/ActiveModel/Dirty.html
[23:08:56] Dreamer3: elaptics: there is a hash of what it used to be
[23:09:23] Dreamer3: previous_changes
[23:09:26] drocsid: ddd: I'm probably not understanding the syntax rules... I thought that product:refrences meant that references() applies to product
[23:09:27] elaptics: Dreamer3: does AR do that for you? I can't remember
[23:09:41] ddd: no it means your REFERENCING product
[23:09:41] Dreamer3: right in that link you posted :)
[23:09:58] ddd: so you would end up with a t.integer product_id field in the db
[23:10:04] elaptics: Dreamer3: doh! :)
[23:10:15] tubbo: drocsid: read ":" as "is a"
[23:10:18] bobbobbins: elaptics: found it...its Content-Type not ContentType
[23:10:24] tubbo: drocsid: price:integer => "price is an integer"
[23:10:35] ddd: an integer field named product_id in the table you defined the t.references in
[23:10:37] tubbo: drocsid: so product:references => "product(_id) is a reference (to a product)"
[23:10:58] ddd: which cart would have. product obviously wouldn't
[23:11:00] drocsid: and cart is a belongs_to
[23:12:16] ddd: well you actually want to put cart:references in the product migration because its *product* that is the belongs_to and needs the cart_id field
[23:12:23] ddd: you have it reversed
[23:12:40] Chanshark: is anyone else having trouble running the "rails server" command?
[23:12:50] drocsid: ddd: the text has it reversed
[23:12:59] elaptics: Chanshark: no
[23:13:25] ddd: tubbo, i am correct right? t.references :cart makes a cart_id integer field in product if that statement was in the products migration
[23:13:42] ddd: and represents the belongs_to part of the association, correct?
[23:13:55] Chanshark: because for some reason it keeps saying i don't have the ExecJS gem installed when i do
[23:14:08] ddd: cart doesn't need a t.references because its the Model's has_many :products that handles that
[23:14:34] ddd: drocsid, verifying my belief here. sec
[23:14:36] elaptics: ddd: #references is just an alias for #belongs_to
[23:14:47] ddd: elaptics, right. thats what i thoiught.
[23:15:20] ddd: so its products migration that gets the cart:references which creates a t.references :cart in product's migration which represents the belongs_to :cart
[23:15:38] ddd: and when the migration is run, products table gets a cart_id integer field
[23:15:50] ddd: column, sorry
[23:17:07] ddd: drocsid, hehe associations can be a pita
[23:17:12] drocsid: ok I'll play around with it. So it looks like :refrences makes the products table get a column, and also sets belongs_to for product
[23:17:23] elaptics: Chanshark: how have you installed it?
[23:17:31] ddd: unless you know them cold, or have that associations guide in front of you at all times it can be a pita to remember which gets what
[23:17:44] Chanshark: i used rvm to install it
[23:17:53] ddd: no the belongs_to causes rails to look for the :<blah>_id field on the table
[23:18:01] ddd: s.field.column.
[23:18:03] tubbo: Chanshark: try `bundle exec rails server`
[23:18:08] elaptics: drocsid: have a look at the examples here http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column
[23:18:23] Chanshark: okay, thanks :)
[23:18:27] elaptics: Chanshark: and you have run "bundle install" ?
[23:19:02] ddd: it doesn't 'set' anything. it just tells the ActiveRecord logic to look for a <referenced_model>_id column on the table representing the model that has the belongs_to specified in it
[23:19:30] ddd: drocsid, that make more sense now?
[23:19:51] drocsid: I'm not that fast, sorry. Looking at the examples still
[23:20:00] ddd: damn it anyone using xchat know how to set up an ignore to ignore nick changes across ALL channels?
[23:20:30] ddd: hate seeing all these stupid friggin zz_ or _away nick changes. makes me think there's activity when its just this stupid shit
[23:20:50] ddd: in irssi its a simple /ignore * NICKS
[23:20:53] ddd: yeah that crap
[23:21:29] ddd: i don't need to see _todd stupid nick changes for away status changes., irssi I can block it easily. xchat doesn't support the NICKS option to ignore
[23:22:11] _todd: sorry about that, ddd
[23:22:59] ddd: you just happened to give an example. its not you specifically
[23:23:22] Chanshark: elaptics: so I did that, and im still getting the same error.
[23:23:43] _todd: understood, you just called me out specifically
[23:23:46] ddd: my channels light up when there is activity in a non-focused channel. 99% of the time its just a nick change showing like what you did. I only want to see actual chat text. its not you :)
[23:23:52] ddd: yeah i did., my apologies :)
[23:23:56] drocsid: ddd: thanks for the explination. I understand more than I did. I'll mess around with it. Best
[23:24:18] ddd: drocsid, no problem. hopefully when you read it and keep my explanation in mind it will be come clear
[23:24:28] ddd: like i said, assocs can be a real pita
[23:25:03] elaptics: Chanshark: did bundle install show it installed successfully?
[23:25:04] tubbo: ddd: weechat time.
[23:25:23] tubbo: ddd: that was what made me switch off irssi...couldn't configure notifications the way i wanted them.
[23:25:54] ddd: tubbo, irssi does it quite easily. /ignore * NICKS JOINS PARTS CRAP CLIENTCRAP
[23:25:56] ddd: done done
[23:26:11] tubbo: wtf is CRAP
[23:26:13] tubbo: is that real?
[23:26:20] ddd: only reason I keep quits is so i don't talk to thin air
[23:26:33] helpa: Chanshark: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[23:26:33] elaptics: Chanshark: !gist your complete output showing bundle install output and command failure
[23:26:34] ddd: CRAP is server side stuff CLIENTCRAP is well the client side crap
[23:26:35] tubbo: lol why isn't that dfeault
[23:26:52] ddd: because many people DO like seeing that stuff. its childish nonsense to me
[23:26:53] tubbo: ddd: it's like "no i actually want to be COVERED in crap while i chat, tyvm
[23:26:59] ddd: hahahaha
[23:27:04] ddd: too funny ;)
[23:28:25] Chanshark: oh im just in terminal, its not any code
[23:29:03] elaptics: Chanshark: yes, gist that output - if bundle install was successful then there shouldn't be any reason why it's not working
[23:29:13] elaptics: Chanshark: what is your OS?
[23:30:09] jarr0dsz: hi everyone, im trying to solve a navigation render issue with nested resources but not quite sure which way to go
[23:30:30] jarr0dsz: currently im using this https://gist.github.com/anonymous/f3a03102738ae4ea2618 inside a partial and include it in my layout anyone could recommend doing this more clean?
[23:30:55] Chanshark: https://gist.github.com/anonymous/ccb99f3dde29a18ef662
[23:31:03] jarr0dsz: problem is i need to render diffferent div's on different pages so in need for something very flexible which this is my current solution quite not
[23:33:28] ddd: btw folks, install the gist gem. makes it easy to gist from the commandline as well. do a 'gist login' which will store your login info for you if you have a GH account. then do something like 'cat app/models/your_model.rb | gist -f your_model.rb --'
[23:33:29] elaptics: Chanshark: oh, so execjs is installed you're missing a runtime
[23:33:50] elaptics: Chanshark: you need to install one: see the README https://github.com/sstephenson/execjs
[23:33:52] ddd: you'll get a gist URL back you can paste to us. the -f just fills out the File Name field on the gist
[23:34:05] elaptics: Chanshark: node.js is probably the best bet
[23:34:20] tubbo: jarr0dsz: here's one way.. https://gist.github.com/tubbo/00375448b513db94b6a1
[23:34:27] ddd: sorry, its 'gist --login' to log in and store your creds
[23:34:40] tubbo: ddd: +1 for the gist gem, as well as gist.vim
[23:34:49] Chanshark: i installed node.js
[23:34:51] ddd: oh didn't know about gist.vim! googling!
[23:34:57] elaptics: tubbo: gist.vim is all you need :)
[23:35:03] jarr0dsz: tubbo yes partials have considered and used that setup also would help cleaning it out a bit but would still results in many replication
[23:35:09] elaptics: why step out your editor, ever? :)
[23:35:12] tubbo: ddd: it's the tits. you can even get it to save all open buffers to a multi-file Gist.
[23:35:14] ddd: elaptics, only if you happen to be out of yourt editor
[23:35:19] ddd: tubbo, awesome!
[23:35:23] ddd: grabbing
[23:35:28] ddd: mattn ?
[23:35:33] elaptics: ddd: if you're using vim there is never a need to be out of it :)
[23:35:36] jarr0dsz: i have like about 4/5 nested resources i kinda need to render these navigation's for the best way would be to make it variable
[23:35:37] tubbo: elaptics: what if i want do gist a file but don't want to open it? `cat my/large/file | gist` is way better.
[23:35:37] ddd: elaptics, lol
[23:35:55] ddd: tubbo, he's assuming a vim campout ;)
[23:35:58] jarr0dsz: have thought of writing some helpers that inject the model / controller name's so i have 1 unified solution to render those blocks of html
[23:36:23] elaptics: tubbo: stop providing reasons to not use vim ;)
[23:36:34] ddd: hahahah
[23:36:56] tubbo: jarr0dsz: without actually looking at your design, or the rest of the code, it's hard for me to recommend any kind of solution for this. seems to be a code workaround for a flawed design.
[23:37:16] tubbo: jarr0dsz: what do those .member?'s do?
[23:37:25] tubbo: is it just like a role-based auth thing?
[23:37:42] jarr0dsz: tubbo possible to pass multiple
[23:39:04] tubbo: jarr0dsz: ...you didn't answer my question
[23:39:53] jarr0dsz: tubbo have been struggling with it a bit, mostly just regular non namespaced resources and nested resources where im trying to render some navigation and buttons on certain actions
[23:40:07] tubbo: jarr0dsz: what does member? do.
[23:40:20] tubbo: jarr0dsz: is that REALLY such a hard question to answer? if so, you're fucked. :)
[23:40:32] jarr0dsz: tubbo multiple match like if ["edit", "show"].member?(params[:action])
[23:40:42] tubbo: jarr0dsz: oh it's just includes?
[23:40:43] jarr0dsz: so for actions edit and show do something
[23:40:44] tubbo: oh never mind
[23:40:49] tubbo: jarr0dsz: why not just use includes? :P
[23:40:54] jarr0dsz: i check the action param ;p
[23:41:51] jarr0dsz: yes could also but more flexible
[23:42:16] tubbo: jarr0dsz: probably not...anything you do here is just covering for design flaws imho
[23:42:54] jarr0dsz: tubbo i try to writeup a gist with the wanted outcome perhaps im on wrong track its a bit hard to explain
[23:43:17] tubbo: jarr0dsz: i think i understand what you're going for here. you want to conditionally show blocks of code based on what page someone is on
[23:43:34] tubbo: jarr0dsz: IMHO, you should instead just set the @nav_partial in your controller's action, and call = render partial: @nav_partial
[23:44:10] jarr0dsz: tubbo yes thats the idea using 1 partial, its not only the rendering there are also other elements like buttons,search etc
[23:44:17] jarr0dsz: perhaps using content_for but thats messy and not dry either
[23:44:37] tubbo: jarr0dsz: updated the gist https://gist.github.com/tubbo/00375448b513db94b6a1
[23:44:52] tubbo: jarr0dsz: you don't even need content_for, just an ivar that you pass from controller to view
[23:46:39] jarr0dsz: ill see like that, a way to clean things out in the view deperatment also i investigate if that's a good way to use im writing gist its a little more complex even
[23:47:14] elaptics: jarr0dsz: your views should be devoid of conditionals as much as possible
[23:48:09] jokke: from my routes.rb: https://paste.jreinert.com/POn0V/ruby
[23:48:09] jarr0dsz: this explains it a bit more: https://gist.github.com/anonymous/a023291690d18bdd04df
[23:48:18] jokke: is it possible to get this to work?
[23:48:30] jarr0dsz: sorry i could not explain myself better without this gist that is basically the idea to render menu and layout
[23:49:02] jokke: now i.e. /snapshots/2013 just triggers show on snapshots with id 2013
[23:49:14] tubbo: jarr0dsz: that's hella complex for a simple tab interface.
[23:49:20] jarr0dsz: tubbo 2nd row (details /users) are twitter bootstrap tabs, so idea is to have those rendered correctly so you get a bit of a "Crm look and feel"
[23:49:21] ddd: tubbo, woot! got it now! mucho gracias!
[23:49:27] tubbo: ddd: np man
[23:49:43] jarr0dsz: tubbo yes but it works very natural complex in view logic , very simple in flow for end user
[23:50:08] jarr0dsz: plan was to stack nested resources like this true the whole app. for example i have tutors with students also the same like this
[23:50:47] jarr0dsz: but quite tricky, i could inventarise all the different layouts then make variables like your suggestion and use that to render correct html blocks cleaner in the views
[23:51:10] ddd: :Gist -m -s All files in this logic flow
[23:51:13] jarr0dsz: no other way of doing it i assume? or perhaps namespace the nested resources (?)
[23:51:13] ddd: works great hehe
[23:54:57] ddd: tubbo, woot! https://gist.github.com/ddd/7937758 :Gist -m -s All files in the Shelters logic flow. could not be any easier except if you were looking at my screen :)
[23:56:10] ddd: ah ha! but you DO have to wrap whitespace separated comments to -s with '' or ""
[23:56:16] ddd: otherwise it only uses the last word
[23:58:51] tubbo: just like the cmd line