« Back to channel list

#RubyOnRails - 29 June 2013

« Back 1 day Forward 1 day »
[00:00:53] superscott[8]: bratsche: that isn't a path
[00:01:27] bratsche: That's why I said "or whatever it's called". You need to look at the output of rake routes to get it.
[00:02:34] superscott[8]: right, there isn't a route for it =/
[00:02:46] Bryun: hello all
[00:04:32] aamax: hi guys. i have a rails app on a server - attached to a pg db. i need to drop the db and run my rake tasks to initialize it but i can't seem to drop it as there are reportedly 7 active connections to it. this server has a number of pg dbs on it and i don't want to kill any of the other ones, or affect any of the other rails sites on this server. how can i do this?
[00:04:39] joshuawscott: superscott[8]: you need to put '/contact_manager' instead
[00:04:49] joshuawscott: if I'm understanding what you are asking
[00:04:57] Bryun: <%= link_to card.name, card,
[00:04:58] Bryun: data: { content: { image_tag "iconBlood.png" },
[00:04:58] Bryun: html: true },
[00:04:59] Bryun: class: "card" %>
[00:05:02] Bryun: how would I make this syntax correct?
[00:05:21] superscott[8]: joshuawscott: controllers can't have slashes
[00:05:50] superscott[8]: i just changed the scope to a resource, i still don't get why it doesn't work like how i had it though
[00:06:06] joshuawscott: yeah, you need to put it in there so it doesn't assume the current namespace
[00:06:25] joshuawscott: Byrun: there should be a colon after image_tag, I'm guessing
[00:06:39] Lewis: what's the difference between <% if @user.errors %> and <% if @user.errors.any? %>
[00:06:44] helpa: Bryun: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[00:06:44] Radar: Bryun: !gist
[00:06:58] Radar: Lewis: one checks if @user.errors is nil, the other checks if its an array containing any elements.
[00:09:57] Bryun: https://gist.github.com/sakaye/95589c9c6ac6be251d5b
[00:11:15] Lewis: Radar: stupid question. For some reasons I thought the array errors was just empty or with errors
[00:12:20] Lewis: Radar: never mind what i said
[00:14:23] Bryun: this that possible? from my gist?
[00:16:20] slash_nick: Bryun: doesn't look good to me... what are you trying to do with that image_tag?
[00:17:21] Bryun: so I need it to create a standard html <img> inside the data-content: attribute for the anchor
[00:17:22] slash_nick: Bryun: commented on the gist
[00:18:21] Bryun: when I hover over the anchor it will display the image tag in a tooltip
[00:19:01] slash_nick: gotcha Bryun... what happens when you try what you've got in that gist?
[00:20:12] Bryun: syntax error, unexpected tSTRING_BEG
[00:22:49] Bryun: the tooltip looks for something like <a href="#" data-content="<img src="image_place" />" >
[00:25:45] joshuawscott: Bryun: maybe need to put parenthesis?
[00:28:23] Bryun: joshuawscott: that worked
[00:29:01] joshuawscott: Bryun: awesome. that's bit me a few times
[00:36:49] superscott[8]: is there a way to get around adding an attr_accessible for your model when you're rake db:seeding?
[00:41:33] fulcan: couldn't find file 'jquery.ui.all' when trying to connect to http://50.116.34.222:3000/ which appears to be a known issue, I added *= require jquery.ui.all to application.css and //= require jquery.ui.all to application.js but still get the error. complete build and error -> http://bpaste.net/show/3yC1AZxq5WmSTzHHTE4d/
[00:44:10] superscott[8]: fulcan: take it out of the application.css, it's a javascript file
[00:45:43] fulcan: superscott[8] you mean require jquery.ui.all ?
[00:49:14] fulcan: superscott[8] same thing
[00:50:10] fulcan: ActionView::Template::Error (couldn't find file 'jquery.ui.all'
[00:50:14] superscott[8]: is the file there?
[00:50:36] fulcan: I don't think I ever had it
[00:50:50] superscott[8]: well, that's probably step one.
[00:51:06] fulcan: how/where do I get it?
[00:53:37] superscott[8]: fulcan: https://github.com/joliss/jquery-ui-rails
[00:54:05] superscott[8]: did you already install that gem?
[00:54:33] superscott[8]: or rather, add it to your gem file and bundle install?
[00:55:25] superscott[8]: and you can add it back to your application.css as well, forgot about the ui gem
[00:57:30] fulcan: superscott[8] I am trying to figure it out. I am very new to ruby and trying to get this running https://github.com/lockitron/selfstarter/blob/master/README.md
[00:58:13] superscott[8]: fulcan: goto this file :: https://github.com/lockitron/selfstarter/blob/master/Gemfile
[00:58:28] superscott[8]: and add this line gem 'jquery-ui-rails'
[00:58:29] fulcan: superscott[8] I think I am doing this wrong.
[00:58:36] superscott[8]: that'll happen.
[01:00:00] superscott[8]: then via command line, goto the folder where you installed the app, and type bundle install
[01:00:18] superscott[8]: then re-start your server, and you should be good to go
[01:00:46] zeromodulus: Woo, so stoked.
[01:01:07] zeromodulus: Next week I'm going to try to get some interviews for a developer position.
[01:02:42] superscott[8]: do or do not, there is no try.
[01:03:27] zeromodulus: superscott[8]: are you an ent?
[01:04:50] aharris6: anyone have any tips on getting this to work with the current url of the page: @short_url = bitly.shorten('http://www.google.com').short_url
[01:05:18] aharris6: something like @short_url = bitly.shorten(request.url).short_url
[01:08:39] fulcan: superscott[8] how do I install jquery-ui-rails? I git it and run bundle install and do the same in selfstarter, but still getting the same error? I am missing something foolish.
[01:12:30] dcope: anyone had a problem where capistrano wasn't updating the `current` symlink?
[01:14:40] akiva: Hello all. When it comes to actionmailer, how can I set the to: automatically to use whatever is being used for my smtp config for that environment?
[01:20:06] fulcan: how do you install a gem from github i they don't have a .git file? gem 'jquery-ui-rails', :git => "git://github.com/joliss/jquery-ui-rails.git" bash: git://github.com/joliss/jquery-ui-rails: No such file or directory ?
[01:21:36] sprite--: https://gist.github.com/anonymous/5889233 the 2 parameters that are copied over to the game hash are copied because they ,are attr_accessible and rails auto detects this?
[01:25:44] banas: WHat's the command line to open up sublime text?
[01:29:15] fulcan: rake aborted! http://bpaste.net/show/ON4RTUvFBD3uurHZStoE/
[01:29:45] Apane: howdy pardeners
[01:35:38] banas: WHat's the command line to open up sublime text?
[01:40:26] Apane: yo uthhere
[01:40:33] Apane: try, subl .
[01:41:05] boytoy: What do you guys think of my Tor IP blocker for Rails vs the Nginx one? https://gist.github.com/kakekake89/5888836
[01:41:08] boytoy: Thought I'd block Tor from my forum to prevent crime and abuse.
[01:41:31] banas: Apane: thanks! :)
[01:41:47] banas: but that didnt work.
[01:42:44] Apane: waht are you using
[01:43:12] Apane: rails + command lione?
[01:43:13] banas: sublime text 2 on fedora
[01:44:06] Apane: banas, try sublime .
[01:44:15] Apane: should open app directory
[01:44:51] banas: nope, didn't work either
[01:46:51] banas: Apane: sublime_text . worked :)
[01:59:57] fulcan: rake aborted! http://bpaste.net/show/ON4RTUvFBD3uurHZStoE/ I found this https://github.com/refinery/refinerycms/pull/1773 but I added <%# encoding: utf-8 %> to all my .yml files and still the same characterset error.
[02:02:21] Radar: fulcan: what is on this line? /var/www/localhost/htdocs/jquery-ui-rails/Rakefile:38
[02:02:53] fulcan: build_info = JSON.parse(File.read build_file)
[02:03:11] Radar: fulcan: what is in build_file?
[02:04:25] fulcan: Radar I'm not real sure. I am very new to ruby
[02:05:55] Radar: fulcan: gist the complete Rakefile please
[02:06:22] fulcan: http://bpaste.net/show/110636/
[02:06:27] Radar: Close 'nuff
[02:06:51] Radar: What version of Ruby?
[02:07:33] fulcan: ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
[02:07:53] Radar: I have no idea what could be going wrong. Contact the maintainers of jquery-ui-rails by filing an issue on GitHub and ask them what's broken.
[02:10:36] fulcan: Radar is there any way around this error without jquery-ui-rails ? http://stackoverflow.com/questions/17374842/ruby-on-rails-ails-with-couldnt-find-file-jquery-ui-all
[02:11:09] Radar: fulcan: I don't have the code for your app, so I can't tell
[02:13:08] fulcan: https://github.com/lockitron/selfstarter
[02:20:45] Radar: fulcan: file an issue on that project.
[02:25:37] imbric: Hey guys, I've got a couple models which I want to declare as resources (i.e., make them editable, viewable by the show action, etc). They're really similar in that they're objects with attributes and so the views are basically "Show all the fields and they're values". It seems like I should refactor this out into a helper or a partial, but I'm unsure of the best/right place to put it. Do you have any adivce?
[02:25:52] Radar: their* </pedant>
[02:26:15] Radar: imbric: How would you refactor this out?
[02:26:29] Radar: imbric: Are you absolutely positive that you won't need to tweak these pages later to add specific things to each resource?
[02:27:30] imbric: I'm not absolutely positive, but at the moment, I feel like I'm abut to duplicate a lot of view code. Basically each blah.html.erb is a header section for the titles of the attributes and then a loop over each object in Blah.all to print each instances values
[02:28:28] Radar: imbric: there's systems like activeadmin which are built for this exclusive purpose… BUT a lot of people use them and then come here and complain about it when it isn't as flexible as they wanted.
[02:28:54] Radar: I'm personally in favour of just building the whole thing myself, refactoring things into re-usable partials where I need, and then that way I know how it's built and it's not all Ruby magic.
[02:31:36] imbric: hmm. i see. I mean, I know right now that not *every* model will/should behave like this. But since most seem like they will, I didn't want to duplicate myself. I figured maybe there was a way to have the particular models' Blah#show actions point to some template/partial/helper that take the Object name as a parameter, then does this common loop over the attributes etc.
[02:31:45] imbric: I see your point though about building it yourself
[02:43:14] imbric: - thanks for your input Radar… I'm not around here too much, but I think I've seen you around before. so Thanks for being cool :)
[02:56:43] pothibo: active admin is a pain in the ass
[02:57:03] pothibo: the project is nice, but I wouldn't recommend it to anyone
[03:02:15] aharris6: any thoughts on how to use something like the following to get the current url (including paramters) in place of google url?
[03:02:16] aharris6: @short_url = bitly.shorten('http://www.google.com').short_url
[03:02:43] aharris6: I can use <%= request.url %> in the view, but doesnt seem to work in controller?
[03:04:33] helpa: aharris6: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[03:04:33] Radar: aharris6: !e
[03:04:46] Radar: aharris6: rather than saying it "doesn't seem to work" show us how it "doesn't seem to work"
[03:12:50] aharris6: Radar: thanks, here it is: https://gist.github.com/alexharris/5889544
[03:12:59] aharris6: error message is first, then description of issue below
[03:13:20] fulcan: if ruby on rails is port 3000, does passenger parse it to port 80?
[03:13:30] Radar: fulcan: no
[03:13:37] Radar: aharris6: what is on line 38 of that controller?
[03:14:28] Radar: aharris6: and why does it think the URL is 500?
[03:16:04] aharris6: line 38 is: @short_url = bitly.shorten(request.url).short_url
[03:16:20] aharris6: it works when i replace request.url with a static url
[03:16:32] aharris6: http://www.google.com, etc
[03:16:44] aharris6: but I want it to load the current url
[03:17:05] aharris6: not sure why it thinks the url is 500...I guess I thought that was an error code
[03:17:06] Radar: aharris6: what is request.url?
[03:17:13] Radar: aharris6: binding.pry up in that
[03:17:27] aharris6: what is binding.pry?
[03:17:38] aharris6: in the view, request.url prints out the current page url
[03:17:46] Radar: aharris6: Add gem 'pry' to your Gemfile
[03:17:48] Radar: bundle install
[03:17:56] Radar: then add binding.pry before you call bitly.shorten in your controller
[03:18:01] Radar: then make another request to the controller action
[03:18:13] Radar: Go back into terminal and now you have a real debugging session
[03:19:15] fulcan: whats the best tool to use for setting up a payment system with the gateway Stripe?
[03:19:27] Radar: fulcan: ActiveMerchant
[03:19:39] Radar: (the "ugh" was for you debugging stuff in the views… that's so PHP)
[03:19:49] aharris6: I guess another of asking this question is; why would <%= request.url %> work in the view, but request.url not work in the controller?
[03:19:56] Radar: aharris6: no idea.
[03:20:02] Radar: I can't see your app so I can't debug it.
[03:20:02] aharris6: hehe i come from php :) :(
[03:20:59] aharris6: i thought maybe some kind of simple syntax issue
[03:21:14] Radar: not that I am infinitely aware of
[03:32:03] aharris6: Radar: ok i am now debugging with pry in my terminal
[03:35:47] aharris6: so how can i use this to determine what is going on?
[03:36:48] Radar: aharris6: get it to output what request.url is
[03:37:00] Radar: you have access to the same things in that console as you normally would in the controller
[03:37:13] aharris6: i see. ok so request.url does actually have the value i would expect it to
[03:37:50] aharris6: so the @short_url is not getting set correctly, possibly because I am passing bitly.shorten the wrong number of arguments?
[03:38:14] Radar: aharris6: show me the entire controller action please
[03:39:46] Radar: aharris6: in the main channel is just fine
[03:39:49] aharris6: https://gist.github.com/alexharris/33c381fedbfb44ace1af
[03:40:02] Radar: aharris6: I've never used the bitly gem so I don't know the arguments that it takes.
[03:40:19] aharris6: seems to only require one
[03:40:35] aharris6: and bitly.shorten('http://www.google.com") seems to work fine
[03:40:52] aharris6: it is like it cant recognize request.url as being in the proper format or type or something
[03:41:16] Radar: well, what is request.url showing in the binding.pry session?
[03:42:14] aharris6: "http://localhost:3000/tweets/show?utf8=%E2%9C%93&username=alexharris6&term=dog&commit=Search"
[03:42:55] Radar: aharris6: and then bitly.shorten(request.url) gives you what output? Gist the entire output please.
[03:43:44] aharris6: https://gist.github.com/alexharris/e8153a9b9ade97a210a9
[03:44:17] Radar: I have no idea why it's calling get
[03:44:28] Radar: and is that really only outputting one line?
[03:45:11] aharris6: thats the entirety of the pry output, yeah
[03:46:56] Radar: irb(main):007:0> bitly.shorten("a")
[03:46:56] Radar: BitlyError: INVALID_LOGIN - '500'
[03:47:10] aharris6: hmmm...according to the bitly api, i might need to encode the url so it doesnt include #,$,? etc
[03:47:16] Radar: that could be right
[03:47:36] aharris6: which would explain simple google url working, long url with paramters not working
[03:52:59] ziggles: Can anyone identify what i've forgotten to do in order to allow for specific attributes to be POSTed? http://pastie.org/8093336
[03:53:43] s2013: No route matches [GET] "/users/sign_out" for devise.. its just a default devise installation.. rake routes show /users/sign_out
[03:56:25] s2013: k i got it. i ha to do devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
[03:56:30] s2013: which is weird because i never had to do that
[04:11:21] ziggles: Why does the default controller from scaffolding use `save!` instead of `save`? Why not throw an exception if things to south?
[04:19:13] micah`: ziggles: it defaults to `save`?
[04:19:24] ziggles: micah`: yep
[04:19:45] micah`: does it check the result of save?
[04:19:49] micah`: i haven't checked scaffolding in a while :S
[04:20:49] ziggles: micah`: Yeah i suppose it does. This is the generated output: http://pastie.org/8093372 (ignore the variable names lol)
[04:21:18] ziggles: micah`: i guess save w/o the bang will return false if it doesnt work and the else is supposed to deal with it
[04:21:33] micah`: yeah, so i think best practice is: raise an exception if you're not checking the result of the save call
[04:21:53] micah`: internally, #save! just checks the return value of #save and raises an exception when false
[04:22:22] micah`: and I *think* that exception raising is slightly more expensive
[04:22:25] ziggles: micah`: i see. Thinking about what you said... I guess that a save failing in a web app is not really an exceptional case either
[04:23:07] micah`: I've used #save! more often in background jobs where I need to signal the failure
[04:23:59] ziggles: micah`: I see... and i suppose if you were using something to comb through the logs that would be helpful than errors caused by erroneous user input etc
[04:24:02] ziggles: well maybe.
[04:24:26] micah`: well, in particular, the gem I use retries on exception
[04:25:02] micah`: I guess the thought would be: I've done everything I can to make this valid (not based on user input, for example) and it *should* always save
[04:25:08] micah`: a failure to do so is exceptional
[04:25:35] ziggles: That makes sense.
[04:26:09] micah`: ziggles: I was fairly certain RBP had thoughts on it too
[04:26:10] micah`: http://rails-bestpractices.com/posts/703-check-the-return-value-of-save-otherwise-use-save
[04:27:07] ziggles: micah`: oh man thank you for that!
[04:27:35] ziggles: micah`: I'm trying to use Form Objects and in my new class it's resposible for setting up a couple models, checking if they are valid, then saving...
[04:27:58] micah`: ah, awesome
[04:27:59] ziggles: i'm modeling it after a few blog posts i found + a railscast and it didn't make sense to me why people were using save! instead of save
[04:28:21] ziggles: after reading that tip, it totally makes sense... Validations are being checked first... and if they are valid... then save!
[04:28:33] micah`: and at that point, god help you if it fails :P
[04:28:46] micah`: and by god i mean `rescue`
[04:28:54] ziggles: micah`: well i've been watching Vikings lately and I'm starting to welcome death
[04:29:24] ziggles: micah`: what do you think of accepts_nested_attributes_for ?
[04:29:41] micah`: honestly? its bitten me so many times, i try not to use it
[04:29:46] micah`: but thats just me personally
[04:30:15] ziggles: micah`: yeah... that's why im messing with this form object stuff... i find it makes my views and life pretty confusing
[04:30:31] ziggles: I'm pretty much a noob so it's nice to hear im not alone in my dislike
[04:30:40] micah`: it leaks some http details into the persistence layer in a way that makes life hard
[04:31:08] micah`: great for prototyping. thats about as far as id use it though
[04:31:29] ziggles: micah`: what approach do you use instead?
[04:32:08] micah`: tough question, the answer to which slightly depends on the domain..
[04:32:18] micah`: but Form objects (or similar) are a great way to go imo
[04:32:45] ziggles: micah`: what are similar approaches to form objects? i'll make a note and read up later
[04:32:58] micah`: uncle bob gave a pretty good talk a month or two ago. one sec, ill get it for you
[04:33:32] ziggles: micah`: thanks
[04:33:59] micah`: ziggles: check it out http://www.confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
[04:34:27] ziggles: micah`: damn. This is a talk i started watching a long time ago and never finished.
[04:34:40] micah`: well, you're clearly looking in the right places
[04:35:01] micah`: at my current job, we model Interactions (kinda like form objects)
[04:35:17] micah`: that deal with one or more domain models for getting something done
[04:36:12] micah`: ziggles: did you happen to watch hexagonal rails?
[04:36:25] micah`: ziggles: http://confreaks.com/videos/977-goruco2012-hexagonal-rails
[04:37:04] banas: Why is this current_user=() method required? http://ruby.railstutorial.org/chapters/sign-in-sign-out#code-current_user_equals I find it very confusing :(
[04:37:12] ziggles: micah`: i have not seen that. but i will check it out
[04:37:41] ziggles: btw anyone who starts their talk with this kind of body language is a boss: http://i.imgur.com/HnLmzRx.png
[04:37:46] micah`: banas: lets talk through it then.
[04:37:58] micah`: lol ziggles
[04:38:27] banas: micah`: sure!
[04:38:28] micah`: banas: how would you go about achieving the same behavior?
[04:38:36] micah`: banas: or, perhaps the behavior is not quite clear?
[04:38:45] banas: Yes, exactly.
[04:39:03] banas: so I have signed in a user, and would like to store the token in a cookie - that's cool.
[04:39:21] banas: I understand until there, and also why making something like a current_user is helpful.
[04:40:10] micah`: so you're wondering why bother if we can just use the cookie we *just* set to find it again?
[04:40:37] micah`: banas: i'm skimming the guide to make sure im not leading you astray
[04:41:13] banas: Nope, that would mean doing the same thing redundantly. easier to find out who the user is one time, and store it until he is signed in
[04:41:19] banas: micah`: sure :)
[04:41:38] micah`: so, you've just answered the question then
[04:41:55] banas: micah`: Yes, but I don't really understand why it
[04:41:57] micah`: have #current_user= is valuable for the one case where we're setting the cookie and signing them in
[04:42:26] micah`: it's only because we *already* have the user record in memory; we can assign it to @current_user and short circuit the cookie-based lookup
[04:42:26] querymyquery: anyone have good free ebook recommendation for RoR best practices
[04:42:43] micah`: querymyquery: did you see the ruby-bestpractices link earlier?
[04:42:48] micah`: not quite a book
[04:43:11] banas: micah`: So in the sign in function, there;s this line #self.current_user = user
[04:43:31] micah`: doh, querymyquery: i mean rails best practices :S
[04:43:35] banas: If I just left it like that, what's wrong?
[04:43:37] micah`: querymyquery: you're looking for ruby ones?
[04:43:43] querymyquery: just looking for best practices and cookbook, i already know MVC and have been programming forever I just want a common usage cookbook + best practices
[04:44:03] micah`: querymyquery: although its been a while, I enjoyed The Well Grounded Rubyist
[04:44:19] micah`: if you want to get into depth with the language, I'd say Metaprogramming Ruby
[04:44:52] micah`: also would recommend Avid Grimm's developers notebook Objects on Rails
[04:45:15] pontiki_: <3 Metaprogramming Ruby
[04:45:17] micah`: banas: ok so just to step back a sec, there are two scenarios: a request to sign in, and all other requests
[04:45:25] banas: yes, true
[04:45:31] micah`: banas: you're good with all other requests, yes?
[04:45:37] micah`: no need for #current_user=
[04:45:48] banas: Yes, till there Im good I think
[04:45:53] micah`: ok, awesome
[04:46:00] micah`: so now lets talk about what happens during sign in
[04:46:10] micah`: i assume this sign_in(user) takes a User record
[04:46:42] micah`: so we've looked them up via credentials, and we have the ActiveRecord object in memory
[04:46:46] micah`: so far so good?
[04:47:15] micah`: pontiki_: woot :D
[04:47:24] micah`: banas: so lets pretend like there is no current_user=
[04:47:38] micah`: banas: we set a cookie for them, and the request continues. what happens next?
[04:47:53] pontiki_: micah`: best book on understanding how ruby works yet.
[04:48:16] banas: so now the cookie has a token, and so does a user in our dbase
[04:48:18] micah`: pontiki_: totally. i feel the need to reread it. the eigenclass diagram is getting fuzzy
[04:48:50] micah`: banas: and the controller continues on its way. let's say, hypothetically, you wanted to just render a view within that action, without the redirect
[04:49:13] micah`: and so we let the view call user.email to print it out (this is a horrible example, why would you do that! :P)
[04:49:18] pontiki_: the most amazing thing about the figures is the hand-drawn stuff -- it's like it is really immediate, and there, and even sort of imparts how ephemeral and changeable this all is
[04:49:42] banas: micah`: Wait, lemme think once. I didn't follow what you just said
[04:49:48] pontiki_: and it made me just go "squeee" with how lisp used to make me feel
[04:50:02] micah`: banas: better example.
[04:50:10] banas: okay cool shoot
[04:50:10] micah`: banas: lets say you do redirect_to current_user
[04:50:22] banas: yes, we want to go to his show page
[04:50:24] micah`: we're going to their profile, user/1
[04:50:32] micah`: so what happens inside of current_user
[04:50:43] banas: there is no current user yet
[04:50:46] banas: we havent defined
[04:50:51] micah`: so we check @current_user, he nil.
[04:50:59] micah`: so then we execute the other side of ||=
[04:51:05] micah`: now we're hitting the database with the cookie values we just set
[04:51:14] ziggles: micah`: gets a call mid presentation... Tells the audience who it is... doesnt give a shit... forgets where he's at... Audience tells him where he was...
[04:51:17] micah`: and loading up that very same user we just had in sign_in
[04:51:29] micah`: ziggles: *lol*
[04:51:47] micah`: banas: so now we've gone out to the (slow) database to get the user record again
[04:51:50] micah`: when we had him just a second ago
[04:52:05] banas: yep, micah` I understand why we are doing this.
[04:52:09] banas: I don't get the how.
[04:52:18] banas: lemme explain, one sec
[04:52:40] banas: there's this line in the sign_in method
[04:52:41] banas: self.current_user = user
[04:52:59] banas: which "is an assginment, so we need to write a function for it"
[04:53:10] banas: I didn't quite understand that
[04:53:19] Radar: def current_user=(value)
[04:53:42] Radar: "assignment" would be more accurately referred to as a "setter method" and
[04:53:47] Radar: "function" would be better written as "method"
[04:54:20] micah`: i see now, sorry banas
[04:54:37] banas: np, do you understand what I dont understand now? :p
[04:54:44] micah`: I do; do you follow Radar ?
[04:55:00] banas: Radar: Not completely. whats a setter method now?
[04:55:19] dsafsdf: whats the best way to associate user_id to a model without nested routes?
[04:55:21] Radar: banas: please read a book on Ruby first.
[04:55:28] micah`: as in "getting" and "setting" attributes
[04:55:33] Radar: banas: you're missing a lot of key knowledge
[04:55:38] micah`: banas: are you familiar with attr_reader and attr_writer?
[04:55:53] banas: micah`: Nope :(
[04:55:58] banas: Radar: Looks like it.
[04:55:59] micah`: dsafsdf: can you give some more context?
[04:56:16] dsafsdf: i have a model called question and another called user.
[04:56:28] dsafsdf: question belongs to used and user has many questions
[04:56:43] dsafsdf: used = user
[04:56:52] micah`: banas: trying searching around for attr_reader attr_writer and attr_accessor. something like this might help: http://www.rubyist.net/~slagell/ruby/accessors.html
[04:56:56] Radar: dsafsdf: current_user.questions.build
[04:57:03] helpa: banas: Learn Ruby by reading this book - http://manning.com/black2 - The Well-Grounded Rubyist by David A. Black
[04:57:03] Radar: banas: !twgr
[04:57:16] dsafsdf: so user has to be logged in to submit a question and when he submits aquestion i want it to be associated with him
[04:57:31] banas: Radar: Okay, but do I need to read all of it to get started with rails?
[04:57:40] dsafsdf: ive done it before but for some reason i am having a total brain fart
[04:57:45] banas: micah`: I'll do that now!
[04:57:46] micah`: gotcha; but you don't want to use nested routes?
[04:57:53] Radar: banas: You don't have to read through it all, but it would be an extremely great help.
[04:57:59] micah`: banas: let me know if you need some help; i think you might have a duh moment coming soon :)
[04:58:02] dsafsdf: banas you should be familiar with ruby before getting into rails since rails is a framework for ruby
[04:58:03] Radar: banas: Most of your questions that I've seen are actually basic ruby questions.
[04:58:11] Radar: dsafsdf: [14:56:56] <Radar> dsafsdf: current_user.questions.build
[04:58:24] dsafsdf: Radar, yeah i saw that.
[04:58:26] micah`: Radar: I think hes asking about routing designs
[04:58:33] banas: Radar: I see! GReat, I'll follow your advice.
[04:58:39] banas: micah`: Cool :D
[04:58:39] dsafsdf: that would be in the create method right?
[04:58:46] helpa: dsafsdf: Why don't you try it and find out for yourself?
[04:58:46] Radar: dsafsdf: !try
[05:00:00] banas: Radar: micah` : Duh moment indeed :D
[05:00:04] dsafsdf: https://gist.github.com/anonymous/348febebc480a85c014e does that look about right?
[05:00:26] Radar: dsafsdf: other than the indentation using tabs and not spaces, yess
[05:00:27] micah`: dsafsdf: yep
[05:00:50] dsafsdf: ok thanks let me check it.
[05:01:35] micah`: dsafsdf: out of curiosity, why do you want to avoid nested routes?
[05:02:25] dsafsdf: well because the questions can also be seen by everyone. the root is to questions#index
[05:02:56] banas: micah`: Radar I perfectly understand now :) Thanks for the tips! :)
[05:03:05] micah`: banas: huzzah! awesome
[05:03:31] micah`: dsafsdf: you could limit your routing for that purpose.. or use a separate controller?
[05:03:47] dsafsdf: yeah honestly i am not sure the best way of going about it
[05:04:20] Radar: Using the one controller is fine imo
[05:04:44] dsafsdf: Radar, is it ok the way im doing it?
[05:05:04] Radar: dsafsdf: so far, yes
[05:05:32] dsafsdf: another stupid question. i want it to redirect back to the question show page when its done creating. does it do that automatically?
[05:05:41] Radar: dsafsdf: no it does not
[05:05:48] dsafsdf: i tried adding redirect_to @question but i am not sure if thats the right way because it did not work
[05:05:49] Radar: dsafsdf: redirect_to @question will do that though
[05:05:56] Radar: dsafsdf: Why did it not work?
[05:07:35] dsafsdf: undefined method `question_url' for #<QuestionsController:0x417fa80>
[05:07:44] dsafsdf: for routes i just have resources :questions
[05:09:35] dsafsdf: any clue why that might be?
[05:10:19] Radar: dsafsdf: show us the output of rake routes please
[05:10:56] dsafsdf: https://gist.github.com/anonymous/66d2b78263fe8ba4f13d
[05:11:16] dsafsdf: i dont know if it has to do with the root being questions#index
[05:12:08] Radar: dsafsdf: show us config/rotues.rb please
[05:12:21] Radar: very weird that the show action does not have a routing helper defined for it at all
[05:12:50] dsafsdf: https://gist.github.com/anonymous/bfc40cf83d56648319bf
[05:13:14] Radar: dsafsdf: Why is the devise line all on one line?
[05:13:33] Radar: and what version of Rails is this?
[05:13:52] dsafsdf: i copied and pasted it from stackoverflow
[05:14:21] Radar: seems bad
[05:14:41] dsafsdf: one second im going to remove it and add method: :delete to sign out
[05:14:41] Radar: I would write it like this: https://gist.github.com/radar/5889914
[05:14:57] dsafsdf: yeah i changed it to that, same issue
[05:15:08] Radar: I don't know why your question_url helper isn't being defined.
[05:15:25] Radar: Can you start a new app and just add resources :questions to its routes file and run rake routes?
[05:15:38] dsafsdf: yeah one second
[05:16:20] Radar: This is what I get: https://gist.github.com/radar/5889914
[05:19:26] sush24: Hi, I'm coming from client side dev background.. I wanted to know how to implement split view in rails .. http://www.personal.psu.edu/jpf5067/CMPSC297A/iPhone/Images/TypesOfApplications-SplitView.png
[05:19:39] sush24: Clicking on objects on the left could probably fetch the right side using an API
[05:19:41] dsafsdf: https://gist.github.com/anonymous/e55b5bfb7bcc73448da7 Radar
[05:20:08] Radar: dsafsdf: still broken for you too
[05:20:11] Radar: dsafsdf: I have no idea why
[05:20:17] dsafsdf: thats so weird
[05:20:17] sush24: does http://apotomo.de/ fit the bill ?
[05:20:19] Radar: dsafsdf: what exact version of 3.2? Run bundle list.
[05:20:22] dsafsdf: i havent had this issue before ever
[05:22:08] Radar: That's the latest.
[05:22:14] Radar: I still have no idea what could be going wrong.
[05:22:19] Radar: Version of Ruby?
[05:22:24] dsafsdf: 1.9.3 i believe
[05:22:50] dsafsdf: can i just manually add it to the route for now?
[05:23:01] dsafsdf: but this is peculiar eh
[05:23:09] Radar: get "/questions/:id", :to => "questions#show", :as => "question"
[05:24:35] dsafsdf: do you think it could be a rails bug or its just that mine is messed up
[05:26:04] Solnse: any recommendation for a gem to scrape some data being served with in javascript? I used mechanize for my other needs, but using watir and webdriver are causing my server to timeout waiting for the results. anything faster?
[05:26:08] dsafsdf: k that works. thanks
[05:26:16] dsafsdf: Solnse, nokogiri?
[05:27:36] Solnse: I thiught that was just for parsing the results
[05:27:42] pontiki_: nokogiri doesn't do js
[05:27:43] dsafsdf: is there a shorthand to rename column in rails? like how you can do rails g migration add_blah_to_tables
[05:27:46] pontiki_: mechanize uses it
[05:28:19] pontiki_: Solnse: watir is the best i've seen for scraping stuff that's js driven
[05:28:38] pontiki_: maybe try it with the phantomjs headless driver?
[05:28:39] Solnse: no chance of finding anything faster eh? ok. thanks.
[05:28:42] pontiki_: might speed things up
[05:28:48] Solnse: yeah, I was using headless today
[05:28:54] Solnse: didn't make it any faster
[05:29:07] pontiki_: i know the headful (?) stuff is pretty dang slow
[05:29:47] pontiki_: what if you called the API directly?
[05:29:54] pontiki_: and then parsed what came back?
[05:30:01] Solnse: pretty sure there's no API for the sites I'm after
[05:30:15] pontiki_: there has to be something for the javascript to call to
[05:30:58] Solnse: e.g. Virgin America elevate balance.
[05:31:41] Radar: Solnse: Selenium Webdriver?
[05:32:09] pontiki_: that's what watir uses
[05:32:11] Solnse: Radar: I was using watir webdiver
[05:32:15] Solnse: same thing right?
[05:32:20] pontiki_: and it's def slower than phantomjs
[05:32:39] Radar: same thing but headless
[05:32:43] pontiki_: it may not be enough slower
[05:32:57] pontiki_: but my regression tests ran a lot faster
[05:33:07] Solnse: using mechanize, I'm able to pull results quickly, but can't use it on AJAX
[05:33:56] Solnse: I'm at the point of caching the results and only doing the call once a day... not my ideal solution.
[05:34:17] pontiki_: where is it timing out?
[05:34:50] Solnse: when_present ... waiting for the data to pupulate
[05:35:43] pontiki_: ok, so i ran into a problem with that at one point. my hackyhackhack solution was to pause for a second
[05:35:48] Solnse: when I run the method in irb, it takes abut 20 seconds... I increased my timeout delay on my server to 60, and still times out... no use increasing it any further
[05:39:28] pontiki_: The other thing i had to do was just use Watir::Wait.until(...)
[05:40:36] pontiki_: oh, hmm... you're using when_present? not wait_until_present?
[05:40:40] Solnse: isn't that the same as when_present ? or is it doing something different?
[05:41:21] pontiki_: Watir::Wait.until {} it's block returns true
[05:41:35] pontiki_: when_present the thing must already be there
[05:41:54] Solnse: I'll read up on it.
[05:41:58] Solnse: sound like a chance.
[05:42:16] Solnse: pontiki_: thanks
[05:42:23] Solnse: worth a try at this point
[05:42:23] pontiki_: i mean, it's *still* slow as a ever sometimes
[05:43:13] pontiki_: i'm assuming under regular browser, the data doesn't take over a minute to fill in...
[05:44:27] Solnse: strange thing is though that it *does* finish in about 20 seconds running from irb... but when I do a call to the api for it, timeout.
[05:44:58] Solnse: and I know it's all correct because I've checked the params, etc.
[05:45:51] Solnse: just not happy about the 20 seconds though anyway... trying to get it like another one I use mechanize for, less than 2 secodns.
[05:46:06] pontiki_: is it something i can look at?
[05:46:14] pontiki_: i don't know what "elevate balance" means
[05:47:27] Solnse: I actually don't have the code on this machine... and yeah, it's code from work, I'm investigating this and playing around with it so I know how to attack it Monday.
[05:48:14] Solnse: elevate is virgin america (airlines) frequent flyer program name.
[05:49:24] pontiki_: i thought it was something about increasing the balance of something
[05:49:47] pontiki_: i just thought if i could look i might be able to give more of a clue
[05:50:17] pontiki_: OTOH, how often could that balance change?
[05:50:23] pontiki_: maybe once a day is all it needs
[05:50:53] Solnse: probably not more than once a day, which is why I'm considering storing it, but... meh.
[05:51:22] pontiki_: even so, it'd be worth figuring out what's actually going on at some point, but if you're pressed for time on something, maybe later
[05:52:52] Solnse: yeah, the boss said something about pushing it next week, which is why I'm spending weekend time trying to find a better solution.
[06:01:20] Leighton: lewis: hey there
[06:01:29] lewis: Leighton:
[06:06:16] dsafsdf: can you use a controller for the view of a different controller?
[06:08:48] dsafsdf: does that make sense?
[06:10:08] Leighton: dsafsdf: you can just about do whatever, but there may be a better solution for you. What are you looking to do? Any example or can we see what you're working with?
[06:10:52] dsafsdf: Leighton, basically im making a simple quesiton & answer site so i have 2 models question and answer
[06:11:19] dsafsdf: so on the actual question page people can submit an answer
[06:11:46] dsafsdf: and the answer would appear on the question page and people can vote on the answer, etc. something similar to stackoverfllow
[06:13:27] Leighton: dsafsdf: answers belong to questions I'm assuming?
[06:13:35] dsafsdf: and questions has many answers
[06:14:09] dsafsdf: i can use jquery to load the view though
[06:14:14] dsafsdf: not sure if thats the right way of going about it
[06:14:38] Leighton: dsafsdf: this may be what you're looking for http://stackoverflow.com/a/7949127/827271
[06:16:13] dsafsdf: i figured osmethign like that but im a bit confused about it
[06:16:23] dsafsdf: so comments_controller = answers i got that
[06:16:26] dsafsdf: but which form are they talking about?
[06:16:45] dsafsdf: the one in my question view?
[06:17:15] dsafsdf: it would still go to the create action for the answers? actually let me try it
[06:17:42] dsafsdf: but if they are doing remote true that means i need to respond via js right?
[06:19:12] dsafsdf: oh also i need to keep track of the user submitting the answer
[06:19:19] dsafsdf: so do i need to pass user_id via hidden field?
[06:19:25] dsafsdf: or is there way to do it via the controller
[06:19:43] romdi`: you read the current user from the session
[06:19:55] romdi`: otherwise someone can spoof a user id and stubmit for someone else
[06:19:57] dsafsdf: yeah i understood that part
[06:20:22] micah`: romdi`: or just authorize that the user is allowed to submit for that ID
[06:20:23] dsafsdf: so id pass the user_id via the params right?
[06:21:00] romdi`: micah`: if you use a hidden field someone can just change the id. whether he's authorized or not, he can still submit for someone else.
[06:21:23] dsafsdf: so where do i put the user id? i know how to get the user id
[06:21:44] micah`: romdi`: true, but before saving it as someone else, authorize that the current_user is the same as the hidden field
[06:21:45] dsafsdf: just dont know how to save it unless i put that in the controller like
[06:22:04] micah`: dsafsdf: two options: nested routes (POST /user/1/questions)
[06:22:13] romdi`: when the user logs in you save the info in the session on the server side. then in the create controller you retrieve the info and set it in the object before saving it
[06:22:19] micah`: dsafsdf: or query param (POST /questions?user_id=1)
[06:22:21] dsafsdf: @question.aswer.user_id = current_user.id
[06:22:22] romdi`: create action that is
[06:22:39] dsafsdf: like that romdi` ?
[06:22:52] romdi`: or just @question.answer.user = current_user
[06:23:30] micah`: dsafsdf: you're still using current_user.questions.build, right?
[06:23:38] dsafsdf: https://gist.github.com/anonymous/46589d54a624a6d85c70
[06:23:41] dsafsdf: thats how i have it
[06:23:55] dsafsdf: then ill do if @answer.save etc
[06:25:45] macmartine: dsafsdf: just joined, missed the question/problem, but i'd do @answer.user = current_user
[06:27:09] dsafsdf: basically im making a simple q&a site and the answer and question are 2 different models but you can answer directly from the question page
[06:28:06] romdi`: dsafsdf: something like this: https://gist.github.com/romdi/b310f4de6e48a9b49ccf
[06:30:39] dsafsdf: so id do <%= simple_form_for [@question, @answer] do |f| %> on question/show right?
[06:30:54] dsafsdf: do i need to declare what @answer is in question controller?
[06:31:45] macmartine: you already do, assuming that's what asfd.rb is
[06:31:57] dsafsdf: thats the answer controller
[06:34:22] dsafsdf: i did @answer = Answer.new in questions#show
[06:34:29] dsafsdf: because i got the modelname nil error
[06:36:29] dsafsdf: https://gist.github.com/anonymous/105030fda8d40264599a
[06:37:23] romdi`: dsafsdf: read my gist again
[06:38:42] dsafsdf: undefined method `question_answers_path' for #<#<Class:0x41cb2f0>:0x399b640>
[06:38:50] dsafsdf: im guessing its the same issue i had earlier with show
[06:39:20] dsafsdf: https://gist.github.com/anonymous/b0ef8ff18f5428b53483 my routes
[06:40:54] dsafsdf: any clue romdi` ?
[06:43:49] micah`: dsafsdf: line 5 of your routes #resource intentionally?
[06:44:05] dsafsdf: the get/questions one?
[06:44:47] micah`: if you rake routes, i'd be willing to wager you'll see questions_answers_path
[06:47:45] dsafsdf: cant believe i didnt catch it wow. not even radar either
[06:48:26] mdedetrich: How can you run another validation inside validate_each?
[06:51:58] dsafsdf: k now im getting an issue with setting the use rid
[06:52:06] dsafsdf: undefined method `user=' for #<Answer:0x41c4480>
[06:53:45] micah`: what does Answer look like?
[06:57:11] micah`: dsafsdf: ^
[06:58:24] dsafsdf: what do you mean micah` ?
[06:58:55] micah`: dsafsdf: your answer class; is it set up with an association to user?
[07:00:14] dsafsdf: k i set up the correct associatio now
[07:02:31] micah`: gotta run, good luck
[07:05:22] dsafsdf: thanks man take care
[07:13:36] Leighton: dsafsdf: did that end up working with the proper association?
[07:13:50] dsafsdf: yeah it did. thanks. if i want to find all the answer that belongs to the question
[07:13:53] dsafsdf: i should do join right?
[07:14:13] dsafsdf: Answer.join(:question) ?
[07:18:18] Leighton: dsafsdf: depending on the relation you can probably just chain it, something like @question.answers and so on
[07:51:29] dimaursu16: if I change the path of my views (physically, I move "tasks" views under "users" view, what should I change so Rails will look at the right location for them?
[07:55:48] rushed: dimaursu16: path meaning url or full filename of the partial? maybe provide a specific example of what's not working for you
[07:57:18] dimaursu16: when I access this http://localhost:2000/users/tasks
[07:57:24] dimaursu16: it says template missing
[07:57:46] dimaursu16: I've modified in routes.rb to have resource :users do resource :tasks end
[07:58:21] dimaursu16: it was working fine, when the path to task views was app/views/tasks
[07:58:41] rushed: dimaursu16: port 2000? users/tasks? are you sure that's the url
[07:58:42] dimaursu16: now is app/views/users/tasks and it can't find them
[07:59:10] dimaursu16: rushed: yes, i'm very sure. I've started rails with rails s -p 2000
[07:59:23] dimaursu16: on 3000 I have another rails app
[07:59:56] dimaursu16: the thing is that i've mostly written tests for rails apps, and I have some huge gaps in knowledge....
[08:00:20] dimaursu16: now I've started an application from scratch, to find out what I don't know yet...
[08:01:24] rushed: dimaursu16: users/tasks is potentially not conventional, I would expect to see users/2/tasks for tasks related to a specific user, that said, if your tasks controller is handling the request by default it's going to be looking for views in app/views/tasks (i.e. there is no need to move the actual view files just because you nested the routes
[08:12:46] dsafsdf: anyone here?
[08:18:51] dimaursu16: rushed: yes, you are right, I would want to see users/:id/tasks
[08:19:03] dimaursu16: but my routes aren't like that
[08:31:16] Leighton: dsafsdf: what's up?
[08:31:23] dsafsdf: hey where are you Leighton ?
[08:31:39] Leighton: dsafsdf: haha, I'm at my computer : )
[08:31:41] dsafsdf: are you in the us? cause its late
[08:31:45] dsafsdf: thats hwy i was wondering
[08:31:53] Leighton: dsafsdf: heh, yeah, in phoenix
[08:31:58] dsafsdf: wasnt it like 120 today
[08:32:42] Leighton: dsafsdf: yeah that's why I didn't go anywhere. Stuff was catching on fire around town
[08:32:59] dsafsdf: crazy. it was 88 here and i was dying
[08:33:09] Leighton: dsafsdf: where are you?
[08:33:51] Leighton: dsafsdf: cool, I used to live in ny state and boston, it's a bit more humid there
[08:34:41] dsafsdf: anyways, i am trying to make a simple upvote/downvote
[08:34:44] dsafsdf: for each answer
[08:35:11] Leighton: dsafsdf: oh man, so many ways to approach that. What do you have so far?
[08:37:29] dsafsdf: let me show you
[08:37:33] dsafsdf: its kind of primitive i think
[08:38:49] dsafsdf: https://gist.github.com/anonymous/a46f0a2636819dc52911
[08:39:17] dsafsdf: ideally id just like to have an upvote/downvote button but for now the +/- can work just to test it
[08:43:12] Radar: <clippy> It looks like you're trying to re-create Stack Overflow, would you like help? </clippy>
[08:43:54] dsafsdf: yeah im just doing this as a practice
[08:44:20] dsafsdf: also Radar we figured out what the issue was with the show action
[08:44:57] Radar: [15:07:44] <dsafsdf> for routes i just have resources :questions
[08:45:01] Radar: So you lied to me
[08:45:13] Radar: ACTION is hurt
[08:45:18] dsafsdf: not lied. it was a typo. i didnt realize it cause i wrote resources for the other routes
[08:45:25] dsafsdf: typo on the actual routes
[08:45:41] dsafsdf: but i also posted my routes on gist i believe but meh. just a simple thing
[08:45:47] Radar: [15:15:24] <Radar> Can you start a new app and just add resources :questions to its routes file and run rake routes?
[08:45:57] Radar: And you didn't follow instructions
[08:46:01] Radar: ACTION goes to bed and cries into pillow
[08:46:10] dsafsdf: yeah i had a major brain fart
[08:46:32] dsafsdf: Leighton, any idea on how to save the score? @score.save wont work
[08:47:12] Radar: What is score?
[08:47:13] Leighton: dsafsdf: I'd consider rethinking the logic behind that- it looks like this method will allow me to just spam the vote button
[08:47:20] Radar: *What even is score?
[08:47:29] dsafsdf: yeah like i said its very primitive
[08:47:39] dsafsdf: how would you approach it?
[08:47:54] dsafsdf: score is total amount of net votes
[08:48:08] Radar: y u no use gem
[08:48:10] dsafsdf: so + = 1 - = -1
[08:48:11] Radar: there has to be a gem for this
[08:48:18] dsafsdf: im sure, but i rather learn how to do it
[08:48:20] Radar: https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=voting
[08:48:21] Leighton: Radar: there is, I just found one actually
[08:48:31] Radar: Leighton: I just found > 10
[08:48:49] Radar: dsafsdf: Show us how @answer.score is being defined.
[08:50:38] dsafsdf: what do you mean?
[08:50:45] dsafsdf: it returns the correct score
[08:52:45] Radar: the method
[08:52:50] Radar: Show us the method definition of score.
[08:52:59] Radar: We don't know what your Answer model looks like at all because you've not shown us it.
[08:53:04] dsafsdf: nevermind i got it to work but its very easy to manipulate and game
[08:53:30] dsafsdf: https://gist.github.com/anonymous/22cd375f6600591252b9
[08:53:47] Radar: score is an attribute then
[08:53:49] dsafsdf: if @answer.update_attributes(score: @score+1) i used that. and it works it updates the score but yeah
[08:54:40] Radar: dsafsdf: https://gist.github.com/radar/5890435
[08:55:53] dsafsdf: hmm that doesnt work
[08:55:57] dsafsdf: its not updating the score
[08:56:00] tbuehlmann: that won't save
[08:56:16] tbuehlmann: it just increments
[08:56:17] Radar: oh, increment!
[08:57:01] sevenseacat: something like SO would actually be quite easy to write, I think
[08:57:06] Radar: HAHAHAHAHAHAHA no.
[08:57:15] Radar: The basic implementation, yes. Everything else, no.
[08:57:22] sevenseacat: thats what I meant.
[08:57:33] Radar: It's way more than just Q+A. You have reputation limits, badges, graphs, tags, etc.
[08:57:44] Radar: Moderation tools which KEEP ON CHANGING
[08:57:53] dsafsdf: Radar, so do i need to do answer.save ?
[08:58:07] sevenseacat: it would be a fun exercise
[08:58:07] Radar: dsafsdf: no
[08:58:13] Radar: dsafsdf: answer.increment!(:score)
[08:58:13] dsafsdf: it works but anyways what would be the best way to do vote
[08:58:15] Radar: dsafsdf: I missed the !
[08:58:19] helpa: dsafsdf: "Best" and "better" are subjective. Try to use a different term.
[08:58:19] Radar: dsafsdf: !best
[08:58:54] dsafsdf: well im sure eveyr other implementation would be better since its very easy to game it
[09:00:50] Radar: You could track the votes for a user in a votes table
[09:00:56] Radar: track what user voted on what… thing
[09:01:03] dsafsdf: well yeah i would do that
[09:01:06] Radar: (because questions AND answers could be voted on too)
[09:01:13] dsafsdf: yeah questions would be voted too
[09:01:23] dsafsdf: tomorrow ill work on the vote tracking but is there anything else i can improve upon in the short term?
[09:01:58] Radar: ACTION explodes
[09:02:07] Leighton: dsafsdf: you killed him : (
[09:02:11] Radar: "Tomorrow i will work on the vote tracking… how can I improve on the vote tracking?"
[09:02:22] Radar: non-sequiturs make my head hurt
[09:02:51] dsafsdf: no what i meant was ill work on tracking who voted what, but without doing that is there anyway to improve what i have done so far with the voting.
[09:03:16] dsafsdf: cause right now it shows the answer id whe you hover over the vote link
[09:04:14] Leighton: dsafsdf: if you're staying away from gems I'd pull out that score bit and use a proper vote table, and then you can check and only let people vote once, stuff like that
[09:05:10] dsafsdf: yeah i will definitely do the voting table. another quick question, how do i check if they voted + or - ? should i pass a second parameter to the path?
[09:07:14] Radar: dsafsdf: yes
[09:07:35] Radar: dsafsdf: How are your vote links being rendered?
[09:08:27] dsafsdf: for now im just using a simple link
[09:08:33] dsafsdf: <%= link_to "+", score_path(ans.id), remote: true %> | <%= link_to "-", score_path(ans.id), remote: true %>
[09:09:08] dsafsdf: problem is the url shows when you hover over the + or the -
[09:09:55] paul--: Thats how the internet works.. :)
[09:10:32] dsafsdf: yeah but on sites like reddit/so etc you dont see the link
[09:10:41] sevenseacat: because theyre not links
[09:11:14] paul--: ^ If you look at reddit you'll see they're actually divs with javascript onclick events
[09:12:38] nobitanobi: Uhggg. Passing an empty nested attributes like {"trip":{"average_speed":0, "events_attributes":[]}}, gets converted to events_attributes:nil, and hangs with "ArgumentError (Hash or Array expected, got NilClass (nil)):"
[09:14:01] dsafsdf: can i do that in rails using remote true or would i have to do the ajax manually?
[09:14:49] Radar: dsafsdf: Turning the upvote/downvote things into non-links and using some custom JS would probably solve your problem, yes.
[09:15:09] dsafsdf: for now ill leave it as links
[09:15:13] rushed: dsafsdf: you might find a working example helpful http://railscasts.com/episodes/364-active-record-reputation-system
[09:20:21] dsafsdf: i added remote: true and created a file called score.js.erb but i get an error https://gist.github.com/anonymous/5a7f03dda361c22f5549
[09:20:33] dsafsdf: GET http://localhost:3000/score/6 500 (Internal Server Error)
[09:22:02] Radar: look in console
[09:22:15] Radar: As in, the place where the rails server is running
[09:25:15] dsafsdf: ok it was the @score + 1 so i added var score = @score then did .text(score + 1) and now i dont get any errors but nothing happens. i removed that line an dmade it so the score only fades out, that doesnt work either
[09:25:20] dsafsdf: in both console i dont get any error messages
[09:25:42] rushed: dsafsdf: making a lot of use of that working example aren't you :)
[09:26:10] dsafsdf: rushed, that one uses a gem. im trying to just learn the basics first before going into a gem
[09:26:37] certainty: implement it yourself then throw it away in order to use a gem
[09:26:41] rushed: dsafsdf: actually, it presents both a gem, and building it from scratch :)
[09:27:33] sevenseacat: well if youre not familiar with the basics of rails, yes its a good idea to learn that before rushing into using gems
[09:27:41] dsafsdf: oh ok let me watch the video then
[09:29:08] rushed: dsafsdf: it doesn't cover basics though, if you're looking for something more "from scratch" you might find this helpful http://railsforzombies.org
[09:29:43] dsafsdf: rails for zombies is ok. im actualy having an issue with jquery now i think
[09:30:08] sevenseacat: you think so?
[09:30:39] dsafsdf: i dont know. maybe i am. but its not even outputting to the console so i dont know if its jquery or rails
[09:34:29] certainty: it's saturday morning and you guys are working. Crazy bunch!
[09:34:54] certainty: ACTION never heared of timezones
[09:35:24] sevenseacat: saturday afternoon and im watching football after a hard day of car buying.
[09:36:04] Leighton: sevenseacat: ooohhh did you get a new car?
[09:36:13] waseem_: sevenseacat: Which one did you buy?
[09:36:17] sevenseacat: i did. shiny shiny.
[09:36:39] dsafsdf: holden commodore
[09:36:44] Radar: certainty: saturday night actually
[09:37:00] sevenseacat: dsafsdf: yep.
[09:37:34] waseem_: sevenseacat: That's a really nice car.
[09:40:01] certainty: night? even worse! you're supposed the get laid
[09:40:22] Leighton: sevenseacat: very nice!
[09:41:18] sevenseacat: http://images.cobaltgroup.com/VisualJazz/HOLCOMS61236MJW2012A/jv/1236927188072x640.jpg
[09:44:33] Leighton: sevenseacat: is it that color as well?
[09:44:56] Leighton: I'm envious, looks great
[09:46:07] dsafsdf: thhank the lord I got it to work
[09:46:20] dsafsdf: Leighton, its the pontiac gto
[09:46:28] dsafsdf: its a fun car to drive though
[09:46:53] Leighton: dsafsdf: they're the same car by a different name?
[09:47:05] dsafsdf: holden is australian GM
[09:47:11] dsafsdf: basically rebranded GM
[09:48:24] rushed: neg, W9 is Aussy GM~
[09:51:02] rushed: dsafsdf: ɟpsɟɐsp
[10:12:15] ysk: After 3years php programming, i am really excited and loving ruby on rails now.
[10:12:39] ysk: Anybody here, who can give part time based projects?
[10:16:33] rushed: ysk: you're probably not going to have much luck finding work in this channel (nothing to do with you, just not really the venue)… leading with php is likely reducing what chance there was to begin with :)
[10:18:42] ysk: rushed: I am already finish with php.There is two reason why i'm looking for part time based projects is, i want to be engaged with more ruby on rails projects and learn more n more as much as possible and the other one you might no. :)
[10:20:14] Leighton: ysk: part-time implies paid though, and most of us here live on rails jobs : ) it's a great place for help and to help, learning, but not so much for finding work
[10:20:19] rushed: ysk: I give up, what's the other one? :)
[10:20:53] ysk: rushed: Ofcourse you know. :)
[10:21:28] rushed: can't tell if trolling or lost in translation~
[10:21:29] ysk: Leighton: You are right, and i'm also love to contribute to opensource.
[10:22:20] ysk: Leighton: Any place i can be engaged with ror projects and ofcourse can have a little extra income?
[10:23:15] ysk: rushed: Do you know any better place?
[10:24:20] rushed: ysk: you could google "asp.net mvc jobs" :P
[10:24:20] Leighton: ysk: you're always welcome to contribute to open source projects on github, even if they don't accept. Honestly I'd check in your own community to start, most people care less about the language and framework, but rather that it works and meets their needs
[10:24:46] ysk: rushed: Ha! :)
[10:25:40] ysk: Leighton: Can you give me any one project to which i can contribute?
[10:25:46] ysk: I mean any major opensource project?
[10:25:48] ysk: Any link?
[11:02:36] goodgame: hi =) people told me that it was not that useful to buy a rails book, but more to buy a book about ruby. what do you think about this?
[11:03:23] rushed: goodgame: you can get started right away http://railsforzombies.org
[11:04:03] rushed: goodgame: should give you an idea if you need help with the ruby or are ready to jump into rails specific material
[11:04:32] goodgame: yes i've read about this website, that's screencasts right? but I was thinking of buying a book, for the moment I'm not with my laptop, or to have some written notes
[11:06:42] ysk: goodgame: rushed is right, railsforzombies is great.
[11:07:02] rushed: goodgame: regardless of what material you select you should probably plan to be in front of your machine trying things out or it's less likely to stick, (of course you know best how you learn so maybe you're the one guy who does it best offline with a book) :)
[11:08:12] goodgame: yes sure, it's always best in front of your pc, but sometimes I also need to have a documentation, and online it happens all the time that i say "I've seed the answer for this problem, but I can't figure out where"
[11:37:58] goodgame: what do you think about http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0 ?
[11:39:03] sevenseacat: its the original ruby reference book.
[11:41:31] goodgame: and this one Agile web development with rails
[11:42:16] sevenseacat: definitely not.
[11:42:44] goodgame: sevenseacat: why?
[11:43:05] sevenseacat: because its not a good introduction to rails.
[11:43:15] helpa: 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
[11:43:27] sevenseacat: try that one.
[11:44:04] goodgame: ok, so i'll have to do it with rails 4?
[11:44:24] sevenseacat: what are you learning?
[11:44:32] dsafsdf: in my config\environment.rb i set ENV['api_key'] = 'apikeys' i should be able to access that from anywhere in the paplication by calling ENV['api_key'] right?
[11:44:47] sevenseacat: may as well start with rails 4 - if you want rails 3, get rails 3 in action (same site)
[11:45:38] goodgame: sevenseacat: the thing is that I'd like to learn rails, but I think it might be usefull to get a book on ruby, and to learn rails stuff on internet
[11:46:03] sevenseacat: so dont get any rails books, get ruby books
[11:46:05] helpa: Learn Ruby by reading this book - http://manning.com/black2 - The Well-Grounded Rubyist by David A. Black
[11:47:10] goodgame: and why not the "original ruby book reference"?
[11:47:31] sevenseacat: either is good.
[11:50:18] pghale: could someone show me an example of how to subclass FormBuilder to add new field types in rails 4 ?
[11:50:28] goodgame: just a last question sevenseacat are this 2 books a little bit outdated? because they were released in 2009
[11:50:56] pghale: i've read http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html but looking for an example which does more than just wrap an existing test field in a content tag
[11:51:16] goodgame: sevenseacat: the well grounded rubyist and the pragmatic book
[11:51:57] sevenseacat: the pickaxe re-release that you linked me to says it came out a week ago
[11:52:16] sevenseacat: the well grounded rubyist is older, yes
[11:52:18] rushed: pghale: SimpleForm has some example custom inputs if I recall correctly
[11:53:17] pghale: great, thanks
[11:53:25] goodgame: but for 1.9 it's ok right?
[11:53:40] rushed: goodgame: you might find this useful http://sivers.org/kimo
[11:53:57] sevenseacat: goodgame: did you read the page i linked you to?
[11:54:01] pghale: ( attempting to make jquery_datepicker work with rails 4 https://github.com/albertopq/jquery_datepicker/pull/39 )
[11:54:05] sevenseacat: reading comprehension is important in ruby.
[11:54:16] goodgame: rushed: i'll read it
[11:54:37] goodgame: sevenseacat: yes sorry, fast/dumb question
[11:56:33] goodgame: time for a nap; thanks for advices, it helps a lot
[11:56:39] goodgame: good day ahead
[12:01:16] WindSong: Hey guys can you give me lil advice. I am new one in Ruby world and try to run Ruby2.0 + Rails 4.0 but can't becouse have got some sqlite3 problem.
[12:01:44] WindSong: I fooking for solution in internet but still can't fix
[12:02:27] Leighton: WindSong: what seems to be the problem?
[12:02:47] sevenseacat: i was waiting for him to tell us
[12:03:47] WindSong: Just a min pls I made log
[12:04:33] WindSong: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
[12:04:41] WindSong: It is my error
[12:04:44] Leighton: sevenseacat: sometimes I get impatient : )
[12:05:07] sevenseacat: Leighton: i don't. if they don't tell us the problem, i can just ignore them.
[12:05:16] sevenseacat: WindSong: did you do what the error says?
[12:05:31] WindSong: 127.0.0.1:3000
[12:05:49] WindSong: i instal ruby than instal rails and start server
[12:07:22] WindSong: http://pastebin.com/XHFP8t1c
[12:08:01] Leighton: WindSong: the error is suggesting that you are specifying sqlite3 for your database, but it's not loaded. Adding the sqlite3 gem may fix this, have you done that?
[12:08:26] WindSong: I had an error whn try to install sqlite3
[12:08:39] WindSong: And can't understand why
[12:09:31] Leighton: WindSong: how did you try to install sqlite3 and what was the error?
[12:09:31] rushed: WindSong: if you're going to spend any amount of time with Rails you're probably going to want to use a vm (or a tool like vagrant that will manage a vm for you), dual boot, or a mac
[12:10:49] WindSong: rushed: Windows for ruby is bad?
[12:11:08] Leighton: WindSong: yes
[12:11:09] WindSong: Leighton: gem install sqlite3
[12:11:45] Leighton: WindSong: I tried windows and rails for a while and it's just bad news all day, very little support
[12:12:21] WindSong: Error installing sqlite3: The sqlite3 native gem requieres installed build tools
[12:14:38] WindSong: And if i have dev kit i have got other error
[12:16:44] Leighton: WindSong: it's probably not the answer you want, but from here on out I'd work on a vm or a partition. This kind of thing will continue pretty much endlessly
[12:17:27] WindSong: http://s13.postimg.org/uqmwido5z/erorr.png
[12:17:34] WindSong: It is my error
[12:17:48] WindSong: I will try to install some linux to VM
[12:18:02] WindSong: but not sure it will fix my proble,
[12:18:57] pghale: it will :)
[12:19:25] WindSong: ok I'll try an and will back/ Thanks guys )
[12:36:58] Leighton: dsafsdf: hey there lol
[12:37:17] sevenseacat: nope, no-one here.
[12:37:19] dsafsdf: how come you are still up
[12:37:43] sevenseacat: in this channel: people who dont get timezones
[12:38:25] apeiros: "people who don't get timezones" and "programmers" sadly has a large intersection
[12:38:38] Leighton: dsafsdf: it's always silly to ask why I'm still awake
[12:38:48] dsafsdf: sevenseacat, do you know his timezone? i do
[12:39:07] Leighton: dsafsdf: no no, it's 5:37
[12:39:18] sevenseacat: guess you don't :p
[12:39:22] dsafsdf: meh close enough. i thought az was mountain
[12:39:30] Leighton: it's not even 100f outside, still night : )
[12:39:30] slash_nick: you're all wrong it's ... complicated
[12:39:58] sevenseacat: there's tennis to watch. sif sleep.
[12:40:10] dsafsdf: anyways, so im trying to process the question title and if it ontains certain word i want to set some conditions true in the database
[12:40:17] dsafsdf: does tha tmake sense Leighton?
[12:40:45] Leighton: dsafsdf: this sounds like a regex nightmare lol
[12:41:02] dsafsdf: no i got the ruby part down. its very basic
[12:41:06] Leighton: dsafsdf: what's the end goal you're looking for here?
[12:42:01] dsafsdf: so ideally id need to do the check in create method right and then make a private function that sets the information in the db?
[12:42:48] sevenseacat: you could do it at the model level or the controller level
[12:43:13] sevenseacat: model level would probably be better
[12:43:16] apeiros: sounds like a job for before_save
[12:43:39] apeiros: alternatively override question_title=
[12:43:42] dsafsdf: oh yeah thats true
[12:43:59] dsafsdf: this is how i did it, and it apparently worked one second let me paste it
[12:44:58] dsafsdf: https://gist.github.com/anonymous/d12b291e4d142bf08829
[12:45:03] slash_nick: the world didn't explode
[12:46:22] apeiros: it didn't?
[12:46:34] slash_nick: might should've
[12:46:40] sevenseacat: schroedinger's world
[12:46:56] apeiros: dsafsdf: ruby is usually 2 space indent, not tab
[12:47:46] apeiros: sevenseacat: stop trying to observe whether it exploded or not!
[12:47:52] dsafsdf: apeiros, yes i know. i got a new laptop so i forgot to change the config, i changed it so it works fine on the other files just this one is a bit messe dup
[12:48:26] slash_nick: !(@question.question.downcase.scan(/\w+/) & ["play", "like", "similar"]).empty?
[12:48:49] sevenseacat: so.... whats the problem?
[12:49:16] slash_nick: why and with a constant? ["play", "like", "similar"] will always return truthy
[12:49:46] dsafsdf: slash_nick, what do you mean?
[12:50:01] dsafsdf: the problem is im not sure if thats the proper way to do it
[12:51:14] slash_nick: dsafsdf: I'm saying that one of your conditions will ALWAYS return true
[12:52:00] sevenseacat: i'd just regex for like "similar to (.+)?"
[12:52:49] sevenseacat: in a before_save callback
[12:54:25] xavier23: HI….anybody know, why when i change application.scss file, the changes don't feed through to my rails app
[12:54:48] sevenseacat: xavier23: without any more information, they should.
[12:55:04] xavier23: sevenseacat: they don't.
[12:55:07] Leighton: xavier23: did you change something recently?
[12:55:12] sevenseacat: cool. provide more information.
[12:55:58] jamespants: I made this middleware the other day to join my HTML output into a single line like Google does (just for fun) -- https://github.com/jp1988/Test/blob/master/README.md -- but does anyone know it seems to try to process my external CSS and JS files as well?
[12:56:37] sevenseacat: jamespants: because you're not limiting the type of requests it applies to? just guessing
[12:56:44] sevenseacat: (i know nothing about middleware)
[12:58:05] xavier23: sevenseacat: what information do you need? I'm on dev environment, using sass. I add a new div `userbar` , it doesn't show up http://pastie.org/8094360
[12:58:15] rushed: jamespants: that seems like a terrible idea :P
[12:58:39] sevenseacat: have you previously precompiled your assets?
[12:58:59] jamespants: sevenseacat: you could be onto something!
[12:59:50] jamespants: sevenseacat: yes, note that this problem only exists in development as in production my assets are treated separately.
[13:00:23] jamespants: rushed: but it's the crown of my work!
[13:00:28] sevenseacat: jamespants: in production, your assets would be precompiled therefore requesting them would not hit your rails server and trigger your middleware.
[13:00:30] rushed: xavier23: can you find the div in dev tools, does chrome thing the styles are on it? (perhaps it is not visible for some other reason)
[13:00:33] xavier23: sevenseacat: i don't think this is required for `dev` environment? correct me if i'm wrong ..
[13:00:43] sevenseacat: xavier23: its not, thats why i asked.
[13:00:46] jamespants: sevenseacat: yep thats right
[13:00:55] rushed: jamespants: :(
[13:01:31] jamespants: i tried to skip html joining if the ENV['REQUEST_URI'].match(/\.(js|json|css|)^$/) but no deal
[13:01:40] sevenseacat: xavier23: what do your logs for requesting the css say?
[13:02:19] sevenseacat: xavier23: have you verified by looking at the generated css that your styles are not there?
[13:03:49] rushed: jamespants: why are you working so hard to run string replacements on all our output?
[13:04:23] rushed: lol "our"… clearly I'm afraid you're going to come install that middleware on my apps ><
[13:04:23] xavier23: rushed: i looked at `/assets/application.css?body=1` … it's definitely not there
[13:05:27] jamespants: rushed: haha
[13:07:33] xavier23: sevenseacat: it's not in application.css - is there somewhere else i should be looking
[13:08:04] sevenseacat: (21:01:37) sevenseacat: xavier23: what do your logs for requesting the css say?
[13:14:30] lessless: is there anything like breezejs but native to rails ?
[13:15:54] xavier23: sevenseacat: http://vpaste.net/AZkiZ ……. and I put `Rails.logger.level = 0` to `environment.rb` and restarted server
[13:16:18] sevenseacat: wheres the rest of it?
[13:19:49] xavier23: sevenseacat: http://vpaste.net/oYsCa
[13:20:29] jamespants: should "if ENV['REQUEST_URI'].match(/\.(js|json|css|)^$/)" have a question mark at the end of it?
[13:36:17] boytoy: Hi, what do you guys think of my Tor IP blocker for Rails vs the Nginx one? https://gist.github.com/kakekake89/5888836
[13:38:13] elaptics: boytoy: I'd have thought you'd be better to do blocks at the firewall or web server level rather than at the application level
[13:38:36] elaptics: boytoy: better not to hit rails at all
[13:39:33] scyllinice: Yeah. You could eat up a ton of memory every request doing it that way
[13:39:44] Leighton: boytoy: goodness, a blacklist for tor seems horribly diluted. I'd argue your server should stand regardless of source traffic
[13:39:45] scyllinice: Depends on the amount of ips
[13:39:50] WindSong: Hey again. Installed linux but now it even worth
[13:39:57] WindSong: Rails don't install at all
[13:40:01] Leighton: WindSong: lol nah it just seems worse now but it's not
[13:40:56] scyllinice: "It doesn't work" is the best info for support ever
[13:42:13] WindSong: https://pastee.org/eqqmc
[13:42:28] WindSong: yeh yeh i just made some log for you
[13:42:56] scyllinice: You installed ruby via apt, didn't you?
[13:42:58] elaptics: WindSong: what distro did you install?
[13:43:44] Leighton: WindSong: how experienced are you in the linux world?
[13:43:46] elaptics: WindSong: this tutorial is more for ubuntu but maybe most things will be similar http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
[13:44:24] elaptics: WindSong: the important thing is ruby - following what it says about installing ruby is a good first step
[13:46:21] WindSong: it is harder than i think (
[13:47:45] Leighton: WindSong: if you're not too familiar with linux, I suggest installing ubuntu, it's highly googleable
[13:48:11] elaptics: yes, then just follow Radar's tutorial I just linked to
[13:48:13] WindSong: It spy on me hate ubunntu
[13:50:09] scyllinice: WindSong: If you can get RVM installed, the newer RVM versions will actually tell you want to install package wise (and might even do it for you)
[13:51:03] sevenseacat: lol at 'spy on me'
[13:51:48] scyllinice: In the US, ubuntu sending search terms to Amazon is the least of our worries. I mean, we have the NSA doing an excellent job
[13:52:46] sevenseacat: it takes approximately three seconds to disable all the amazon shit in ubuntu.
[13:53:10] Leighton: WindSong: I'll spy on you if it makes you feel better
[13:53:49] WindSong: it mean you see what i am doing wrong and can help me with that
[13:54:10] Leighton: WindSong: for sure : ) lol
[13:57:07] dopie: sevenseacat, is a rails gangster
[13:57:25] sevenseacat: ACTION gansta pose
[13:59:20] Leighton: WindSong: did it break?
[14:00:00] WindSong: it not work anyway
[14:00:11] WindSong: ok next step is buy mac and try
[14:00:36] sevenseacat: this is awesome.
[14:00:48] sevenseacat: by all means, throw money at the problem instead of reading a tutorial.
[14:00:55] Leighton: WindSong: haha oh man that's an expensive next step
[14:01:37] WindSong: yeh and useless in my java-work (
[14:02:00] Leighton: WindSong: woah now
[14:08:27] WindSong_: after relog RVm start work
[14:09:10] Leighton: WindSong_: where are you at in the process?
[14:09:35] WindSong_: try to instal ruby thought rvm
[14:11:25] Leighton: WindSong_: you're welcome to pm me for help on setting that up if you'd like so the channel isn't spammed
[14:11:36] sevenseacat: its not like any other conversations are going on lol
[14:12:32] WindSong_: Leighton: I use webchat so i don't know how to do it here
[14:12:51] Leighton: sevenseacat: haha yeah true
[14:15:02] WindSong_: RVM has some dependesi problem becose it can't get specific ubuntus libraries
[14:18:28] WindSong_: There is my error https://pastee.org/d45xb
[14:21:51] boytoy: Anybody know how to get Puma's pumactl working? https://gist.github.com/kakekake89/5743129
[14:23:51] scyllinice: WindSong_: What's in the log file that it mentions?
[14:28:07] WindSong_: log file https://pastee.org/hjvj5
[14:30:16] scyllinice: WindSong_: Quick google search suggests doing "yum install audit" first
[14:36:11] Veejay: Hi everyone, if I need to create custom exceptions is lib/exceptions.rb the place for that?
[14:36:16] Veejay: Any opinion welcome
[14:37:20] scyllinice: It will work
[14:38:09] Veejay: Basically the exception will just be a more readable name over StandardError that I will raise
[14:42:37] WindSong_: scyllinice: thanks now i installed ruby
[14:43:29] elaptics: Veejay: If the exception relates to a specific model then I will nest it within the model's class
[14:43:45] horrror: how should i pass an array to be searched in a where query using IN with sql? I tried Tag.where('title IN ?', searches.join(',')) but clearly I'm wrong
[14:44:00] scyllinice: horrror: Don't join
[14:44:48] horrror: scyllinice: then?
[14:44:58] elaptics: horrror: just pass the array, Tag.where(:title => array_here)
[14:45:07] elaptics: horrror: it will do an IN for you automatically
[14:45:13] helpa: horrror: http://guides.rubyonrails.org/ - Ruby on Rails guides. Recommended reading.
[14:45:13] elaptics: horrror: !guides
[14:45:29] elaptics: ^ read those for more info about the AR query interface
[14:45:29] dsafsdf: if i want to query an api should i have the requests in a helper or where would it make most sense?
[14:45:44] horrror: elaptics: but I want to use LOWER on both title and query
[14:46:13] nc90: guys i'd like to learn RUBY in 6 hours... is it possible? where's a very concise guide? i currently use PHP
[14:46:25] scyllinice: Why 6 hours?
[14:46:37] nc90: scyllinice: because i have no time :)
[14:47:13] elaptics: horrror: well simplest is to manage your app. Make sure you save info to db in lower case first, then you can easily massage the array of items to be lower case too before you pass it into the where
[14:47:31] elaptics: horrror: or you just have to write the where sql snippet yourself
[14:47:41] nc90: scyllinice: i'm looking for a short and concise guide that compares RUBY to PHP so i can learn quickly the differences and fix them on-the-road
[14:48:23] horrror: elaptics: that was my first question. how to pass a ruby array inside an SQL query. remanaging my app which has 16m records isn't the optimal solution.
[14:49:07] elaptics: horrror: well you didn't mention the lower case stuff first hence why I showed you the rails way of doing an IN query
[14:49:14] elaptics: horrror: what is your database?
[14:49:32] horrror: you right my bad
[14:52:20] dsafsdf: how can i parse a json url?
[14:52:28] scyllinice: nc90: I'm not sure there is a guide like that around. There's a bunch of smaller guys that concentrate on a few differences, but nothing concise
[14:53:31] nc90: uhm scyllinice okay :( however thanks
[14:54:13] scyllinice: nc90: Grab a copy of the Pickaxe book and start reading
[14:54:59] scyllinice: nc90: Maybe someone you know has it: http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0
[14:55:07] scyllinice: Or you can get it another way
[14:56:42] nc90: scyllinice: what are you suggesting me to do? lol
[14:57:04] sevenseacat: nc90: you're dreaming.
[14:57:08] scyllinice: Everyone else did it
[14:57:14] sevenseacat: seriously, you can not learn ruby in 6 hours.
[14:58:02] nc90: sevenseacat: "learn" is a big word... i'm just trying to start quickly to develop a web application with it :)
[14:58:04] dsafsdf: ok im finally getting back some json responses but im confused as to how to extract data from it
[14:58:05] scyllinice: Someone will need to invent to mechanism Neo uses in the Matrix movies to learn Kung fu
[14:58:20] sevenseacat: nc90: you said learn first, not me.
[14:58:59] scyllinice: There once was a Rails for PHP developers book, but it's long past outdated
[15:00:36] helpa: 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
[15:00:36] sevenseacat: !r4ia is probably your best bet. learn ruby and rails the right way, not just 'how does the syntax differ from php'
[15:01:12] elaptics: horrror: then you can do something like Tag.where("lower(title) IN ?", lowercased_array_here)
[15:01:23] helpa: http://rubycentral.com/book - Programming Ruby is a free online book on Ruby.
[15:01:23] sevenseacat: !pickaxe is also recommended for learning ruby in-depth.
[15:01:24] elaptics: horrror: oops, that should be:
[15:01:30] elaptics: horrror: then you can do something like Tag.where("lower(title) IN (?)", lowercased_array_here)
[15:01:38] sevenseacat: thats not the pickaxe link i wanted
[15:01:48] sevenseacat: http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0 for the updated pickaxe
[15:03:15] scyllinice: Yeah.. helpa needs an update
[15:04:47] horrror: elaptics: thanks! wonderful
[15:04:59] lpdahito: Let's say I have these following models in Rails:
[15:04:59] lpdahito: class User < ActiveRecord::Base
[15:05:00] lpdahito: has_many :aliases
[15:05:00] lpdahito: has_many :comments, :as => :commentable
[15:05:01] lpdahito: class Alias < ActiveRecord::Base
[15:05:01] lpdahito: belongs_to :user
[15:05:02] lpdahito: has_many :comments, :as => :commentable
[15:05:02] lpdahito: class Story < ActiveRecord::Base
[15:05:03] lpdahito: belongs_to :commentable, :polymorphic => true
[15:05:03] lpdahito: How would I go about fetching all comments under one user and all of his aliases?
[15:05:07] helpa: lpdahito: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:05:07] elaptics: lpdahito: !gist
[15:05:09] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:05:25] sevenseacat: don't flood the channel.
[15:05:32] elaptics: sevenseacat: with gist requests :)
[15:06:57] lpdahito: https://gist.github.com/lpdahito/5891457
[15:07:05] lpdahito: based on the models above
[15:07:32] lpdahito: How would I go about fetching all comments under one user and all of his aliases?
[15:09:10] apeiros: polymorphic associations--
[15:09:23] lpdahito: that i know...
[15:12:07] pghale: what have you tried so far?
[15:13:44] apeiros: lpdahito: I'd probably go with something like Story.where("(commentable_id=? AND commentable_type=?) OR (commentable_id IN ? AND commentable_type=?)", user.id, User, user.aliases, Alias)
[15:14:07] apeiros: alternatively I'd remodel this thing.
[15:16:31] lpdahito: @pghale the only thing i've tried so far is to create a method where i would fetch a user's comments first… put them into an array and do the same thing with the results from each of the aliases… then make a huge array with that… but I'm pretty sure there's a sexier syntax for these kinds of requests
[15:17:08] pghale: just curious since i can't think of how to do it other than falling back to sql.
[15:17:16] pghale: maybe it's possible with scopes
[15:18:46] lpdahito: apeiros seems like a great solution. thanks a lot… i'll try it right now
[15:19:34] apeiros: lpdahito: I'd pack it into a scope, of course.
[15:19:46] apeiros: e.g. Story.from(user)
[15:20:26] lpdahito: apeiros yep definitely
[15:29:01] Veejay: apeiros: Hey. Are you in French Switzerland and looking for a job by any chance?
[15:29:14] apeiros: Veejay: nope & nope
[15:29:19] Veejay: Alright :D
[15:29:30] apeiros: but thanks for asking ;-)
[15:29:33] Veejay: I saw a very nice job opening in an alert the other day
[15:29:43] Veejay: And I thought of you
[15:29:46] Veejay: But whatevs
[15:29:58] apeiros: heh, atm, I'd have to be an excellent offer for me to change my job
[15:37:58] starfox21: hey guys I need some help with rails routing can somebody give me a hand?
[15:38:41] helpa: starfox21: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:38:41] slash_nick: starfox21: !gist your code and explain your problem, then I'd bet someone could help.
[15:38:42] elaptics: starfox21: just ask your question
[15:42:55] starfox21: so I am working on a website with categories and subcategories, and so for the routing I nested the subcategories resources inside the categories resource. However the resulting route for instance to show a subcategory is /categories/:id/subcategory/:id and instead I want /categories/:category_name/:subcategory_name
[15:43:43] slash_nick: sounds like slugs
[15:44:31] slash_nick: starfox21: http://railscasts.com/episodes/63-model-name-in-url
[15:45:19] starfox21: thanks, I am going to watch that railscast then
[15:59:45] Mosselman: lpdahito: what is the question then?
[16:00:53] lpdahito: Mosselman question has already been asked and answered by apeiros
[16:01:32] Mosselman: lpdahito: sorry, I thought the 'that i know…' was sarcastic
[16:03:00] lpdahito: Mosselman well it was… kinda lol
[16:03:40] Mosselman: lpdahito: seems legit ;)
[16:08:49] dsafsdf: anyone here uses bootswatch
[16:19:46] cwin: I'm hoping someone can help point me in the right direction here. I have three models I'm working with: Users, Threads and Subscriptions. Users can create threads, and also subscribe to them through subscriptions. This relationship is what I'm struggling to develop… because, it means I need to include a has_many :threads and a has_many :threads, :through => :subscriptions in the Users model. Here's my gist: http://bit.ly/13e78Oo
[16:26:32] ner0x: Anyone in here successfully do a carrierwave_direct upload to s3?
[17:04:20] Sylario: cwin: You are looking for the keyword :as
[17:05:52] cwin: Sylario: do you mean something like this? http://guides.rubyonrails.org/routing.html#using-as-in-nested-resources – I'm not sure I understand, could you explain a little further
[17:06:19] Sylario: cwin: no, in your has_many
[17:07:21] Sylario: cwin : like here http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
[17:07:54] Sylario: cwin there is also this : has_many :something, :class_name => "Stuff"
[17:08:17] cwin: Sylario: awesome! I'm checking both of these out, thanks a ton
[17:08:22] Sylario: cwin: what you want is to have a different name for threads through subscriptions
[17:08:55] cwin: Sylario: ok, perfect, I'm checking out the docs now, thanks!
[17:40:38] pwz2k: I could use some help. How would I go about setting a default profile image using carrier wave? I have the photo gallery setup, but I need for users to be able to select one of their photos from their photo album to be their default photo. It will be like their avatar that shows throughout the website.
[17:46:23] ner0x: pwz2k: You could set a profile_id on the user model and set it to the ID of the Image you want.
[17:58:12] pwz2k: ner0x: How would that be useful for having thousands of users if I have to set the id of the image I want from the user model? As each photo in the database is another id. The way I would want is user uploads their photos and can just click on a button to select their default profile image. I see from the github that I can do avatard_uploader.rb file but that would require the user to upload a separate avatar image and then in additi
[17:58:13] pwz2k: upload their photo gallery. That's one step too many for me to have the user do.
[17:59:27] ner0x: pwz2k: So have the button send ajax to the server setting that id?
[17:59:50] ner0x: pwz2k: Before you tell me how unuseful my advice is... think about it.
[18:03:58] ner0x: pwz2k: You're welcome.
[18:12:07] pwz2k: ner0x: will see how that works. thanks
[18:12:49] ner0x: pwz2k: It'll work exactly how you want it to. A simple button to select their default. It's how fb, google, ext does it.
[18:43:12] starfox21: I want to set a variable in an initializer and have it be accessible from a controller, what is the best way to do this?
[18:44:03] micah`: starfox21: is it a configurtion value?
[18:45:32] micah`: starfox21: perhaps the initializer creates a module to hold on to the value? sorta depends on what it is you are storing
[18:57:58] aharris6: hi everyone, newbie variable question
[18:58:32] aharris6: if i set the following: url = "http://localhost:3000?"
[18:58:40] aharris6: then in debug session look at url it = nil
[18:59:39] aharris6: why does it not equal the string i assigned it?
[19:05:25] samuel02: aharris6, you mean you assign it in the controller action?
[19:05:41] aharris6: samuel02: right
[19:06:12] samuel02: aharris6: make it an instance variable by using @, so @url = "foo"
[19:07:20] aharris6: it still returns as nil in the debug session..
[19:07:46] aharris6: although, in the actual view it seems to load correctly
[19:08:52] samuel02: aharris6, debug session? is that using the ruby debugger?
[19:10:29] starfox21: micah: I am trying to initialize an object from an external library that I am going to have to use throughout a variety of controllers
[19:10:31] aharris6: http://pryrepl.org/
[19:12:12] micah`: starfox21: I suppose you could set up a wrapping module with a method that provides access to the singleton
[19:12:47] cooldman224: Is the yui-compressor broken in rails 3.2/ruby 2.0? http://pastebin.com/25GX3FfY
[19:26:00] helpa: ..........
[19:27:05] plasmob: hello I's there a way to hand tune sql intercation with database in rails ... I am new to rails but experinced with databases, project now is migrating from mysql to postgres and then optimising queries that rails does if possible
[19:28:22] cooldman224: Ditche yui-compressor and used jammit. Solved.
[19:30:16] RubyPanther: ?..! => false
[19:30:33] davidcelis: cooldman224: y u no just use asset pipeline
[19:32:46] RubyPanther: plasmob: Generally you just make sure that you're using arel calls and never using SQL strings, and that way AR can optimize for you. You should only need to worry about creating the right indices, and when there is an actual bottleneck, you adjust the arel calls
[19:33:36] cwin: Hoping for a little help here. I originally had a pretty simple model structure, with two models – "Users" and
[19:33:39] RubyPanther: you will pretty much always make is slower by "optimizing" before you find a bottleneck, because arel already uses query algebra and has lots of optimizations
[19:34:47] helpa: edwardthefma: hi
[19:34:47] davidcelis: edwardthefma: !hi
[19:35:16] RubyPanther: some types of optimization is never done, such as replacing joins with sub-selects in postgres. The gains are too small, you introduce too much database-specific code, and it won't play nice with associations
[19:36:01] plasmob: well theres lies prolem for me i need to imlement psgres GIS radius rearch basically finding all oints aroun user input and way to do it in my mind was to use postgres to have spatial indexes
[19:38:28] plasmob: sorry much of typos ... basically i need to have a way to get addresses around user inputed location and with postGIS it an be done on databse index ... but queries to get them are not like simple selects
[19:38:48] cwin: I'm hoping for a little help. I originally had a pretty simple model structure, with two models – "Users" and "Threads". Now, I'm introducing a join, called "Publications". I've modified my models, and created "Publication". Now, for some reason, when I create a new "Thread"… the thread is created successfully, but with a null user_id, and it doesn't create an entry in the join table. I must be missing a step here. I've published a
[19:38:49] cwin: gist with my code here: http://bit.ly/12bUwkh
[19:45:42] RubyPanther: plasmob: you're over-thinking your implementation details. use one of the PostGIS gems
[19:46:44] gestahlt: Im stuck on an issue
[19:46:51] RubyPanther: or if you're old-school, implement it all in db functions :)
[19:47:53] momomomomo: gestahlt: You're back, glad you decided to give ruby/rails a second try.
[19:48:05] plasmob: i'm nothing against stored procs in db .. but way that is right now without indexes is waaaaaaaayyyy to slow
[19:48:15] momomomomo: gestahlt: Post your code to http://gist.github.com/ (all related code and errors), and then come back and explain: What you're trying to do, what the issue is, and what you think has gone wrong. This will help people be able to digest/understand your problem. Also check this out when you get a chance: http://www.catb.org/esr/faqs/smart-questions.html
[19:48:48] gestahlt: When i try to build a nested form with a polymorphic association, the foreign key doesnt get created
[19:49:21] RubyPanther: plasmob: so add indexes :)
[19:49:38] momomomomo: Post your form code, and the params that the form generates to a http://gist.github.com/
[19:51:13] gestahlt: Ah i think i got it
[19:53:50] momomomomo: gestahlt: what was your issue?
[19:57:33] gestahlt: momomomomo: I had a validation in my join model that validated the presence of the id
[19:59:50] RubyPanther: plasmob: the gems should work well and solve all your problems and avoid having to worry about it, but that said, if you really have to you can do stuff like Foo.select('*, ST_AsText(road_geom) AS geom').where(...)
[20:00:14] gestahlt: I got another problem now tho, i get now 422 Unprocessable entity
[20:00:19] gestahlt: but i try to figure this out first
[20:00:56] gestahlt: lol ok nvm, works now
[20:05:36] jeebster: what is the proper approach for validating presence of records in join table for has_many :through associations?
[20:08:43] davidcelis: https://www.dropbox.com/s/zruxzj9tuy7q8qq/Screenshot%202013-06-29%2013.07.56.png
[20:09:49] momomomomo: what am I looking at here davidcelis
[20:09:56] momomomomo: just fish shell?
[20:10:01] davidcelis: momomomomo: Hi
[20:11:03] momomomomo: jeebster: Are you trying to get uniqueness?
[20:11:44] davidcelis: jeebster: Just validate that there are records in the association
[20:11:45] jeebster: momomomomo: presence
[20:12:14] davidcelis: oh i assumed you meant in tests. because i'm writing tests. you want an activemodel validation
[20:12:15] jeebster: davidcelis: I think I'm more confused about when to call the custom validation. is it before_validation?
[20:12:24] jeebster: davidcelis: yes
[20:12:42] davidcelis: you can just validates_presence_of
[20:12:46] jeebster: I don't want an instance to be created if it doesn't contain any associations in the join table
[20:12:51] davidcelis: (or `validates :association, presence: true`, rather)
[20:12:55] jeebster: ok I'll try that out
[20:13:01] davidcelis: may not work with HMT
[20:13:07] davidcelis: cause the record's gonna have to save
[20:13:27] momomomomo: validates_presence_of :object will work
[20:38:26] blackmesa: Hi all. My Rails.logger.info is not writing to STDOUT anymore when I call my rails runner class. anybody has a hint?
[20:41:25] momomomomo: blackmesa: Post your code to http://gist.github.com/ (all related code and errors), and then come back and explain: What you're trying to do, what the issue is, and what you think has gone wrong. This will help people be able to digest/understand your problem. Also check this out when you get a chance: http://www.catb.org/esr/faqs/smart-questions.html
[20:41:49] cwin: I'm wondering if someone could please help me with this issue: http://stackoverflow.com/questions/17384473/rails-join-not-being-created-in-has-many-through-relationship
[20:43:03] atal421: question. a blog post has many tags, a tag belongs to a blog post. how do i find all blog posts where one of their tags == "ruby"
[20:43:58] whowantstolivefo: hi,after i gem update --system and gem update, i get the following error https://gist.github.com/whowantstolivefo/5892587 , how can i fix it ?
[20:45:14] mclee: whowantstolivefo: didn't the error message says try using 'bundle exec'? :)
[20:45:32] whowantstolivefo: mclee: bundler: exec needs a command to run << :)
[20:45:47] whowantstolivefo: mclee: when i type bundle exec ?
[20:46:55] mclee: Aren't you tring to print the routes by rake routes? then you can try bundle exec rake routes
[20:48:22] whowantstolivefo: mclee: from terminal when i typed bundle exec rake routes, i get the routes, but from my ide (Rubymine) when i go rake routes, i get the same error ?
[20:49:52] mclee: whowantstolivefo: I'm not familiar with Rubymine so I can't help you with that
[20:50:09] mclee: But I think the problem is that you updated the system gem
[20:50:12] momomomomo: cwin: If that's your entire form, then you're not even asking for fields for :publications
[20:50:14] whowantstolivefo: mclee: thank you anyway, i will get my routes from terminal then
[20:50:23] mclee: while the project's Gemfile still locks to an older rake version
[20:50:40] whowantstolivefo: mclee: yes i updated gems because i was following another tutorial and my other project infected
[20:50:42] mclee: if you don't mind upgrading the rake version, maybe you can solve it by 'bundle update rake'
[20:50:59] momomomomo: whowantstolivefo: your issue is that Rubymine is using an SDK which has rake 10.0.1 installed, but your gemfile specifies 10.0.4
[20:51:25] momomomomo: whowantstolivefo: http://www.jetbrains.com/ruby/webhelp/ruby-sdk-and-gems.html
[20:51:42] whowantstolivefo: momomomomo: let me figure it out thank you
[20:52:05] momomomomo: whowantstolivefo: Nothin to figure out, just select the correct SDK (aka your ruby version)
[20:52:06] cwin: momomomomo: the only fields in :publications are the user_id and thread_id, so, do I need to create fields for those?
[20:52:27] whowantstolivefo: momomomomo: okay letme
[20:52:53] momomomomo: well, if you're creating a form for @thread, then when do you ever tell Rails that you're making something for publications?
[20:54:07] cwin: momomomomo: I guess that's what I'm struggling with understanding. What I'm hoping to do, is make it so when I create a new thread, it takes the user_id and thread_id, and also creates a new publication – since that's what I'm using to relate users to threads
[20:54:18] momomomomo: atal421_: http://guides.rubyonrails.org/active_record_querying.html#scopes
[20:55:26] momomomomo: cwin: http://stackoverflow.com/questions/13506735/rails-has-many-through-nested-form
[20:56:06] atal421_: momomomomo: thanks
[20:56:28] cwin: momomomomo: thanks a ton, checking it out now
[20:56:55] momomomomo: No problem atal421_ cwin
[20:58:22] momomomomo: next cwin http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for
[20:59:13] cwin: momomomomo: awesome, thank you! i'll read through it all and let you know how it goes
[21:15:27] cwin: momomomomo: when I try to implement @thread.publications.build – I error out. It's weird, in the tutorials I've seen, like on rails casts, they only mention creating your three models, and tables, setting up the associations – and then, you create an object normally, and the join is created by rails?
[21:16:36] momomomomo: typically you have form_for @object_being_created
[21:16:57] momomomomo: then you have f.fields_for :object_to_create_and_associate
[21:17:35] momomomomo: the :object_to_create_and_associate would be your :publication in this case, which is mapping to threads
[21:18:39] momomomomo: Your model might not be defined the way you want it, but that's typically how nested associations are made
[21:19:56] momomomomo: cwin: http://stackoverflow.com/questions/11480939/many-to-many-has-many-through-association-form-with-data-assigned-to-linking-m
[21:32:19] cwin: momomomomo: ah, ok, thanks again for all of your help
[21:36:05] hadees: I'm having some trouble with blocks, i'm trying to modify https://gist.github.com/greypants/3279194#file-nav_link_helper-rb so that it doesn't evaluate the title block until the link method is called in LinkGenerator. I think something like "title = block_given? ? &block : -> { args.shift }" would work. However I also want to be able to pass selected? into the block so I can change the html if the nav link is selected or not.
[21:37:14] hadees: i'm not sure how to pass selected into capture(@title)
[21:37:39] hadees: *selected?
[21:41:56] momomomomo: I'm not sure if I understand what you're saying hadees - the LinkGenerator class defines @title on init, which is passed in from your title variable...
[21:42:21] hadees: momomomomo: i know i'm trying to change that
[21:42:39] momomomomo: Then just remove the @title = title ?
[21:43:01] momomomomo: and move it into the link method?
[21:43:24] hadees: momomomomo: this is my current version https://gist.github.com/hadees/5892793#file-nav_link_helper-rb
[21:43:36] hadees: it still doesn't work but I think i'm screwing up the references
[21:43:40] tolborg: im doing this inside a partial <%= some_variable %>. However, if the variable does not exist rails throws an error. Whats the tightest way of only printing a variable if it exists?
[21:44:33] _str: Hi, I have a famous rails problem, still unsolved for me. when I want to start rails server I confront with:
[21:44:36] _str: cannot load such file -- sqlite3/sqlite3_native (LoadError)
[21:44:40] _str: my ruby version is 2.0.0 and my rails version is 4.0.0. by the way there is something else ! my sqlite3 version 3.7.9 but the path
[21:44:43] _str: refrenced in the error states that sqlite3 version is 1.3.7 ! :
[21:44:47] _str: "/home/pooya/.rvm/gems/ruby-2.0.0-p247/gems/sqlite3-1.3.7/"
[21:44:50] momomomomo: I don't understand what you're trying to do hadees sorry
[21:45:29] _str: what can i do?
[21:45:30] elaptics: tolborg: <%= some_var if some_var %>
[21:45:44] hadees: momomomomo: i'm trying to have title have different html if it is selected instead of just a different class
[21:46:16] momomomomo: _str: your sqlite gem is using version 1.3.7
[21:46:53] momomomomo: hadees: This isn't a rails problem, it's more of a specific ruby scripting problem
[21:47:05] tolborg: elaptics: that still throws an error, but I can do this <%= some_var if defined?(some_var) %> thanks!
[21:47:23] _str: momomomomo: what can I do? I have to change the version from Gemfile to 3.7.9?
[21:47:29] hadees: momomomomo: capture is a rails method
[21:47:44] hadees: momomomomo: right now that is what isn't working
[21:50:11] cwin: momomomomo: making progress! I was able to get the publication entry to add using @thread.build_publication in the controller – when a new thread is created, it creates a new publication with the thread_id. The only problem that remains is that user_id is still null in the database entries.
[21:50:39] momomomomo: hadees: ok? post your error trace
[21:51:52] momomomomo: _str: sorry about that, I misread your comment - your sqlite3 GEM version is 1.3.7, which is current
[21:53:04] momomomomo: I'd check out _str http://stackoverflow.com/questions/15792749/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-in-ruby-2-running-ra
[21:53:04] _str: momomomomo: no problem bro, ok I got it, sqlite3 gem version 1.3.7 but what can I do to fix this problem? I am still dealing with it
[21:54:35] _str: momomomomo: I reinstalled sqlite3 with "--platform=ruby" but nothing changed ....
[21:55:16] momomomomo: Are you on windows _str ?
[21:55:26] _str: momomomomo: No, I'm on ubuntu
[21:56:57] momomomomo: _str: Post your gemfile here http://gist.github.com/
[21:57:20] _str: momomomomo: my gemfile is rails 4 default gem file but ok
[21:57:35] whowantstolivefo: momomomomo: i've tried all SDK in my ide and the result is same. look at the my screenshot please http://ctrlv.in/208703
[21:58:00] momomomomo: put your image on imgur.com or something whowantstolivefo - that's a sketchy link
[21:58:30] _str: momomomomo: https://gist.github.com/anonymous/5892841
[22:01:53] _str: momomomomo: any idea?
[22:02:18] momomomomo: What happens when you run bundle install
[22:02:23] malgorath: I just fresh installed a new Debian system. Is there a good way to setup the system to work with RoR?
[22:02:33] _str: momomomomo: me?
[22:02:51] whowantstolivefo: momomomomo: at imgur.com Firefox can't find the server at imgur.com. <<
[22:02:58] _str: momomomomo: nothing, everything is ok there
[22:04:26] momomomomo: _str: what does "which sqlite3" return in your terminal?
[22:04:44] _str: momomomomo: /usr/bin/sqlite3
[22:08:40] momomomomo: so _str you're likely missing some depencencies
[22:08:51] momomomomo: _str: try sudo apt-get install sqlite3 libsqlite3-dev
[22:09:10] _str: momomomomo: I've tried it before :)
[22:11:10] _str: momomomomo: but I can't understand why the version of sqlite3 is 3.7.9 while version of sqlite3 gem is 1.3.7
[22:11:18] momomomomo: _str: apt-get uninstall sqlite3 libsqlite3-dev; apt-get install build-essential libxslt-dev libxml2-dev sqlite3 libsqlite3-dev
[22:11:32] momomomomo: _str: The gem version is not equal to the actual Sqlite3 database version
[22:13:52] _str: momomomomo: but it comes along with the latest version of actual Sqlite3 database ?
[22:14:42] cwin: Does anyone have any ideas as to why I'd get a null user_id in my join table with the following? http://stackoverflow.com/questions/17384473/rails-join-not-being-created-in-has-many-through-relationship
[22:16:37] _str: momomomomo: still dealing with the problem... nothing changed
[22:17:41] momomomomo: not sure, what did the apt-get uninstall/installs do - run and install fine?
[22:18:43] _str: momomomomo: yes, without any error
[22:19:27] momomomomo: _str: gem uninstall sqlite3; gem install gem install sqlite3 -- --with-sqlite3-dir=/usr/bin
[22:20:33] _str: momomomomo: isn't it --with-sqlite3-lib?
[22:20:48] _str: momomomomo: invalid option: --with-sqlite3-dir=/usr/bin
[22:20:59] _str: momomomomo: wait wait
[22:21:49] momomomomo: did you include the extra --
[22:22:19] _str: momomomomo: no and added it and it is in the process of installing
[22:23:21] _str: momomomomo: problem is still there... :|
[22:23:37] momomomomo: ok one more attempt
[22:23:47] momomomomo: _str: gem uninstall sqlite3; gem install gem install sqlite3 -- --with-sqlite3-dir=/usr
[22:25:00] butblack: is there a way to restrict characters that are allowed in a form text box?
[22:25:29] momomomomo: butblack: on the backend, you can use rails validators; on the front-end you'll need to use javascript or similar
[22:25:40] _str: momomomomo: no it didn't change anything but thank you for taking your time :)
[22:25:40] momomomomo: similar being a gem that does the hard work for you - if there is one
[22:25:50] momomomomo: _str: what's the full error you receive
[22:25:56] momomomomo: paste it to http://gist.github.com
[22:26:00] _str: momomomomo: w8
[22:26:15] momomomomo: Did the last install fix it?
[22:26:18] momomomomo: after you bundle
[22:27:10] _str: momomomomo: no, nothing was changed
[22:27:14] _str: momomomomo:
[22:27:15] _str: https://gist.github.com/anonymous/5892931
[22:27:47] momomomomo: _str: if it's a fresh app
[22:27:53] momomomomo: try making a new one outside of that one
[22:28:00] momomomomo: and running bundle
[22:28:10] momomomomo: open up a new shell as well
[22:28:32] _str: momomomomo: you mean "rails new project" ?
[22:29:05] momomomomo: close your terminal, open up a new terminal window, rails new test_application; bundle
[22:29:21] momomomomo: cd into that new rails app before running bundle, of course
[22:29:59] _str: momomomomo: I don't thing if terminal session affect anything but ok
[22:30:14] whowantstolivefo: momomomomo: i still have problem and imgur i cant upload photo why i dont know. screenshot is here http://ctrlv.in/208703
[22:31:23] momomomomo: sorry whowantstolivefo put it on a different site - I'm not a fan of sketchy urls; try any other well known image upload site
[22:32:30] _str: momomomomo: still represents error
[22:33:27] momomomomo: _str: which ruby
[22:33:46] _str: momomomomo: /home/pooya/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
[22:33:55] momomomomo: _str: which sqlite3; whereis sqlite3; whereis ruby
[22:35:52] _str: momomomomo: https://gist.github.com/anonymous/5892965
[22:35:54] momomomomo: _str: Humor me: rvm install 1.9.3-head; rvm use 1.9.3-head@test_sqlite3 --create; gem install rails; rails new test_193
[22:36:40] _str: momomomomo: you mean using 1.9.3 instead of 2.0.0 ? why?
[22:37:09] momomomomo: before you do that _str which gem
[22:37:13] momomomomo: update that gist please
[22:37:13] Mosselman: how expensive is it to create an object, I mean performance wise.
[22:37:55] Mosselman: because right now I have a class with some class variables, instead I could rewrite to object usage, rather than static calling, but I only need 1 object at a time.
[22:38:03] Mosselman: So basically a static class.
[22:38:28] _str: momomomomo: https://gist.github.com/anonymous/5892977
[22:38:38] whowantstolivefo: momomomomo: http://postimg.org/image/ov0bgscf9/20980f4c/ does it valid ?
[22:39:38] momomomomo: whowantstolivefo: are you using a gemset?
[22:39:49] whowantstolivefo: momomomomo: i user rvm
[22:40:19] whowantstolivefo: momomomomo: when i type rvm gem i get > /home/malika/.rvm/rubies/ruby-1.9.3-p194/bin/gem <
[22:41:08] _str: momomomomo: downloding 1.9.3 takes time, my internet is bullshit. is it possible to see you later here?
[22:41:22] momomomomo: whowantstolivefo: what does rake --version return in your console?
[22:41:42] whowantstolivefo: rake, version 10.0.4
[22:41:43] momomomomo: _str: yeah, but I'm kind of stumped here, I admit - give me a few to look around on google
[22:41:52] whowantstolivefo: whowantstolivefo: i think i must change it to 10.0.1 ?
[22:42:39] whowantstolivefo: momomomomo: i think i must change it to 10.0.1 ?
[22:42:41] momomomomo: whowantstolivefo: go to File > Project Structure > open up the window
[22:42:44] _str: momomomomo: ok, thank you bro, so I talk to later here
[22:43:15] momomomomo: whowantstolivefo: on the left, select "SDKs"
[22:43:43] momomomomo: on the left window that appears, you should see some RVM: ruby-1.9.3 looking stuff
[22:44:05] _str: momomomomo: so catch you later bro
[22:44:09] momomomomo: now go to your terminal and type rvm current
[22:44:16] whowantstolivefo: Ruby SDK 1.9.3-p194
[22:44:20] momomomomo: _str: I dont know how long later - but I might be around
[22:44:40] _str: momomomomo: no problem
[22:44:45] _str: momomomomo: thank you, bye
[22:44:52] momomomomo: ok whowantstolivefo now in that window in Rubymine, select RVM: ruby-1.9.3-p194 [global]
[22:47:58] rocco: Hey! Anyone run into rails dependency issues with a fresh install of REE?
[22:48:26] rocco: I get error "activesupport requires Ruby version >= 1.9.3"
[22:48:37] rocco: my REE version is 1.8.7 i think
[22:50:13] whowantstolivefo: momomomomo: https://gist.github.com/whowantstolivefo/5893009 here is error after i click 1.9.3-p194[global] and rake routes
[22:50:44] momomomomo: don't know whowantstolivefo this is an ide issue, I'd contact jetbrains
[22:51:03] whowantstolivefo: momomomomo: thanks anyway
[22:51:23] CaptBeardie: Chat test, can anyone see this?
[22:51:55] momomomomo: whowantstolivefo: you might try creating a gemset and running bundle, then selecting that in your Rubymine SDK, then restarting rubymine
[22:52:00] momomomomo: CaptBeardie: yes
[22:52:30] CaptBeardie: momomomomo: sweet thanks
[22:53:10] CaptBeardie: Anyone install rails gem on Ruby Enterprise Edition?
[23:08:11] whowantstolivefo: momomomomo: bundle update fixed problem
[23:08:46] momomomomo: there you go :)
[23:09:02] momomomomo: with the correct sdk, and restarting rubymine, right?
[23:09:12] momomomomo: whowantstolivefo:
[23:10:19] whowantstolivefo: no, i only typed bundle update from terminal and again run rake routes
[23:18:56] Bit_Boy: wow guys i just found a good site to order suboxone and ghb from through i2p, http://chemhack.i2p