« Back to channel list

#RubyOnRails - 02 January 2014

« Back 1 day Forward 1 day »
[00:01:14] drim: existensil: I can't?
[00:01:18] drim: yes it's default..
[00:01:27] drim: im trying to load user session in eventmachine
[00:04:17] existensil: the session data is stored in the user's browser. the session id won't let you retrieve it unless the user is currently visiting and the cookie information is available
[00:04:22] lethjakman: so...in production my data-method="delete" isn't a delete, it's a GET request. I think that's UJS, any reason that wouldn't be working?
[00:04:28] existensil: in which case you would already have the session data through the session hash
[00:05:12] lethjakman: drim: you'll have to pass the data in.
[00:05:12] existensil: lethjakman: i thought PUT and DELETE piggy backed on POST requests, not GET
[00:05:36] lethjakman: existensil: not with rails if I understand right, however I can't post either
[00:05:45] lethjakman: none of the data-methods work
[00:05:52] drim: existensil: I already have the session_id (decoded from the request)
[00:06:05] drim: I want to load the session according to this
[00:06:35] drim: lethjakman: the data in what?
[00:10:03] lethjakman: ahh I figured it out, I needed javascript_include_tag "application" in my head
[00:11:16] drim: existensil: the cookie is sent with the request. I decoded it to get the session_id, but now I want to load datas containing in the session (which are stored in a file for now)
[00:14:05] existensil: drim: http://www.andylindeman.com/2013/02/18/decoding-rails-session-cookies.html
[00:14:23] drim: Ive done that
[00:14:51] drim: but datas are not in the cookie, but in the session so I want to load the session according to the session_id stored in the cookie
[00:15:02] drim: make sens?
[00:15:05] existensil: the cookie is the session
[00:15:41] existensil: if you are using rails defaults, the entire session hash is stored, base64 encoded, in a cookie
[00:15:44] existensil: for rails 3 at least
[00:16:35] drim: there is no datas on server side?
[00:16:45] drim: im using rails4
[00:20:46] ddd: no, if you need to interact with the session you store the session in the database. see config/initializers/session_store.rb
[00:25:39] zrl: ActionDispatch::Cookies::CookieOverflow. the tastiest, yet most disappointing thing to happen to me today
[00:27:56] lethjakman: so...in redis there's a / thing at the end
[00:28:00] lethjakman: what is that called?
[00:28:10] lethjakman: I'm trying to figure out how to set it in Redis.new
[00:39:02] existensil: in rails 4 its still in a cookie, but now its both signed (like rails 3) AND encrypted
[00:40:37] existensil: lethjakman: you are probably talking about the DB #
[00:41:18] existensil: something like would point at DB #0 of the local redis instance
[00:43:47] jarray52: In Rails 3, I'm trying to delete a cookie with the code 'cookies.delete(:user_auth, domain: MY_DOMAIN)'. However, the cookie is not getting deleted. Is there a security feature or configuration setting that is preventing this deletion?
[00:44:04] jaymiejones86: Hey, anyone came across this... when running rspec instead of just showing the tests passing or failing, it also shows all the db transactions? http://take.ms/PObnh
[00:47:44] jarray52: In this stack overflow post, someone mentioned a delete cookie hash. What is that? http://stackoverflow.com/questions/13564415/rails-3-cookie-delete-not-working
[00:53:50] jarray52: Also, I'm running cookies.delete from the controller. In this case, the destroy method.
[00:54:38] existensil: jarray52: it looks like he's asking if the deleted hash entry is being set again after its being deleted
[00:55:01] existensil: cookie.delete(:key) should work. not sure why its not for you
[00:55:12] existensil: are you setting the cookie with the same domain?
[00:55:15] existensil: it has to match
[00:55:21] rushed: jarray52: did you create the cookie in the first place?
[00:56:13] rushed: jarray52: if it's an auth cookie from a library, perhaps there is a logout or session abandon method that would be more appropriate
[00:56:39] jarray52: I'm using cookies.delete(:cookie_name, SITE_DOMAIN).
[00:57:20] jarray52: The cookie is created by a backbonejs application that is delivered via a Rails server.
[00:57:41] jarray52: And, the cookies.delete line is being executed from a rails controller.
[00:58:04] existensil: are you 100% sure the domain is identical to the one the cookie was set with?
[00:59:03] jarray52: The string value of SITE_DOMAIN exactly matches the domain I see in Advanced Cookie Manager.
[00:59:13] existensil: if your page is being served at www.mydomain.com and that's what domain its getting set at, trying to delete it from mydomain.com or *.mydomain.com will both fail
[01:01:31] rehat: If I made a class file in my apps folder what do I need to do to create a new one from one of my controllers
[01:01:47] rehat: I keep getting a uninitialized constant
[01:03:15] existensil: rehat: where exactly are you placing this class file? rails will attempt to autoload constants from certain directories only
[01:03:36] rehat: oh, I made a services folder in my app
[01:03:46] existensil: so if you reference MyClass and it doesn't exist, rails will (by default) try and load my_class.rb from models or controllers (and maybe a couple others?)
[01:03:51] rehat: where should I be putting helper classes
[01:03:55] existensil: you can configure the autoload paths in config/application.rb
[01:04:16] existensil: services works, just add it to your autoload
[01:04:18] rehat: I guess I need to restart my server
[01:04:31] existensil: does the file name match the expected underscore format?
[01:04:41] existensil: MyClass => my_class.rb
[01:04:55] existensil: yeah, restart is required
[01:05:14] jarray52: existensil: In Advanced Cookie Manager, the url is www.test.mydomain.com. I tried cookies.delete(:auth_cookie, 'www.test.mydomain.com'). I also tried cookies.delete(:auth_cookie, '.mydomain.com'). Neither worked. Is there any other thing I could try?
[01:05:45] existensil: jarray52: i'd start inspecting the headers of the request and response when the cookie gets deleted
[01:06:04] jarray52: In the browser?
[01:06:10] jarray52: I'll try that.
[01:06:58] existensil: the inspector in chrome or whatever will let you look at the raw headers of each request
[01:07:15] existensil: network tab in chrome
[01:38:23] RubyRonin: greetings all
[01:38:54] RubyRonin: ran rails g scaffold Cases, did the rake:db migrate, keep encountering an issue SyntaxError in Cases#index
[01:39:12] RubyRonin: <% @cases.each do |case| %> whenever I go to localhost:3000/cases
[01:39:17] RubyRonin: what gives?
[01:40:13] s2013: paste your code on gist RubyRonin
[01:44:14] RubyRonin: https://gist.github.com/anonymous/8213797
[01:46:50] ace_striker: RubyRonin: user cases simply
[01:47:27] ace_striker: sorry ..by mistake
[01:48:14] rehat: maybe @cases isn't an array
[01:48:17] RubyRonin: i don;'t understand what I'm doing wrong. It was a scaffold
[01:52:24] s2013: case is a reserved keyword RubyRonin
[01:52:36] s2013: im 99.99% sure thats the reason for the error
[01:52:39] RubyRonin: damint, I forgot
[01:52:44] RubyRonin: THANK YOU s2013!
[01:52:49] s2013: NO PROBLEM
[01:54:45] shevy: s2013 you are one year past!
[01:54:52] s2013: i know right
[01:55:01] s2013: damn it. i didnt think id survive past 2013..
[01:55:55] s2013: anyone used morrisjs or any charting library? i saw the railscast about it and he put the json dump in a data-attribute. that looks like a bad idea.. any comments on that?
[01:56:15] skyjumper: s2013: cocoon puts entire partials into a data attribute
[01:56:32] skyjumper: hasn't caused a problem for me
[01:56:43] s2013: hmm still feels like an odd way of doing it.
[02:00:09] ziikutv: Doesanyone knowhow to convert the following curl command to a url format s/t i can use it with HTTParty.get function?
[02:00:09] ziikutv: curl -d "appID={appIDHERE}&apiKey={apiKEYHere}&stopNo=6137&format=json" https://api.octranspo1.com/v1.2/GetNextTripsForStopAllRoutes
[02:00:20] jarray52: existensil: I discovered the cause of the problem. There was an infinite redirect loop that prevented a view from being rendered. The rendering of the view is critical to calling the method inside the browser that deletes the cookie.
[02:00:47] jarray52: existensil: Thanks for your assistance.
[02:01:13] ziikutv: By the way this is the documentation of that API
[02:01:13] ziikutv: http://www.octranspo1.com/developers/documentation
[02:01:14] jarray52: existensil: looking in the network tab was critical to discovering the problem.
[02:16:39] s2013: ziikutv, what do you mean to urlformat
[02:17:04] s2013: https://api.octranspo1.com/v1.2/GetNextTripsForStopAllRoutes/appID={appIDHERE}&apiKey={apiKEYHere}&stopNo=6137&format=json
[02:17:07] s2013: it would be like that
[02:17:12] s2013: but i feel like its a post data
[02:17:40] ziikutv: so then I cannot use HTTParty?
[02:18:07] ziikutv: When I runt he curl command it prints a json "file" in the terminal
[02:18:26] s2013: it sends a response
[02:18:49] s2013: you can just use curl directly in rails as well if you want
[02:18:58] s2013: `curl -d blah blah `
[02:19:18] ziikutv: s2013: I want to know how to do it in pure ruby first :P
[02:19:20] ziikutv: http://dpaste.com/1533017/
[02:19:22] ziikutv: that is what i have so far
[02:20:10] s2013: but that wont do anything
[02:20:31] s2013: you nee the base uri
[02:23:32] s2013: you can also do this ziikutv HTTParty.post("the base url", query: { appID: something, apiKey: something, stopNo: 6137, format: json })
[02:23:36] s2013: that would work
[02:23:46] s2013: the base url is the octranspo api url
[02:23:50] ziikutv: i forgot to add base uri
[02:25:33] s2013: did it work?
[02:26:07] ziikutv: s2013: Error page
[02:26:15] s2013: whats the error
[02:27:58] ziikutv: http://dpaste.com/1533029/
[02:28:16] s2013: whats the error
[02:28:23] ziikutv: an html page is returned > The URI you submitted has disallowed characters.
[02:28:40] s2013: pm me the appid and api key and ill test it
[02:28:58] ziikutv: are they suppose to be passed in as strings?
[02:29:13] ziikutv: what about the busstopNo
[02:29:35] s2013: everything should be strings
[02:51:24] zeknox: is it possible to pass a flash[:notice] to the render method?
[02:59:20] diegoviola: cool, rubygems 2.2.0 can now handle Gemfile, no need for bundler anymore :)
[02:59:28] diegoviola: gem install -g == bundle install
[02:59:43] diegoviola: just tried it, it works like a charm
[03:00:29] diegoviola: i love how simple things are getting in rubyland, chruby/ruby-install, and now this
[03:01:44] pipecloud: diegoviola: You heard about Rubygems and Bundler mergingn slowly.
[03:02:08] diegoviola: yeah it's nice
[03:02:17] diegoviola: i just tried it with my app
[03:02:26] diegoviola: removed ~/.gem; reinstalled with gem install -g, it just works
[03:28:14] sarosh____: Happy New Year everyone! Anyone have experience with Devise and Confirmable?
[03:29:06] helpa: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[03:32:00] sarosh____: With Devise + :confirmable, I finally got email confirmations working. When clicking on the link, I get "Confirmation token can't be blank" on my application. Has anyone seen anything like it before?
[03:33:17] sarosh____: And by "the link" I mean the "confirm my account" link on the default confirmation_instructions.html.erb Devise view (using Devise 3.2.2 and rails 4.0.1).
[03:36:37] pipecloud: sarosh____: Does it have a token in the URL?
[03:37:25] sarosh____: It does - ex. http://example.com/users/confirmation?confirmation_token=aKWcLuNoobtpysYeYrz7
[03:38:07] woog: I'm doing the railsapps.org tutorial and I'm confused by something the Routing section
[03:38:48] woog: routes.rb contains "LearnRails::Application.routes.draw do"
[03:39:00] woog: and the tutorial says "Notice the name of the application LearnRails is included in the file. When you created the application, I suggested you use the name learn-rails."
[03:39:41] woog: how is learn-rails being changed to LearnRails?
[03:40:33] Dreamer3__: what is up with the interference with usb 3 and my apple wireless mouse
[03:40:49] Dreamer3__: does it vary by hub?
[03:42:57] pipecloud: hubba hubba
[03:43:12] sarosh____: pipecloude: if it helps any, the code is all on github. I just can't think of what might cause it :).
[04:05:17] bricker`LA: sarosh____: what's the link?
[04:06:03] sarosh____: bricker`LA: https://github.com/shahbuddin/purgeoff
[04:09:01] sarosh____: Started learning RoR 30 days ago, so ignore some of the poor coding :).
[04:11:37] pipecloud: sarosh____: Have you stopped and started the rails server?
[04:11:58] sarosh____: pipecloud: Just heroku restart right?
[04:12:12] pipecloud: sarosh____: Develop locally, not on heroku.
[04:12:17] pipecloud: This ain't PHP.
[04:12:45] sarosh____: Let me try the token I get locally.
[04:13:00] rushed: sarosh___: ...
[04:13:24] sarosh____: I figured I'd try in prod with an actual email haha.
[04:21:58] brycesenz: hi all! Very quick ruby question for anyone - is there a more concise way to write this function? https://gist.github.com/anonymous/8214998 . I feel like there must be, but I don't know pure ruby well enough to figure it out.
[04:25:21] jrobeson: brycesenz, learn about inject
[04:25:27] jrobeson: it'll change your life
[04:26:05] jrobeson: brycesenz, oh i thought i was in #ruby not in #rubyonrails
[04:26:12] jrobeson: in rails you can just use sum()
[04:26:22] jrobeson: but sum is just a tiny wrapper around inject
[04:27:02] brycesenz: Ok, I'm going to look up inject
[04:27:15] sarosh____: pipecloud: Confirmation link works in development...
[04:27:16] jrobeson: well in rails sum is right there and available
[04:27:22] brycesenz: I'd rather get better at pure ruby that use the random other functions that Rails provides
[04:27:40] jrobeson: that is likely best i guess
[04:28:00] rushed: brycesenz: they're not random, they're a collection of tools geared toward the domain the framework is generally used in :)
[04:28:24] jrobeson: rushed, well honestly i'd rather have less monkey patching
[04:29:01] brycesenz: #rushed - I know; random was snarky. My point is more that I want my code to be as framework agnostic as possible for functions that aren't really interacting with the framework itself.
[04:29:15] rushed: jrobeson: am I wearing a monkey patch all the things t-shirt?
[04:29:26] jrobeson: rushed, how about.. 0
[04:30:27] jrobeson: well you could be wearing that shirt, i don't know :)
[04:32:49] sarosh____: bricker`LA: The only difference between production.rb and development.rb is my SMTP setup and config.action_mailer.default_url_options. That and sqlite3 and PG....
[04:39:22] sarosh____: Woh, I think it's because my host is the TLD and not www. In Chrome I see a redirect from example.com/confirmation?confirmationtoke=xyx to 301 www.example.com
[04:42:54] sarosh____: Jesus Christ... that was it
[04:44:11] sarosh____: My app server wasn't keeping the query string on the redirect. Changed config.action_mailer.default_url_options to www instead of the top level domain. That only took 5 hours...
[05:30:08] tigris_: does anyone use iterm2 for osx and if so, can tell me the default font settings are, e.g. font name, size and character spacings? i messed with mine before duping the default profile and see no easy way to reset
[05:39:29] Oog: i have a model UserContact with 2 fields - userid, phonehash. i have an array of phonehashes and a single userid. i want to insert the pairs (userid, each_phonehash) what is the fastest way to do this?
[05:39:57] Oog: i also have a unique key on userid,phonehash and want ignore insert errors as a result of duplicates
[05:41:21] tigris_: depends on your definition of "fastest"
[05:42:15] Oog: what do you mean
[05:42:26] Oog: i know if i do 1000 inserts taht isnt going to be good...
[05:42:41] Oog: I could easily do new UserContact... then .save!
[05:43:12] tigris_: `phonehashes.each{|hash| UserContact.create phonehash: hash }` wrapped in a begin / rescue whatever the db duplicate error is (assuming uniq index in db), is the fastest way to write it, not the fastest way to run it ;)
[05:43:43] Oog: right :)
[05:43:48] Oog: ok i meant fastest way to run
[05:44:01] Oog: thats what i do for single inserts
[05:44:23] tigris_: fastest to run would be to run a straight DB.execute with raw sql
[05:44:57] Oog: faster than ActiveRecord::Base.transaction do which i just discovered ?
[05:45:20] Oog: wouldnt string concatenation on making a huge db.execute sql string be slow?
[05:45:59] tigris_: db execute can still only take 1 insertion at a time, and you would still wrap the each loop in the above mentioned transaction, you would do that regardless how you did it
[05:46:49] Oog: i was thinking i could do a single sql statement with "insert into usercontact(userid, hash) values (1,"abc"), (1, "def") etc but that would be a huge string to concatenate
[05:47:07] tigris_: if UserContact.create is miles slower than an execute, then you have got some crazy validations / callbacks going on
[05:47:09] Oog: if you just do a single DB.execute you dont have to do ActiveRecord::Base.transaction do right?
[05:48:07] Oog: i have no validations so it hink ill just do ActiveRecord::Base.transaction do and UserContact.create. - will it throw a unique index error on each UserContact.create so i can catch it and ignore it?
[05:48:27] Oog: or will do it at the end of the transaction and void all my inserts?
[05:48:28] tigris_: it will if you've got a uniq contrstraint on either the DB or in the model
[05:48:37] Oog: cool i got both
[05:48:50] tigris_: since you are in a transaction, you will need to rescue it, or A/R won't commit your changes
[05:57:10] Oog: single exception is causing it to all fail
[05:57:14] Oog: it hits the first error even though i catch it
[05:57:18] Oog: and the transaction aborts
[05:57:46] Oog: PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block
[05:59:41] cenhyperion: Okay guys I'm having a pretty rough time pushing to heroku
[06:00:16] cenhyperion: Google font isn't loading for some reason and devise sign_in page is flashing 500 errors
[06:00:42] cenhyperion: sign up page, my bad
[06:00:46] cenhyperion: sign in loads fine for some reason
[06:01:48] rushed: cenhyperion: one problem at a time... logs, errors, stacks, code => gist :)
[06:04:31] Oog: tigrihmm
[06:04:45] Oog: there must be a way
[06:22:11] phipes: how come when i'm setting @var in a controller's create method it's not being persisted in other methods, namely new
[06:22:36] elaptics: phipes: because each new request is a new controller instance
[06:23:54] phipes: elaptics: that makes sense. thanks!
[06:29:22] cenhyperion: rushed: It helps if you don't comment out your db migrations several nights before you decide to deploy, haha
[06:29:25] tagrudev: morning and happy new year
[06:29:55] elaptics: tagrudev: happy new year!
[06:33:54] rabbi1: hi, is there a way to add SET type in rails 4 migrations..
[06:36:35] elaptics: rabbi1: what do you mean, exactly?
[06:36:50] rabbi1: elaptics: SET field type of mysql
[06:37:16] elaptics: rabbi1: you can use #execute to run arbitrary sql
[06:37:38] elaptics: so you can write whatever you need for the specific database
[06:37:47] rabbi1: elaptics: http://dev.mysql.com/doc/refman/5.0/en/set.html is there a way to create this SET type through migration ?
[06:37:56] elaptics: you will need to make sure you change your schema from ruby to sql though
[06:39:05] rabbi1: yeah, i got it in the migrations guide arbitrary sql ??? thank you
[07:10:41] hrh: how can i get the output of heroku console into txt file?
[07:14:40] elaptics: hrh: copy/paste?
[07:15:09] elaptics: hrh: you can change the logging to external services like logentries and you'll get much more control then
[07:16:40] bricker`LA: I like java. I feel like I already know it but I've only been using it for a few days. Why is that?
[07:17:01] bricker`LA: I've also used a little bit of C but had a much harder time with that
[07:17:30] bricker`LA: Is Java just easier to grasp, in general?
[07:17:35] bricker`LA: These are important questions.
[07:18:57] ravionrails: What we know is always easy and what we don't know is always difficult imo
[07:21:00] hrh: elaptics: no easier way?
[07:23:45] krz: is this rspec? http://blog.codeship.io/2013/12/16/yes-you-should-write-controller-tests.html
[07:40:29] pipecloud: krz: It seems to be.
[07:40:41] pipecloud: Minitest Spec has the describe stuff, but not subject or let.
[07:47:57] bricker`LA: I wish SemVer was more clear about how to use itself when in the 0.x.x stage
[07:48:34] tbuehlmann: like "Anything may change at any time. The public API should not be considered stable."?
[07:49:21] bricker`LA: tbuehlmann: Yeah but when do I change it from `0.0.1` to `0.0.2`, for example?
[07:49:27] bricker`LA: It suggests: "The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release."
[07:49:31] bricker`LA: but that still isn't totally clear
[07:49:52] tbuehlmann: yup, it's totally up to you
[07:49:57] bricker`LA: tbuehlmann: I know that
[07:50:11] bricker`LA: tbuehlmann: but I like SemVer because it makes the decisions for me :P (mostly)
[07:50:47] tbuehlmann: and we all like it when people use it correctly
[07:51:35] tbuehlmann: I wish rubycore devs would do so, too. not like their crappy SemVer-_like_ version for >2.1.0 :(
[07:52:59] bricker`LA: yeah, but Ruby has been around much longer than SemVer, so you can't really blame them
[07:55:30] pipecloud: They're adopting it, but they're doing it wrong too.
[07:55:48] tbuehlmann: no, I totally blame them since they just decided to use that versioning scheme
[07:55:53] pipecloud: At least rubygems won't require full rebuilds between ruby versions. They'll share them.
[07:57:40] tbuehlmann: I mean, it's okay, they can what they think is the best. but people should stop calling it SemVer, because it's not SemVer. it's SemVer-like at most
[07:58:43] bricker`LA: yeah, they never actually said they're using semantic versioning, only that their new policy is based on it
[07:59:38] bricker`LA: https://gist.github.com/sorah/7803201 lol "follow Semantic Versioning basically"
[08:06:20] tbuehlmann: ruby-lang.org headline: "Semantic Versioning starting with Ruby 2.1.0" - but it gets clearer in the text
[08:06:48] bricker`LA: yeah that is confusing I guess
[08:06:56] pipecloud: It's just not the semantics we all know and love.
[08:21:27] MrHeavy: Is Capistrano 3.0 generally considered good enough for production use yet, or should I be sticking with 2.x on new projects?
[08:29:39] bricker`LA: MrHeavy: stick with 2.0 unless you deploy process is really really simple
[08:30:00] bricker`LA: MrHeavy: the latest 3.0 is missing some pretty essential configuration options
[08:30:04] MrHeavy: Sounds good
[08:30:16] MrHeavy: Yeah, I asked specifically because of the difficulty in getting SSH keys into 3
[08:31:15] bricker`LA: MrHeavy: I do really like the changes, overall - especially the callbacks. They're much more clean in cap 3. But it's just not ready to be used for complicated deployments.
[09:28:36] lxsameer: hi i created two gems A and B, A have some generators, I use A in B, but i can't use A's generators in B because B did not see them (rails g) how can i debug this issue
[09:44:12] lxsameer: is there any debugger (like pdb for python) for ruby ?
[09:48:37] pontiki: also debugger
[09:48:42] pontiki: but pry is better
[09:48:49] lxsameer: pontiki: how can i use pry like a debugger ?
[09:49:34] alex88: lxsameer: http://pryrepl.org/
[09:49:46] alex88: there are some examples also here https://github.com/pry/pry
[09:50:45] certainty: pry doesn't support single steping out of the box though
[09:51:07] certainty: and no breakpoints
[09:51:20] AxonetBE: I have an array that returns me 1 object profile_search, if I do count on this I got 9
[09:51:32] AxonetBE: the first time I run profile_search.size I got 9, the second time I got 1?
[09:51:39] AxonetBE: somebody that can explain me this?
[09:51:49] certainty: must have changed :)
[09:52:31] AxonetBE: certainty: I run it on the same line in my debugger...
[09:52:57] certainty: well the object's internal state might have changed
[09:53:19] AxonetBE: https://gist.github.com/DriesS/8217076
[09:53:45] certainty: we're in evil oo land. No such thing as referential transparency
[10:03:21] Dense: I'm having some problems with Action Controller parameters. I think it might be simple to solve but I've been stuck on it a few hours. Here is the the gist with some details: https://gist.github.com/mikelorant/726ba4488bb6019aca22
[10:03:36] Dense: Appreciate anyone being able to spot what I am doing wrong.
[10:08:37] elaptics: Dense: can you gist your actual code where you're having the problem, along with the actual logs showing the params passed and errors raised?
[10:08:53] Dense: that is pretty much it
[10:09:10] elaptics: Dense: the obvious missing one is that you're not requiring or permitting event_id
[10:09:28] elaptics: Dense: you'd also want to require :changes and then permit! it
[10:09:37] Dense: heres the thing
[10:09:37] Dense: i never allowed it normally
[10:09:49] elaptics: what do you mean?
[10:09:50] Dense: params.permit(:changes).permit!
[10:09:50] Dense: its there at the bottom
[10:10:05] elaptics: Dense: yes, it should be params.require(:changes).permit!
[10:10:20] Dense: but i dont want to make it a requirements
[10:10:23] elaptics: Dense: the main thing is, are you doing several params statements in your controller?
[10:10:42] elaptics: Dense: this is why I want to see your exact code
[10:11:32] Dense: requirement
[10:11:32] Dense: its optional
[10:11:32] Dense: well this is a params function but yes
[10:11:32] Dense: ok lemme gist the entire block
[10:12:29] Dense: There you go. Appreciate you taking the time to help. https://gist.github.com/mikelorant/d2bde6929c03558bbf9a
[10:13:12] Dense: changes is optional but note is mandatory, thats where I am getting really confused.
[10:13:57] Dense: lemme gist an exact error too
[10:16:21] elaptics: Dense: ah, yeah it's because you're doing two params things in your note_params method so the result is that you're only permitting the :changes stuff
[10:16:53] Dense: thats what i thought
[10:16:57] Dense: i dont understand how to have multiples
[10:17:13] Dense: the githib shows an example
[10:17:16] Dense: but it didnt seem to work
[10:17:24] elaptics: Dense: either you need to combine everything you need into one set of calls or split it out into multiple methods to deal with each part and pass those around as needed
[10:17:51] Dense: This is what it says on the github
[10:17:51] Dense: If you want to make sure that multiple keys are present in a params hash, you can call the method twice:
[10:17:51] Dense: params.require(:token)
[10:17:51] Dense: params.require(:post).permit(:title)
[10:18:13] elaptics: Dense: can you point me to that?
[10:18:17] Dense: This came from here: https://github.com/rails/strong_parameters
[10:20:29] Dense: i guess i could merge the params together and split them on the other side :)
[10:20:40] Dense: but that seems so hacky
[10:23:21] elaptics: Dense: you want all 3 top levels included in the single params hash to pass around?
[10:23:32] Dense: that would be great
[10:23:40] Dense: but i really need to make sure changes is optional
[10:23:44] Dense: and the others are required
[10:24:23] Dense: theres no reason i cant put the changes inside note though... i dont really mind, mostly just confused why it doesnt work though.
[10:27:14] elaptics: Dense: I haven't tried that myself - but I do know that using #require effectively only returns what's required so I don't think that calling it multiple times would actually work
[10:27:41] Dense: documentation is very unclear
[10:27:55] elaptics: Dense: the best thing to do would be to test it out in a rails console
[10:28:11] Dense: I can do that. Good idea.
[10:28:25] elaptics: Dense: here's the gist of a talk I did on strong params which has some info on how to do that https://gist.github.com/andyh/54561365f16d7c65d22f
[10:28:30] Dense: Do you think it is worth posting an issue on the strong_parameters repo?
[10:31:55] bricker`LA: What is the difference between these two methods:
[10:31:57] bricker`LA: https://github.com/guard/guard/blob/f8d0d695777fe62f9559d8cbb7e07463bddcfdce/lib/guard/plugin/base.rb#L91
[10:32:01] bricker`LA: https://github.com/guard/guard/blob/f8d0d695777fe62f9559d8cbb7e07463bddcfdce/lib/guard/plugin/base.rb#L107
[10:32:16] bricker`LA: one runs on "file changes", and the other on "file modifications"
[10:33:34] Dense: Sorry about that, dropped out.
[10:33:38] bricker`LA: changes handles additions, removals, and modifications
[10:35:00] bricker`LA: and it looks for run_on_modifications and runs that if it's define, otherwise runs run_on_changes
[10:35:08] bricker`LA: \o/ problem solving :tmyk:
[10:35:11] Dense: Oh! LOL... changes is a special word.
[10:37:32] elaptics: Dense: it is for models
[10:37:46] Dense: yeh im getting a dangerousattributeerror
[10:50:12] bricker`LA: https://github.com/bricker/guard-gradle \o/ my first guard plugin, I'd like to thank the academy, mom, dad, the producers... I love you all!
[11:04:48] lxsameer: is there any trick to use a gem from git inside another gem ? my gem can't require the other gem files
[11:19:39] bricker`LA: lxsameer: put it in the gem's Gemfile, of course this is a Bad Idea but you already know that
[11:20:54] bricker`LA: lxsameer: that won't work for releases though, but that's an intentional anti-feature
[11:25:03] krz: is it better to serve assets on s3?
[11:26:50] lxsameer: bricker`LA: currently it is in gemfile but still i can't do ("require 'myengine'")
[11:31:30] bricker`LA: krz: better than what?
[11:31:56] krz: better than christmas pudding
[11:32:01] bricker`LA: lxsameer: If you're trying to require it from another app (i.e. not the gem for tests or whatever), then the only option is to add it to the app's Gemfile.
[11:32:07] pontiki: nothing is better than christmas pudding
[11:32:39] krz: yea will probably serve assets on s3+cloudfront for better edge latency
[11:33:32] lxsameer: bricker`LA: hmmm, I have A and B gem, i want to use A inside B, so i added A to gemfile of B with a git option. and i required it in B/lib/B.rb like (require "a") but it's not working
[11:36:23] bricker`LA: lxsameer: that won't work because the Gemfile doesn't get used when the gem is installed. It's only used for running tests/development.
[11:37:21] lxsameer: bricker`LA: i see, I will use A gem in production from actual gem file, but i can't use it even in development
[11:38:00] bricker`LA: lxsameer: Release the gem to rubygems then you can specify it as a dependency as normal.
[11:38:04] krz: pontiki: christmas pudding with dairy cream. is better than just christmas pudding :-P
[11:38:31] bricker`LA: lxsameer: I mean development of the Gem
[11:38:36] bricker`LA: not development of your app
[11:38:43] lxsameer: bricker`LA: thanks, but for improving my knowledge, is it ok to append the "A" path to $load_path manually ?
[11:39:27] bricker`LA: lxsameer: Don't do that. It's hard to decipher what you're trying to do, A and B gems isn't helping.
[11:40:13] lxsameer: bricker`LA: yeah its really hard to explain ,
[11:40:35] lxsameer: bricker`LA: what do you usually do when you want to develop two or more gems at the same time
[11:43:28] bricker`LA: lxsameer: I write tests.
[11:43:32] bricker`LA: for each gem
[11:44:01] lxsameer: bricker`LA: hmmm i do that too , my gems have dependencies to each other
[11:44:33] bricker`LA: lxsameer: two gems that depend on each other makes no sense.
[11:44:40] bricker`LA: lxsameer: it should just be one gem.
[11:45:42] lxsameer: bricker`LA: thanks buddy
[11:45:54] lxsameer: bricker`LA: and good work on that guard plugin ;)
[11:50:09] rubyracer: I have a form to create a model object but the rails params only contains the ID and the form post data doesnt get automatically populated in the params
[11:50:15] rubyracer: do I have to manually read the FORM post data and then include it in the params?
[11:50:42] helpa: rubyracer: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[11:50:42] elaptics: rubyracer: !code
[11:53:02] rubyracer: elaptics, http://paste2.org/WhpaJf8A
[11:53:35] rubyracer: elaptics, The sw_interaction_params only contains the id as of now. But the posted form data has all the variables in the form
[12:07:28] elaptics: rubyracer: you need to allow everything using strong params that you want passed into the object
[12:10:25] rubyracer: elaptics, How do to that :|
[12:12:52] helpa: rubyracer: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[12:12:52] elaptics: rubyracer: !gist your full controller and model code along with the form view
[12:45:55] chrisan: any downside to running rails 3.2.16 on ruby 2+ ?
[12:46:57] tubbo: chrisan: haven't seen anything notable
[12:47:01] tubbo: you should be OK
[12:56:12] pduersteler: I am struggling a bit, I have a little app working on bootstrap 2.3, how do I set up the gemfile to not have bundler update it to bootstrap3? even with gem 'bootstrap-sass', github: 'twbs/bootstrap-sass', branch: '2.0-stable' I get v3
[13:01:49] BrazenBraden: I did this a while ago but forgotten how and I cant seem to find the resourced I had before in order to get this to work.. im doing a jquery 'ajax:success' on a remote: true form and respond_to format.json { render json: {var: myVar.name}} but I cant seem to pull out the variable data on the JS side... got a good resource for this I can read?
[13:03:02] BrazenBraden: https://gist.github.com/brazenbraden/ac3cbe7e2418379d7513
[13:08:08] tubbo: BrazenBraden: so are you seeing those "DATA:" log lines? is JS making the proper ajax request?
[13:08:35] BrazenBraden: when I log the data I get the full html template.. not my vars
[13:09:08] tubbo: BrazenBraden: ah, maybe your form isn't requesting the right Content-Type. if you're expecting JSON, it should be application/json.
[13:09:31] tubbo: BrazenBraden: to trigger the proper content type, you probably want to do `POST /sizes.json` instead of just `POST /sizes`. seems as though by default it's spitting HTML back at you
[13:10:30] BrazenBraden: tubbo: i dont remember doing anything like that before.. by setting the remote: true option on the form, it should automatically format things into json (at least that is what Ryan says)..
[13:11:14] tubbo: BrazenBraden: nope, all `remote: true` does is enable the form to be submitted asynchronously with some params in the <form> tag
[13:11:57] elaptics: BrazenBraden: I can't remember exactly but I'm pretty sure I've had to specify the type in the js call on occasion to have it work properly - I think maybe jquery changed at some stage with what it was guessing or defaulting to
[13:12:15] tubbo: BrazenBraden: the reason is because it's possible you may just want to return HTML instead of JSON. iirc, Basecamp does not use JSON in their responses, they just serve HTML and place it somewhere on the page.
[13:12:21] BrazenBraden: hmm... will look into that.. otherwise, is my respond_to block alright?
[13:12:32] RubNoob: good morning - can anyone point me at a good resource for serving mp4 files from a Rails application?
[13:12:36] tubbo: BrazenBraden: looks ok to me
[13:12:49] elaptics: BrazenBraden: yep, other than if your save fails you're going to get html back either way
[13:12:50] tubbo: RubNoob: http://api.rubyonrails.org/ :P
[13:13:08] elaptics: BrazenBraden: well, more accurately your redirect will not happen if it's a js request
[13:13:09] BrazenBraden: elaptics: my save isnt failing. it works
[13:13:14] tubbo: RubNoob: you can send_file from within a controller action. that said, it's a terrible idea...just store them on S3 and CloudFront or some other CDN.
[13:13:21] BrazenBraden: elaptics: I know.. I dont want the redirect for json
[13:13:40] elaptics: BrazenBraden: you just want it to silently fail in js?
[13:14:04] tubbo: it won't silently fail in js
[13:14:21] tubbo: oh wait maybe it will :)
[13:14:41] pduersteler: I am struggling a bit, I have a little app working on bootstrap 2.3, how do I set up the gemfile to not have bundler update it to bootstrap3? even with gem 'bootstrap-sass', github: 'twbs/bootstrap-sass', branch: '2.0-stable' I get v3
[13:14:45] BrazenBraden: elaptics: I never want to fail in js :P What im doing is running to the controller to save a value.. that works fine. ajax:success gets triggered fine. I just want to get the variable back that I just saved so I can update a select box in the view
[13:14:46] tubbo: BrazenBraden: typically the best practice is that you *always* return the same status code.
[13:14:59] RubNoob: tubbo I have placed the mp4 into the assets/videos directory, added the assets/video directory to the assets path in application.rb, and used the video tag in the HTML - I see a video box, but nothing plays (and no errors on the server)
[13:15:42] tubbo: RubNoob: 404s?
[13:15:53] tubbo: RubNoob: what file is the video player looking for?
[13:16:18] elaptics: pduersteler: if you have specified a specific version for the gem in the Gemfile and bundle'd then I can't imagine you'd be getting a newer version
[13:16:44] tubbo: pduersteler: you need to do `bundle update bootstrap-sass` to trigger that change to Gemfile.lock
[13:17:25] RubNoob: there are no 404s, and it appears the video is loading, however, when I try to click the play button, it grays out and no video actually plays
[13:17:27] tubbo: pduersteler: it's probably best to just do `gem 'bootstrap-sass', '~> 2.0'`
[13:17:58] tubbo: RubNoob: hmm, well if you see the GET request for the video succeeding, and the player is there...i don't think this is Rails' problem anymore.
[13:18:04] pduersteler: hmm, let's try
[13:18:51] RubNoob: tubbo ok, I think I found *part* of the issue - I was serving a mp4 file directly, when I should have been serving an m4v file - now the audio plays, but I get no video?
[13:18:54] tubbo: RubNoob: seems like a weirdness on the client side. i remember reading that H.264 MP4 is very close to being available in all (modern) browsers, but as of right now i still think you have to transcode your videos for playback on any browser.
[13:19:21] pduersteler: tubbo: it says it's using when bundling, but it clearly is bootstrap3 style..
[13:19:50] tubbo: RubNoob: what's your browser? figure out what your browser needs to display the video, then you probably want something like http://zencoder.com/ to transcode the video to a format that other browsers can consume.
[13:20:39] tubbo: pduersteler: what version does bootstrap.css say?
[13:21:18] RubNoob: tubbo I am using Google Chrome
[13:21:51] tubbo: RubNoob: look up how chrome deals with web video. could also be a problem with the player.
[13:21:57] tubbo: pduersteler: you're on bootstrap 2.3.2 then :)
[13:22:19] tubbo: pduersteler: unless there's *another* bootstrap.css file being loaded (you'd be able to see that in the Network tab of your dev tools)
[13:23:55] pduersteler: tubbo looks like formtastic-bootstrap kills something...
[13:24:39] pduersteler: yep, works, as I have also tied formtastic-bootstrap to a version
[13:30:38] j0llyr0tten: i'm trying to use imagemagick in rails ... it works from the console (bin/rails c) but not from within a controller
[13:30:42] lxsameer: how can i make an application template for rails plugins ?
[13:30:46] j0llyr0tten: require 'RMagick'
[13:30:56] j0llyr0tten: include Magick fails in the controller
[13:31:48] tubbo: j0llyr0tten: why? (gist the error)
[13:46:42] tubbo: note to self, don't tell people at parties you're a programmer
[13:46:52] tubbo: otherwise at least 3 people will try to poach you from your current gig :P
[13:49:40] diegoviola: what if that person is a brogrammer?
[13:53:26] snapr: Is it okay for a lib to depend on a specific model?
[13:56:29] snapr: I have a text analyzer that depends on filters to work. These filters are currently read from a CSV, but I want to move it to RoR with a DB. Now the text analyzer is a library, but it requires the filters from the controller<model<db. Is it okay to have a specific model for a lib or should a lib be more general/not have a dependency on a special kind of model?
[13:58:06] BrazenBraden: finally got it
[13:58:19] BrazenBraden: what a pain in the bumhole
[13:58:58] koneko: snapr, If the model is in the lib directory, not in the app/models directory, then I think it's okay. Delayed Job does something similar off the top of my head - it requires that a table exists in the database and it uses the table, but you need to run the migration yourself I think.
[13:59:52] koneko: Although it is self-sufficient, doesn't require any model from the app you're using it in (except for the models used in the scheduled job)
[14:00:31] tubbo: koneko: you just can't name your AR model "DelayedJob", otherwise you'll have to set `self.table_name` :)
[14:01:24] tubbo: hey momomomomo
[14:04:36] koneko: tubbo, I don't know if they even use ActiveRecord in DJ, my point is if the model the library requires resides in the library itself, not in the app/models directory, then it should be okay. There's a number of ways how to solve the database communication within the model.
[14:05:46] snapr: koneko: thanks! I was creating a gem with bundler from scratch, but I should rather use "rails plugin new", right?
[14:06:24] BrazenBraden: tubbo: you right... my controller doesnt know if it should respond_to html or json.. when I remove the format.html stuff and leave the .json, it works fine, but when I put it back, it responds with the html...
[14:08:23] tubbo: BrazenBraden: yeah, your form action is probably pointing to the html variant of the route. make it point to the json variant by passing url: whatever_your_routes_path(format: 'json')
[14:08:41] tubbo: this should generate <form action="/whatevers.json">
[14:09:05] BrazenBraden: tubbo: i will have to add that with ajax because I use this form in two places.. one it must be html, and this one json
[14:09:10] tubbo: snapr: either way will work. `rails plugin new NAME --mountable` is nice for generating the Rails::Engine helper.
[14:09:47] tubbo: BrazenBraden: nah, don't do that...pass the data you need into the partial with local vars
[14:10:16] BrazenBraden: tubbo: hmm problem is I am loading the form into a modal window
[14:30:28] BrazenBraden: tubbo: this did it: .attr('data-remote', 'true').attr('data-type','json')
[14:31:20] elaptics: BrazenBraden: ah yeah, that's what I've done before to make sure it's doing it correctly - can't work out if it's jquery or rails which is the problem - or whether things have just generally changed
[14:32:08] BrazenBraden: elaptics: not sure.. thought it was a rails default with UJS that when you used remote true, the default was to respond in json
[14:32:43] BrazenBraden: but wowee that took me 4 hours to figure out! lol
[14:33:51] snapr: I want to save a lot of sets of one type of model at once. I found "Transactions", but I dont need the queries to be atomic. I'm just asking if there is a way to run multiple queries (INSERTs) at once. Any hints?
[14:37:59] CorySimmons: Hey guys, is it possible to simply remove all the files created with a rails generate command?
[14:38:24] CorySimmons: For instance, I did `rails g model Foo` and now I want to delete all the files associated with it
[14:38:41] CorySimmons: I haven't ran `rake db:migrate` yet
[14:38:53] CorySimmons: Didn't know if there was some magical command to do this
[14:39:23] elaptics: CorySimmons: there's a rails destroy command
[14:39:47] CorySimmons: elaptics: Perfect! Thanks
[14:44:04] tubbo: BrazenBraden: that's strange, but data-type: 'json' is a much easier way of supplying the format of the route imo
[14:44:11] tubbo: err, that's data-type="json"
[14:45:04] tubbo: snapr: you can run as many INSERTs as you have workers configured for your DB. once the workers are used up, then you'll experience lag.
[14:45:42] tubbo: snapr: but one big feature of most databases is that they lock on mutations.
[14:47:40] snapr: I dont get the last sentence
[14:48:59] tubbo: snapr: so when you INSERT, UPDATE or DELETE data in a SQL database, it will ensure that no other queries (like SELECT) can be run against the data. this is to ensure data integrity...so that it doesn't matter what time you want the data, it's always going to be correct.
[14:49:35] tubbo: snapr: for example, let's say you and i were both accessing your site's admin panel. you edit a piece of data and i delete the same bit of data. who is right? :)
[14:49:48] tubbo: i shouldn't be able to clobber YOUR edit with my delete.
[14:51:13] snapr: Alright. Using a loop to save all of the items is no problem. I'm just curious if there is a more performant way/If there is a possibility to do a multi-insert: INSERT INTO table_name
[14:51:13] snapr: VALUES (value1,value2,value3,...);
[14:51:37] snapr: oops, there was a linebreak in the pasted text
[14:52:26] tubbo: snapr: i wouldn't, just because it's probably better to run all the models' rails validations before saving them.
[14:53:09] snapr: Validation is done before saving, not when creating?
[14:54:30] tubbo: snapr: creation is included in "before saving"...you have to save it to create it right? :)
[14:55:10] tubbo: and unless you explicitly set at which points something is to be validated, validations on your model will run every time you try to save the model.
[14:56:07] snapr: I was talking Model.new(data), that creates a instance, but doesn't save
[14:56:59] snapr: So what I was thinking is that I could batch-create the objects, then batch verify (maybe both at the same time) and after that insert as a bunch
[14:58:09] tubbo: snapr: so what problem are you trying to solve here?
[14:58:55] tubbo: your initial idea of just using a loop makes the most sense to me, fwiw. unless you can prove that you actually need batch insertion functionality. in other words, are you like inserting a THOUSAND rows at once? :)
[14:59:28] tubbo: in the web paradigm, you can make decisions based on human understandability, not machine efficiency.
[15:02:31] snapr: about 6000 inserts, but all rather small about 300-500 chars each
[15:03:11] snapr: Performance is not a requirement for what i do, so I can go with the loop. I am just curious how and why it might or might not work differently
[15:26:04] ziikutv: Are these guides available in pdf format? http://guides.rubyonrails.org/
[15:28:47] wmoxam: ziikutv: Yes! http://html2pdf.fr/en/default
[15:29:49] ziikutv: wmoxam: Yes i know that exists, i could've got the mobi file they provide and just converted that but an official pdf would've been much more appreciated.
[15:31:17] wmoxam: ziikutv: there is no 'official' pdf
[15:31:52] ziikutv: I was planning to print all 1000+ pages of the mobi file but that seems stupid now doesn't it? since they are updated a lot
[15:32:53] tubbo: ziikutv: lol yeah...unless you feel like diffing the guides and printing out the changed pages. you'll probably go through like 2 boxes of paper and who knows how much ink every year
[15:33:06] tubbo: ziikutv: what's the point?
[15:33:50] ziikutv: yea no point at all :p
[15:52:38] Iszak: Is 4.1.0 stable enough to use?
[15:53:34] wmoxam: Iszak: some people consider it to be
[15:53:55] wmoxam: Iszak: you need to be willing & able to troubleshoot on your own though
[15:54:09] wmoxam: as you won't get much help here :p
[15:54:52] ziikutv: Guys when I do <%= form_for :post do |f| %>
[15:55:04] ziikutv: does :post represent the POST Method or does it represent the Post model?
[15:55:37] khoury: hi everyone
[15:55:38] blowmage: ziikutv: post model
[15:55:41] snapr: ziikutv model
[15:55:47] snapr: so close....
[15:56:17] khoury: I have a tiny little problem in my rails app..
[15:56:32] shevy: could be worse
[15:56:35] shevy: could be a big problem
[15:56:40] khoury: a little bit of javascript that should execute on home#index
[15:56:50] khoury: shevy: haha absolutely
[15:57:33] khoury: So, looking at this code. Why do I need to refresh the page for it to run?
[15:57:35] khoury: https://gist.github.com/anonymous/8221276
[15:58:03] ziikutv: then when I make that form how does it say create action is missing inside the post controller? How does it relate to post controller's create action
[15:59:02] ziikutv: or is that because it is the typical setup? Quoting ruby guides ypically in Rails, the action that is used for new form submissions like this is called "create", and so the form should be pointed to that action.
[15:59:27] tubbo: khoury: well, i'm pretty sure you're calling the event improperly
[15:59:28] snapr: ziikutv: you answered the action yoruself :D
[15:59:34] snapr: *the question
[16:00:15] ziikutv: and when I provide the url: posts_path that just tells the form to take the user to the posts_path (as a post action)
[16:00:16] tubbo: khoury: https://gist.github.com/tubbo/8221335
[16:00:47] snapr: ziikutv http://guides.rubyonrails.org/routing.html
[16:00:56] helpa: REST - (REpresentational State Transfer) - http://en.wikipedia.org/wiki/Representational_State_Transfer
[16:01:13] snapr: have a look at the tables if you dont like to read the whole thing
[16:02:30] tubbo: khoury: it's 'page:load' not 'page:change', and you were binding to window when it should be document
[16:02:30] pontiki: tubbo, that form is deprecated after 1.8
[16:02:31] ziikutv: snapr: So I was right
[16:02:41] tubbo: pontiki: what form?
[16:02:48] tubbo: pontiki: oh the form that i just showed?
[16:03:00] pontiki: $(document).on("ready", handler)
[16:03:05] khoury: tubbo: Still the same result, reproducing the same bug. But I get your point anywya..
[16:03:16] tubbo: pontiki: ah i see.
[16:03:24] tubbo: khoury: so you're using turbolinks i assume?
[16:03:33] pontiki: $(function(){ handler }); is valid
[16:03:53] tubbo: the wrong part was 'page:change' instead of 'page:load', iirc.
[16:03:58] tubbo: that's the event Turbolinks fires.
[16:04:39] pontiki: you want it to file on document.ready() though, that's what isn't happening yet?
[16:04:47] tubbo: pontiki: $(document).on('ready', handler) is exactly the same as $(document).on('ready', function() { .. }), as far as JS is concerned.
[16:05:07] pontiki: it is, however the jquery docs say it's a deprecated form
[16:05:13] tubbo: khoury: instead of doing Shadowbox.init(), try doing alert("zomg loaded");
[16:05:21] tubbo: pontiki: well fuck those guys :)
[16:05:21] ziikutv: Guys since 2.0 hit i am not confused about symbols and hash rockets
[16:05:37] ziikutv: Whats the difference between :post and url: are they both symbols/
[16:05:41] tubbo: khoury: we need to see whether this fn is actually being called, and whether this whole thing is hiding a deeper problem
[16:05:59] tubbo: ziikutv: url: is a symbol key, :post is a symbol value. but it can also be a symbol key if you use :this => :syntax.
[16:06:13] tubbo: ziikutv: but `url:` is *always* notating a symbol for a key.
[16:06:44] khoury: tubbo: Yes its being loaded, three times now per page load for some very strange reason.
[16:07:05] snapr: ziikutv: It is just a shortcut, "key: value" equals ":key => value"
[16:07:07] pontiki: tubbo: "There is also $(document).on( "ready", handler ), deprecated as of jQuery 1.8. This behaves similarly to the ready method but if the ready event has already fired and you try to .on( "ready" ) the bound handler will not be executed. Ready handlers bound this way are executed after any bound by the other three methods above."
[16:07:11] khoury: tubbo: But even if using page:load, the function only works after a manual page refresh
[16:07:20] pontiki: so, yeah, fuck those guys
[16:07:32] snapr: ziikutv: confused me as well :D
[16:07:51] ziikutv: snapr: So what I just keep going on in the tutorial and assume its a DSL :S
[16:09:17] ziikutv: snapr: I meant the :Post being a key value.. since it has nothing on the left.. its like a DSL (or i'd like to think of it that way)
[16:09:44] rehat: is it possible to validate that a model has at least 2 associated models?
[16:10:56] elaptics: rehat: you can write your own custom validator methods to validate whatever you want
[16:15:17] khoury: tubbo: the code get executed and works if I refresh the page, or first time I land on the page (its the front page), but If I go to the page from random_page.html thorugh a link, the script does not work.
[16:15:44] khoury: so page:load does not do it either.
[16:17:05] khoury: I also tried $(function(){ // code }) and $(document).ready(function.....), and $(document).on('load', function....)
[16:17:13] khoury: doesn't work :/
[16:18:57] pontiki: anything showing up in the JS console?
[16:19:26] lethjakman: are global variables really evil? or is that the only way to set something up in an initializer to be used somewhere else?
[16:19:44] tubbo: khoury: on the README for turbolinks, it says to use 'page:load': https://github.com/rails/turbolinks
[16:20:01] elaptics: lethjakman: evil is a strong word - what is it that you're wanting to do?
[16:20:04] tubbo: khoury: so i'm gonna go out on a limb here and say the JS is never getting called.
[16:20:31] lethjakman: elaptics: I want to share my redis
[16:20:41] lethjakman: so I made a variable in there with the connection and passed it around
[16:20:42] tubbo: lethjakman: i've never seen a global variable actually in use by anything other than the Ruby language, by a professional. :)
[16:21:08] lethjakman: I know global is more evil outside of ruby, but the ruby channel seems to think poorly of it too
[16:21:09] tubbo: lethjakman: you can just do `SocketConnection = SomeSocketAPI.connect`
[16:21:21] tubbo: in an initializer, and it will be there for your whole rails app
[16:21:24] tubbo: no $global needed.
[16:21:55] lethjakman: wait so initializer variables are inherently shared?
[16:22:01] terrellt: Er, that's effectively the same thing, no?
[16:22:32] lethjakman: not quite...
[16:22:39] lethjakman: a global variable is a symantic from the language
[16:23:00] lethjakman: what he's saying sounds like rails runs the initializers and just passes the variables down.
[16:23:20] tubbo: there's not really any "passing" going on. just imagine all of the files are just one giant ruby script
[16:23:26] terrellt: What he wrote is assigning a constant to it.
[16:23:47] lethjakman: that makes sense
[16:23:56] khoury: tubbo: changed it to this one line: document.addEventListener("page:load", Shadowbox.init()); STILL doesn't f-ing work when coming to the page from a link. Well thx anyway.
[16:24:30] tubbo: khoury: hey you know, you never *actually* told me the problem you were trying to solve. "doesn't fucking work" isn't fucking satisfactory.
[16:25:18] tubbo: khoury: alternatively, you could just eschew all of that and write <script> Shadowbox.init(); </script> after the DOM element is in place.
[16:25:26] tubbo: khoury: since, you know, you're writing an inline <script> tag anyway. :)
[16:25:43] tubbo: might as well just use a "natural dom ready" and place the <script> right before </body>..
[16:28:29] khoury: None of your alternatives is a working alternative, so therefore they kind of make no sense at all. Nothing personal, just an objective fact of the situation.
[16:30:28] terrellt: khoury: To be fair, tubbo's last statement is kind of "best practice" nowadays for document ready.
[16:32:30] jcutrell: Hey folks. I have an RSpec testing question.
[16:32:48] jcutrell: I have a model that has particular attributes that should only be updated by the admin
[16:32:54] tubbo: khoury: so when you say "doesn't work"...what do you mean?
[16:33:03] tubbo: khoury: nothing happens? any errors in console?
[16:33:04] jcutrell: user roles, specifically.
[16:33:06] tubbo: (rails or JS)
[16:33:38] tubbo: khoury: this syntax, `document.addEventListener("page:load", Shadowbox.init());` is also incorrect.
[16:33:46] khoury: Nope, nothing.
[16:33:56] tubbo: you want document.addEventListener('page:load', function() { Shadowbox.init() });
[16:34:19] tubbo: khoury: init will have to take at least an `event` argument for your code to work, and you have to specify it as Shadowbox.init (without parens)
[16:34:37] terrellt: What's a good model versioning gem out now?
[16:35:05] jcutrell: So, I want to update the roles as an admin only. I'm using CanCan for ability authorizations, and I'm using strong parameters to define what attributes will be accepted during the update based on the current_user's role. The question is, can I test this behavior in a unit test, or should I leave that to integration testing? It seems like a unit test scenario, but maybe it's just outside of that realm.
[16:35:39] tubbo: khoury: what happens if you get rid of Turbolinks? that might be the source of your problems.
[16:36:39] tubbo: jcutrell: to test that i usually "log in" as a non-admin user in a controller test, and try to make a request that mutates data i shouldn't be able to touch. and i test whether i get a 403 response back.
[16:36:40] bratsche: I removed turbolinks from my latest app and I'm much happier as a result. :)
[16:36:55] makerop: what is a good pattern for adding unlimited attributes to a model
[16:37:03] tubbo: ACTION has never used turbolinks but is able to help people in #ror because of the sheer number of complaints and confusion arising from the way it works.
[16:37:12] tubbo: seriously. never, ever used it.
[16:37:14] bratsche: makerop: hstore?
[16:37:16] jcutrell: tubbo: So that would be integration, no? (I'm very new to testing.)
[16:37:18] makerop: the attributes are regex patterns if it matters
[16:38:06] jcutrell: makerop: "meta" models, probably, in conjunction with polymorphic associations.
[16:38:11] khoury: tubbo: I don't think it should be the problem. You see the code is working ("working" as in doing what it should) when I manually refresh the page first, OR the first time I enter the page. But NOT when I go to some other page and then click on my cool home-button.
[16:38:14] tubbo: jcutrell: that would be a controller test, which is kind-of like a unit test. it's not *really* an integration test because it mocks out the HTTP layer (so there's a lot of stuff you can't test), that's why we have Capybara.
[16:38:16] jcutrell: makerop: In other words, have a master "Foo" model.
[16:38:19] terrellt: makerop: hstore if you're using postgres.
[16:38:33] bratsche: tubbo: I used it in my previous app, and it works "fine" I suppose. But I just don't like it. It's kind of awkward to use, and imo it creates kind of a weird user experience. Occasionally it totally hangs and when you click a link nothing happens.
[16:38:46] makerop: cool thanks, hstore looks like the way to go
[16:39:03] jcutrell: tubbo: Interesting. So, I'm currently building out my RSpec foo_spec.rb files,
[16:39:20] tubbo: khoury: that's why i think it's a problem. if you can get Shadowbox.init() to fire on a $(document).ready(), you SHOULD be able to get it working with $(document).on 'page:load' as well. except you can't. the 'page:load' event is provided by Turbolinks, so what makes you think it's something other than Turbolinks causing this problem?
[16:39:21] jcutrell: tubbo: I'm assuming this isn't the place for those.
[16:39:47] tubbo: jcutrell: well, i don't use cancan and i know you specify role permissions on the model, right?
[16:39:52] tubbo: s/and/but
[16:40:08] jcutrell: Sorta kinda.
[16:40:12] jcutrell: It's kind of a strange set up
[16:40:19] jcutrell: you have an ability.rb
[16:40:23] jcutrell: which defines abilities.
[16:40:44] jcutrell: that doesn't really help you when you want a per-attribute ability definition.
[16:40:58] jcutrell: So, instead, you have to define those specifically in the... there it is... controller.
[16:41:06] jcutrell: (Hence controller testing.)
[16:41:41] bratsche: khoury: The pattern I've used for turbolinks is to do: $(document).ready(setup); $(document).on('page:load', setup); And then have all your JS initialization stuff in function setup() { ... }
[16:43:52] candelabra: If I'm running RVM and passenger in apache and my gems update passenger, do I need to change the apache config file to load the updated passenger module directory?
[16:43:53] bratsche: khoury: There are also some libraries that don't work right if you initialize things twice, so you'll need a guard variable has_setup = true and check that when running setup, but for most things that's not necessary.
[16:44:32] FooBarWidget: candelabra: that depends. do you want to use the new passenger or do you want to stick with the old one?
[16:44:54] terrellt: FooBarWidget: Lol.
[16:45:17] FooBarWidget: it's a serious question. if he does nothing then apache will continue to use the old passenger
[16:45:26] FooBarWidget: as long as you don't remove the old gem, it won't cause any problems
[16:45:30] khoury: bratsche: I get an error saying that document has no method 'on'. But changing that to $(document).load(setup); works - except not when coming to the page from another page. So still the same bug. I have to refresh the page.
[16:45:46] FooBarWidget: if you want apache to use the new passenger, then in addition to updating the gem, you must also re-run passenger-install-apache2-module
[16:45:56] FooBarWidget: which, in turn, will tell you what to update PassengerRoot to
[16:46:30] tubbo: khoury: what version of jQuery are you using?
[16:46:31] bratsche: khoury: Not load, $(document).ready(setup) and $(document).on('page:load', setup)
[16:47:00] terrellt: Before I start using this, anyone have opinions on papertrail? Good gem? Any problems?
[16:47:01] khoury: Yes, and so that give me an error.
[16:47:21] tubbo: if it doesn't have on() it's *way* too old.
[16:47:24] bratsche: khoury: Must be a very old jQuery if you can't do $(document).on
[16:47:29] khoury: bratsche: Uncaught TypeError: Object [object Object] has no method 'on'
[16:47:35] tubbo: khoury: update jQuery
[16:47:39] tubbo: then this will work
[16:47:49] tubbo: figured out yer problem! you can probably use Turbolinks too
[16:48:09] bratsche: Yeah, use turbolinks. It's the best way to convince you not to use it. ;)
[16:49:08] tubbo: bratsche: nah, i'm pretty sure turbolinks is "working" but just doesn't support ancient versions of jQuery. it's a little weird that no errors were thrown, though.
[16:49:34] bratsche: Right, I know. He needs to update his jQuery to get turbolinks working.
[16:50:04] bratsche: I'm just saying, once he gets jQuery updated and can use turbolinks then he should use turbolinks. It will convince him all by itself to stop using it. ;)
[16:50:33] pontiki: anyone know why tasks in lib/tasks don't show up in rake -T or rake -D ?
[16:51:27] bratsche: I'm not sure, I've been curious about that too. It's not just lib/tasks, rake -T is missing a number of things that are provided by Rails even.
[16:52:44] tubbo: pontiki: i do `rake -vT` and my tasks show up.
[16:53:05] tubbo: -v is "verbose"
[16:53:17] pontiki: mine still aren't
[16:53:36] tubbo: pontiki: is `which rake` pointing to the right place?
[16:54:00] tubbo: hmm, that is weird.
[16:54:23] khoury: bratsche: running latest version of jquery-rails gem. Still not able to use 'on'
[16:55:19] pontiki: they show if you do rake -AT
[16:55:24] bratsche: khoury: Are you doing document.on() or $(document).on() ?
[16:55:51] khoury: $(document).on('page:load', setup);
[16:55:53] bratsche: pontiki: Oh cool, thanks! I didn't know that.
[16:55:59] pontiki: even though the lib/tasks are documented
[16:56:29] tubbo: khoury: https://github.com/rails/jquery-rails/blob/master/vendor/assets/javascripts/jquery.js#L5601
[16:56:34] tubbo: khoury: there's the source for it.
[16:56:43] bratsche: khoury: If you open up the jquery.js file (like http://localhost:3000/assets/jquery.js or whatever) what version does it say?
[16:58:00] khoury: v1.10.2 :)
[16:58:25] bratsche: Okay, well I don't know what to tell you. It Works For Me[tm]
[16:58:29] tubbo: same here
[16:58:35] tubbo: been working since on() was introduced
[16:58:57] bratsche: Yeah me too.
[16:59:26] tubbo: so my hunch now is there is a nother jquery being loaded
[16:59:32] khoury: I guess the Interwebz God 2.0 just hates me then.
[17:00:00] bratsche: I think tubbo is right, you've got to somehow have another jQuery loaded.
[17:00:05] tubbo: nah, you're just trying to program with jquery and javascript and you don't really know how it works. this is the source of the javascript hate that is ever-so-popular.
[17:00:27] tubbo: most devs come into JS not knowing shit about it, then they try to use it and it blows up in their face, so they go "zomg javascript suxxxx"
[17:01:12] tubbo: imo it's no better or worse than any other lang, it's just very different from the shit you're used to and it masks itself as "Java-like" or "C-like" because of it's syntax, when the reality is it's very far from those languages in terms of the object model.
[17:01:31] tubbo: same way i feel about lisp, except i don't know lisp very well.
[17:01:32] bratsche: Uh, sorry I'm going to have to disagree with you there. It's definitely worse than other langs. :)
[17:02:47] tubbo: i would argue that so is LISP.
[17:03:01] tubbo: yet most hipsters will shit their pants when i make that argument
[17:03:06] khoury: tubbo: I'm not trying to offend a language here, I'm not like some kind of retarded robot. I'm really, REALLY, trying to understand how it works.
[17:03:26] certainty: lisp is better than other languages :p http://www.paulgraham.com/avg.html
[17:03:56] bratsche: tubbo: There are just so many obviously stupid things in Javascript.
[17:04:03] tubbo: khoury: it takes a while. :) i've been programming JS for a long time and only in the last couple years did i actually figure it out on a deep level.
[17:04:11] bratsche: NaN !== NaN
[17:04:13] tubbo: bratsche: ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
[17:04:17] khoury: NaNaNaNaNaNaN Batman!
[17:04:56] tubbo: certainty: oh cool, that guy who says he'll give a ton of money to someone who looks like Mark Zuckerberg says it? must be right. :P
[17:05:14] tubbo: dumbest thing i've ever heard him say was that he would give money basically on the basis of look
[17:05:17] certainty: paul graham said that?
[17:05:44] certainty: never heared of that.
[17:06:04] bratsche: imo, if your language requires a triple-equal operator then you've made horrible design decisions in it.
[17:06:37] tubbo: certainty: i'm not saying PG doesn't know what he's talking about, i just don't agree with him.
[17:07:09] certainty: fair enough
[17:07:13] tubbo: certainty: http://www.nytimes.com/2013/05/05/magazine/y-combinator-silicon-valleys-start-up-machine.html?pagewanted=all&_r=3&
[17:07:18] certainty: bratsche: many languages do
[17:07:26] tubbo: that's where he "said it", but once again this is an interview so what he said may not have been what was printed :)
[17:07:29] pontiki: i.e., skinny, white, dorky-looking males
[17:07:29] bratsche: certainty: And they suck for it.
[17:07:51] certainty: tubbo: thanks for the reference
[17:07:52] tubbo: certainty: but i believe that was an idiotic statement on his part and as a VC he should fucking know better than that. :P
[17:08:44] certainty: bratsche: nah many are sane languages that just have different types of equality
[17:08:46] khoury: bratsche: how about those african tribal languages with clicking sounds? That's like javascript IRL.
[17:08:47] bratsche: The only reason we tolerate it in JS is because we don't really have an option. If Javascript originally was a compiled language that targeted your machine (outside a browser), it would have never taken off. We've got better languages.
[17:10:00] certainty: tubbo: do you think he was serious when he said that?
[17:10:22] tubbo: certainty: look at the results.
[17:12:00] bratsche: Anyone tried using opalrb? I wonder if it's any good.
[17:13:10] tubbo: certainty: though this isn't just solely YC doing that kind of thing, i would say that it was in poor taste to publicly boast about personal prejudice.
[17:13:26] certainty: sounds likely
[17:13:33] tubbo: it's just weird to me that someone would actually think that.
[17:13:52] tubbo: like if i went out and dressed myself like Skrillex every day i'd suddenly become a famous musician? ridiculous.
[17:14:03] certainty: doesn't make sense
[17:14:10] certainty: i agree on that
[17:14:19] bratsche: Why does everyone hang on PG's every word?
[17:14:39] certainty: because he generally is a smart ass
[17:15:33] bratsche: It's not just him too. When I was doing mostly Linux stuff it seemed like everyone would fawn over Mark Shuttleworth all the time.
[17:15:51] bratsche: People with money, I guess. :)
[17:20:11] thedeeno: I've extracted my models into a gem. I want this gem to add itself to the autoloader's paths. How can I do this from within the gem?
[17:20:32] momomomomo: Ugh, #angularjs is a deadzone atm
[17:21:01] tfitts: anyone use simple_form and include fields from an association within the same form?
[17:23:49] zeknox: looking for some advice on how to handle validation errors on a form that contains multiple models
[17:25:17] tubbo: bratsche: it's called lobbying :)
[17:26:04] catphish: should dependent => destroy run an update_all? i am observing it run a select :(
[17:26:57] jcutrell: How do I get more verbose testing output? I'm using guard.
[17:27:47] elaptics: zeknox: gist some code or provide some more context - hard to advise otherwise
[17:28:03] elaptics: tfitts: pretty sure I have in the past
[17:29:01] tfitts: elaptics: I think I found what I was looking for under fields_for
[17:31:56] zeknox: elaptics: for example, if I have a validation for precense on comment, how could i display that error within this same page? https://gist.github.com/zeknox/8222818
[17:32:51] elaptics: tfitts: there's also a simple_fields_for so you can easily use the simple_form builders
[17:34:25] elaptics: zeknox: is it the render 'comments' which is the new comment form?
[17:34:48] zeknox: elaptics: yes sir
[17:35:26] elaptics: zeknox: and how is that populated? Would be useful to see that code
[17:36:02] zeknox: elaptics: https://gist.github.com/zeknox/8222893
[17:37:29] elaptics: zeknox: well you just need an errors bit in that form, you can pretty much not worry about it being nested - it just matters where you're submitting it to and the resulting view when the comment save fails
[17:38:07] elaptics: zeknox: i.e. your comments controller should manage what is displaying a failed comment in its create action
[17:38:45] elaptics: zeknox: as long as you have something in that view which displays the errors from the comment model, e.g. comment.errors.each...
[17:38:58] zeknox: elaptics: in the comments controller if I do something like render 'new' if the validation fails that will take me to a different webpage completely, is there a way to capture those erorrs on this page?
[17:40:01] elaptics: zeknox: then it sounds like you want to do an ajax form to submit via javascript instead and update the current page
[17:41:19] zeknox: elaptics: ok, i could do that in the view, but any idea how I will handle it in the comments controller on the create action if validation fails? render: ?
[17:43:14] elaptics: zeknox: the simplest option is to just have a create.js.erb template which will send back the relevant js to update the page with the re-rendered comment partial
[17:43:49] zeknox: elaptics: you know of any documentation i could read on the web, ajax, json, js is not my strong areas
[17:45:47] zeknox: elaptics: nice, never thought of just re-rendering the _comments partial only
[17:46:26] elaptics: zeknox: http://guides.rubyonrails.org/working_with_javascript_in_rails.html
[17:46:51] zeknox: elaptics: ah yes, haven't gotten around to reading this guide quite yet, i like the rails guides docs
[17:47:11] zeknox: elaptics: thanks for your time and help
[17:48:02] elaptics: zeknox: also http://www.alfajango.com/blog/rails-3-remote-links-and-forms/ and the part 2 it links to gives a pretty comprehensive guide which covers the approach I just mentioned - the rails guide shows only one option which is slightly different
[17:48:43] zeknox: elaptics: cool, looks like i have my nightly reading all picked out for me
[17:49:08] lethjakman: is there any reason to have allow_concurrency set to false in my postgres config?
[17:50:28] terrellt: elaptics: ...What? Why not just send the HTML back?
[17:51:57] elaptics: terrellt: also an option - I always hesitate to give any definitive solution for these ajax sort of things - it tends to depend too much on the required behaviour and ui and plus there's generally disagreement on what the "rails way" actually is or should be
[17:52:49] tubbo: if there is one thing i wish i could've done, it's somehow prevent that "rails way" mantra of seeing the light of day.
[17:53:11] tubbo: the idea that there is one prescribed way of making apps with a framework like rails is so wrong now.
[17:53:23] terrellt: As long as it evolves there's nothing wrong with an entry level community standard.
[17:53:27] tubbo: i think "rails is omakase" was purely designed to put the rails way to bed.
[17:53:32] tubbo: (the blog post and the saying)
[17:54:11] elaptics: agh, gotta go. Would be a good discussion :)
[17:54:12] tubbo: terrellt: my problem is when people believing in the standard so blindly that they ignore alternative ways of doing things with rails and ruby in general.
[17:54:16] tubbo: later elaptics
[17:54:31] tubbo: which limits you so much...and it blinds you from seeing how great rails actually is
[17:56:53] zeknox: at this time, i know no better, so i follow the rails way
[17:58:01] dfr|work: tubbo, don't think your rant has much to do with Rails. It's just in rails environment incompetence manifests in following "rails mantra". :)
[17:58:13] tubbo: maybe hehe
[17:58:20] dfr|work: tubbo, for example in Java it would manifest in applying various design patterns when they're not needed :)
[17:58:42] tubbo: dfr|work: ah, so it is inevitable then :)
[17:58:59] dfr|work: tubbo, yea, the world has people who suck. That's inevetiable. :)
[17:59:19] hrh: hi, i'm searching for the fastest way to implement autocomplete search with postgresql (around 15milion records). Any advice?
[17:59:55] tubbo: hrh: check out postgres fulltext search, the LIKE operator, and what '%' means :)
[18:00:11] aauthor: hrh, you might have some luck with the pg_search gem.
[18:00:12] hrh: tubbo: obviously, i did that.
[18:00:49] ace_striker: tubbo: "% " is regex operator for filling out the text between two ""%"
[18:00:52] hrh: what full text search has to do with simple auto completion?
[18:00:53] dfr|work: hrh, and if that turns out slow, maybe take a look at thinking sphinx
[18:01:43] tubbo: hrh: oh yeah...you want to use pg_search otherwise you'll have to build the queries yourself and that's no fun. all "fulltext search" means is it's a product that is comparable to sphinx, solr, elasticsearch, etc.
[18:02:04] aauthor: Hey all, our team recently switched from :ruby schema file to :sql schema file. Everything is peachy except when (say on a new dev env) we run `rake db:setup` it loads the schema fine, but it doesn't have recorded that any of the migrations have been run. Anyone run into this before?
[18:02:10] tubbo: hrh: but imo you want to try getting it working with your existing stack before you begin adding more problems like building a separate package & keeping an index synced with your regular DB
[18:02:50] hrh: tubbo: sure i don't want to build my own package. but I don't understand what full text search has to do with simple autocomplete search?
[18:02:57] dfr|work: hrh, why does the WHERE LIKE %foo% not work for you?
[18:03:15] hrh: dfr|work: it works, but it's horribly slow
[18:03:29] dfr|work: hrh, so there you got your answer. fulltext search builds indecies which speeds it up.
[18:04:37] tubbo: hrh: don't get too bent up about the "fulltext" part, it's just the name they give it. its original purpose was for use in searching TEXT columns, which as you know can't be indexed and take a while to search.
[18:04:57] hrh: alright got it
[18:05:58] dfr|work: hrh, not sure about pg_search thing, but sphinx integration is a little bit tricky, 'cause it introduces moving parts. but once you've got your general schema working, it should be pretty easy to add new queries. Talking about 1-2 weeks of work, depending on how efficient you are and how complicated your stack is.
[18:07:41] hrh: I think i'll stick to pg (not sure about the gem, but i'll check it out). How do I know what index is the best for me?
[18:08:43] terrellt: Alright, paper_trail's pretty damn cool.
[18:09:48] helpa: hrh: Why don't you try it and find out for yourself?
[18:09:48] tubbo: hrh: !try
[18:11:11] tubbo: yeah this stuff is more of an art than a science, can't really tell you what index is best for your data.
[18:12:16] aauthor: `!try` looks an awful lot like "not try" or "don't try" ;)
[18:15:02] lethjakman: how do I start thin from my passenger config? I just need it to basically run rackup...except I know that's not how it works exactly.
[18:16:28] lethjakman: I guess nginx config
[18:17:33] terrellt: lethjakman: Passenger's a replacement for thin, not a thin launcher. What are you trying to do?
[18:19:54] lethjakman: terrellt: I have a faye server and it's supposed to be better to run it from thin. I have a faye.ru I need to start/restart along with my app that's running on passenger.
[18:20:21] terrellt: lethjakman: Then you need a launcher - either an init script or something like god to keep it up. Faye can be launched via Passenger too, I believe, but I haven't done it.
[18:21:19] lethjakman: terrellt: it can, I'm not sure how well though. hmmm ok I'll look into god.
[18:21:26] lethjakman: you mean an init like when I start my server?
[18:21:29] lethjakman: just rackup it in a bash file?
[18:21:45] lethjakman: it would be preferable if passenger can be configured to run it...
[18:21:49] terrellt: No, an init.d script.
[18:21:59] terrellt: https://groups.google.com/forum/#!topic/faye-users/sIhqkpcC1Fo says don't do it, but who knows.
[18:25:23] lethjakman: terrellt: I actually read that, it's what's making me cautious
[18:27:53] jcutrell: is there a right way to handle multiple redirects?
[18:28:27] jcutrell: I want to redirect to the root_path in my controller, which, if you are logged in, redirects again to the dashboard_path
[18:28:47] jcutrell: It seems ugly to see follow_redirect! twice in a row in a test.
[18:48:51] mib_mib: hi all - i'm using activerecord w/ mysql w/ myisam, and have a question about transactions - i have a model 'A' that 'has_and_belongs_to_many' of a different model 'B'. When i call 'destroy' on an instance of model A, it properly deletes its associated record in model 'b' - i see the delete query for the model 'a', but i dont see a delete query for the model 'b' only a select query - yet its getting deleted - is this a transacti
[18:51:44] mib_mib: basically, the has_and_belongs_to records are being properly deleted, but i dont see the "delete from table_B where ..."
[18:51:57] mib_mib: i only see one delete query which is for the original model ...
[18:53:12] mib_mib: does rails not log the other 'delete from' queries ?
[19:11:30] tubbo: SirFunk: it doesn't hit a route, controller tests just call the method on the controller and mock out the http layer.
[19:11:53] SirFunk: something strange is happening the variable assigned in the controller isn't what is in assigns
[19:11:57] bricker: SirFunk: if you're trying to test the routes you should be using capybara or rspec's route tests.
[19:12:03] tubbo: SirFunk: sounds like either a routing spec or an integration test to me
[19:12:25] SirFunk: it's a controller spec
[19:13:14] SirFunk: in the spec i have @inventory_item = item_type.new ... but in the test assigns(:inventory_item) is nil, but assigns(:item) is not
[19:13:42] SirFunk: makes no sense to me
[19:13:49] tubbo: SirFunk: no i mean, if you want to test the route you *have* to do it in an integration test :D
[19:13:51] bricker: That sounds like either a typo or an auth problem
[19:14:06] tubbo: SirFunk: is it really @item = item_type.new? because that doesn't make sense.
[19:14:08] SirFunk: bricker: this part of the controller doesn't require auth
[19:14:14] tubbo: SirFunk: should be @item = ItemType.new
[19:14:28] tubbo: SirFunk: what's the response you get back?
[19:14:29] bricker: tubbo: seems like item_type is a variable or method which contains a class name
[19:14:41] SirFunk: tubbo: item_type is a function that returns class
[19:14:53] bricker: SirFunk: Have you Pry installed? Try adding a breakpoint at the beginning of the action, you may see that it's never being called.
[19:15:02] tubbo: SirFunk: that's dumb as hell.
[19:15:08] bricker: tubbo: shh
[19:15:12] tubbo: SirFunk: what's wrong with ItemType.new?
[19:15:13] SirFunk: bricker: yes i have tried that.. it is called
[19:15:27] bricker: tubbo: ItemType isn't a class name, you're being dumb as hell right now.
[19:15:34] tubbo: well that's dumb
[19:15:34] thomasfedb: pipecloud, hello.
[19:16:02] bricker: SirFunk: Can you gist the code? Full controller and the failing test
[19:16:11] SirFunk: bricker: yeah, hang on
[19:16:35] byprdct: when using the mail_form gem it explains that you need to create a class like so https://gist.github.com/dikaio/8224818. It doesn't tell you where you should create it, it's libs the correct directory or should it go in the model or controllers directory?
[19:16:55] byprdct: concersn...
[19:17:11] bricker: byprdct: anywhere, really. Rails will find it. I would put it in app/mail_forms/contact_form.rb
[19:17:18] bricker: with the idea that in the future I may want to add more of those
[19:17:29] differentSmoke: hello, I have a short question: does 'clone' work normally in rails?
[19:17:39] tubbo: byprdct: well, everything in ./app is auto-loaded, so you can pretty much put it in there. you can put it in lib too but then you'll have to require it explicitly.
[19:17:47] tubbo: byprdct: err, auto-required...
[19:17:48] byprdct: bricker so you would create a completely new directory to house mailings?
[19:17:55] bricker: differentSmoke: Rails doesn't override Object#clone
[19:18:06] byprdct: got it thanks tubbo bricker
[19:18:14] tubbo: in rails 4+ they have an app/models/concerns and app/controllers/concerns dir now
[19:18:20] SirFunk: bricker: here are the related bits
[19:18:21] SirFunk: https://gist.github.com/jeffutter/09e19c03f1741e7e3adb
[19:18:23] differentSmoke: it seems to work in the console but not when running the app
[19:18:27] bricker: byprdct: yes, but you could put in in models or lib as well
[19:18:49] byprdct: cool thanks you guys
[19:18:53] SirFunk: the only thing i can think of is that because of the module names rspec might be stripping off part of the variable names or something... which seems totally crazy
[19:18:56] differentSmoke: bricker: it should make a copy of the object, right? that does not reference it
[19:19:24] byprdct: why not the mailers directory?
[19:19:38] bricker: differentSmoke: yes, it should
[19:19:58] bricker: SirFunk: "load_and_authorize_resource" looks like auth to me
[19:20:31] SirFunk: bricker: right, but it allows everyone for that method... i'll remove it and it'll be the same. hangon i'll test
[19:21:09] bricker: SirFunk: and maybe your login_user isn't doing what it's supposed to
[19:21:09] tubbo: SirFunk: in your test, what is the response.status coming back as?
[19:21:18] tubbo: come********************
[19:21:46] SirFunk: bricker: damn, you were right
[19:21:48] SirFunk: that is nuts
[19:21:59] SirFunk: it works in the application fine
[19:22:04] SirFunk: that method should allow all too
[19:22:13] SirFunk: ack, at least I know where to look
[19:22:35] tubbo: SirFunk: auth is one of the trickier challenges to writing controller tests.
[19:22:57] tubbo: it's usually just a matter of setting the house of cards up effectively :)
[19:24:11] SirFunk: if i do asserts(:item).should be_a_new... it works though
[19:24:16] SirFunk: like the auth step is changing my variable name
[19:25:25] SirFunk: is there an auth library that is more accepted/better_than can_can these days? it seems to have not been updated in a while
[19:26:01] bricker: SirFunk: TheRole is recent has seems to be getting some steam, despite its horrible name
[19:26:48] tubbo: bricker: lol did you know *all* of his projects are like that? https://github.com/the-teacher?tab=repositories the fuckin darth maul of programming :)
[19:41:54] thomasfedb: tubbo, I'm using pundit, it's pretty neat.
[20:00:46] RubyPanther: SirFunk: authlogic+acl9
[20:01:15] thomasfedb: SirFunk, , I'm using pundit, it's pretty neat.
[20:01:22] SirFunk: thanks, i'll check those out
[20:01:35] tubbo: thomasfedb: i've never needed to use an authorization (in addition to an authentication) library, but pundit looks pretty good. i like the idea of extracting permissions out into their own object.
[20:01:43] tubbo: instead of munging that into the controller & model.
[20:04:20] RubyPanther: IMO for authorization you should read the wiki on the RBAC pattern, and follow that instead of ACL. This is complicated by most of the ACL tools for Rails claiming to be role-based, so the naming is screwed, but it saves work to follow the pattern correctly even if it is a few more lines up front, because you can easily adjust it any way
[20:05:13] thomasfedb: tubbo, yeah. Their handling of params is slightly awkward, but nothing you can't fix with a couple of clever methods in your ApplicationController.
[20:05:33] thomasfedb: tubbo, other than that I really like it. Got separate specs for them also.
[20:07:44] tubbo: thomasfedb: most of my methods in ApplicationController are highly clever.
[20:12:30] mmun: any advice for passing serializer options into a has_many relationship inside of a serializer with active model serializers?
[20:14:56] RubyPanther: mmun: never serialize is my advice. Persist and re-instantiate.
[20:15:32] mmun: RubyPanther: I'm building a JSON API, not much choice but to serialize!
[20:18:39] RubyPanther: That's always why people do that stuff, they thing they have no choice. How else would it happen??
[20:19:20] thomasfedb: tubbo, not too clever I hope.
[20:19:33] tubbo: RubyPanther: i don't think you and mmun are defining "serialization" in the same manner. :)
[20:19:43] tubbo: RubyPanther: are you talking about AR::Base's serialize?
[20:20:09] tubbo: mmun: you're on the right track. but i don't really understand your question..
[20:20:23] mmun: tubbo: sec, I'll provide a gist
[20:20:29] tubbo: you're awesome :)
[20:21:52] zrl: say i have a course model that has_many units. what's the recommended way to create a form for a new unit, where a unit always belongs_to a course?
[20:22:43] mmun: tubbo: https://gist.github.com/mmun/3646b88d4cb2f13a256b
[20:22:55] tubbo: zrl: do `accepts_nested_attributes_for :units` in your model, and use `f.fields_for(:unit) do |ff|` in your view.
[20:23:07] helpa: zrl: http://guides.rubyonrails.org/ - Ruby on Rails guides. Recommended reading.
[20:23:07] tubbo: zrl: !guides has a guide for this.
[20:23:19] zrl: thanks!
[20:23:50] mmun: basically I'd like to propagate the use_shallow_version option in ```render @post, use_shallow_version: true``` to the comment serializer as well
[20:24:00] tubbo: mmun: hmm, so the options that you pass to your serializer (i guess in to_json, right?)...you want those to be available to CommentSerializer too?
[20:24:10] mmun: basically yes
[20:24:15] mmun: (or other options)
[20:25:50] tubbo: mmun: hmm...so have you actually tried to see whether the options are already being passed through?
[20:26:38] mmun: tubbo: no, brb i'll do my homework
[20:27:22] mmun: if that's the case than I can namespace the options options: {post: ..., comment: ...}, that would be good enough...
[20:27:28] tubbo: mmun: heh...sometimes this kind of magic has already been thought out for you. this is a feature that i would *imagine* is already in AMS. if it's not, that
[20:27:33] tubbo: seems a little strange to me.
[20:27:56] mmun: I'm using 0.8 though, maybe they've rearranged this behaviour in the last 8 months
[20:31:36] zrl: tubbo: hmm, i'd like to keep it restful. it feels like accepts_nested_attributes_for with a nested form tightly couples the views to the controller?
[20:31:59] zrl: is there a way to do this through the courses_controller?
[20:32:55] tubbo: zrl: nah, it just couples the associated data to the controller action. the controller, when made right, should have nothing to do with the view. it's just that rails provides you both a controller and a view helper for accepts_nested_attributes_for.
[20:33:34] tubbo: zrl: for example, take a simple example of Post has_many :tags. it would be easier if I could just pass each tag object in the same big request as the rest of the data for the Post, right?
[20:33:40] tubbo: zrl: REST is a guideline, not a law.
[20:34:02] tubbo: basically, i pull the RESTful card when people do stupid shit with their API :)
[20:34:48] zrl: alright, hmm
[20:35:07] zrl: i assume the create action in courses_controller will be called?
[20:36:00] tubbo: zrl: nope, it does everything on the model. you just pass Post.create(params[:post]) and all the data should be in there.
[20:36:29] zrl: alright, what's the recommended way to test this in a controller spec?
[20:36:39] tubbo: zrl: pass the data in?
[20:36:45] tubbo: what exactly are you asking me lol
[20:36:58] zrl: kind of thinking out loud
[20:37:09] tubbo: zrl: just do it like every other controller test i guess, you pass it a big hash and it persists the data in your model class.
[20:37:19] zrl: alright, hmm
[20:37:22] zrl: alright
[20:38:47] mmun: tubbo: it works like you suspected
[20:59:22] zrl: tubbo: hmm, so the update action of the courses_controller is called. it just feels... wrong. courses have_many units, but i don't know.
[21:01:00] tubbo: zrl: oh i'm sorry i got confused as to what you were asking. CoursesController#create gets called when you do POST /courses.
[21:01:26] tubbo: zrl: you should be able to pass the unit data in params[:course][:units]
[21:01:43] tubbo: but like i said fields_for does all of this for you, so you won't have to worry too much abou tit
[21:02:20] mmun: tubbo: it seems weird to have to specify all the options on the controller. I would expect to just set an option for the root serializer, and have that serializer add options to its child serializers. know what i mean?
[21:02:55] tubbo: mmun: yeah. tbh i'm not sure what that option you mentioned is for nor do i normally need to specify options in to_json
[21:02:57] mmun: fortunately it mostly works for my user case
[21:05:02] zrl: tubbo: yeah, but courses aren't really created with units. user flow is as follows: user creates a course. within the course, the user creates units individually.
[21:05:21] zrl: creating a unit after a course exists call's the course's update action. it doesn't... feel right
[21:05:37] zrl: i feel like i should be calling the unit's create action and passing a course_id or something
[21:06:47] tubbo: zrl: well it seems like maybe you need a CoursesController and a UnitsController, and just make two forms instead of doing this accepts_nested_attributes_for business.
[21:07:25] tubbo: zrl: however, creating a unit *after* a Course exists shouldn't touch the Course at all. i don't know what *your* code is doing but Rails doesn't work like that.
[21:07:36] zrl: yeah, that's what i originally had. i'm not sure of the rails way??? to do this
[21:08:05] mmun: i appreciate the help tubbo
[21:08:05] tubbo: zrl: course = Course.first; course.units.create(data) should just do an INSERT INTO on 'units'.
[21:08:22] zrl: i'd assume a hidden field with the course_id and nesting the routes would work, but i'm not sure if this the right way to handle it
[21:09:26] zrl: would the recommended thing be to nest the routes for units under courses?
[21:09:48] zrl: and then pull the course_id from the url and include it as a hidden field in the form?
[21:09:54] mmun: there's already an issue addressing my concern
[21:12:46] lethjakman: hey, my capistrano rake task isn't cding into the correct directory, is there a way to do that?
[21:12:56] lethjakman: https://gist.github.com/lethjakman/8226999
[21:12:58] lethjakman: that's what I have
[21:15:21] bricker`work: lethjakman: use `within`
[21:15:29] bricker`work: within release_path { your stuff }
[21:18:20] lethjakman: bricker`work: literally just found it, I think you're right thank you bricker! :)
[21:18:51] bricker`work: I *know* I'm right! How's *that*?!\
[21:19:44] lethjakman: bricker`work: works for me ;)
[21:19:49] lethjakman: do you use cap 3 or 2?
[21:19:58] lethjakman: it took me some getting used to but I'm really liking it
[21:20:04] lethjakman: way better than writing your own build path.
[21:21:10] bricker`work: lethjakman: I would use cap 3 if not for a few missing configuration options
[21:21:54] madnificent: i'm spitting out sql queries so i can get data into an access database. is there something like jbuilder for emitting sql queries?
[21:22:09] bricker`work: lethjakman: I prefer it over cap 2, especially the new callback/lifecycle (before :starting, after :finishing, etc.)
[21:22:31] bricker`work: lethjakman: but there are a few things that are missing (most of which are slated to be released in 3.1, whenever that comes)
[21:23:26] mjc_: madnificent: activerecord?
[21:23:40] mjc_: it has .to_sql
[21:24:18] madnificent: mjc_: hmm, i thought it'd be angry for not having a nice table structure, but i'll verify
[21:24:52] lethjakman: bricker`work: like what?
[21:24:59] madnificent: mjc_: you're suggesting the use of arel, and then usig .to_sql on the result?
[21:25:00] lethjakman: yeah I've noticed some good configuration like that.
[21:25:44] xibalba: anyone hiring in san diego?
[21:25:45] mjc_: madnificent: ruby object mapper (datamapper2) might also be good
[21:25:52] mjc_: madnificent: not sure what your use case is exactly
[21:26:27] madnificent: mjc_: i'm removing all data from a table and insert new data manually. it doesn't map nicely at all, so it'll be messy anyway.
[21:26:37] madnificent: mjc_: incorporating a legacy app ;-)
[21:27:05] Ivanskie_: im trying to figure out the mongoid-taggable... i have the form done, but how do I display them in my view? i can't find any examples anywhere...
[21:27:11] Ivanskie_: im like loosing my mind
[21:27:55] terrellt: I prefer to tighten my mind.
[21:28:50] Ivanskie_: i'll probably figure it out, its just an array for crying out loud lol
[21:34:30] bricker: holy shit, I have accidentally quit terminal three times today
[21:34:35] bricker: itchy trigger-finger
[21:37:29] slash_nick: screen -r irssi
[21:45:01] bricker`work: slash_nick: I do
[22:00:15] EminenceHC: Would it be possible to take this select_tag and have it remember the last value? I hear it can be done with :selected but it is coming from an ivar that is mapped. https://gist.github.com/EminenceHC/8227774
[22:07:21] slash_nick: EminenceHC: were you reading this? http://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/options_for_select ... you should be looking at the documentation for options_for_select, not select_tag
[22:09:00] EminenceHC: slash_nick I saw that but I still can't seem to set the selected value
[22:12:53] apneic: Is there any significant difference between POST and PUT requests with a JSON body?
[22:13:29] apneic: I thought PUT is essentially just a POST request with a {"_method": "put:} parameter
[22:16:09] slash_nick: EminenceHC: It should work if the second argument provided to options_for_select is either a value matching one given in the first argument, or if the second arg is an array of values where some/all are held in the first argument
[22:18:48] markalanevans: hey folks, I'm looking for a generic way to say User::can_edit(model)
[22:19:03] jsilver: hey guys...
[22:19:36] jsilver: anyone familiar with an issue resembling strong parameters or active record not saving parameters which have been accepted, yet not throwing an exception or giving any info about them
[22:20:32] bauerbob: markalanevans, you're working with cancan?
[22:21:39] bauerbob: hi. i'm building a step-by-step wizard with the wicked gem and ask for some information in my forms that don't belong to the model (e.g. how many instances do you want to create?). now i need to forward this information through some steps. i can't put it into params[:model], because it would prevent doing @model = Model.new(params[:model]). how would you solve that task?
[22:24:11] lethjakman: so I'm trying to run a validation that looks like this: validates :accepted_terms, acceptance: '1', on: :create
[22:24:25] lethjakman: and the value looks like this: "accepted_terms"=>"1" in my json
[22:24:30] lethjakman: am I thinking about acceptance wrong?
[22:24:52] andywww: is it possible to check if passenger is running somehow?
[22:25:00] andywww: i'm just getting a directory listing
[22:25:14] andywww: rails 4, passenger 2, ubuntu 12.04
[22:25:18] markalanevans: bauerbob: nope
[22:25:18] bricker: andywww: pgrep -f passenger
[22:25:22] markalanevans: let me read about that
[22:25:27] bricker: or ps aux | grep passenger depending on your platform
[22:25:56] lethjakman: andywww: it should have a pid file.
[22:26:03] markalanevans: I basically want a nice strategy for my controllers to say : is the user admin, or is this a record that belongs to the partner that this user is associated with.
[22:26:06] andywww: hmm, 4 pids
[22:26:12] bauerbob: andywww, you're using nginx or apache?
[22:26:14] markalanevans: If so user can CRUD
[22:26:29] bauerbob: in that case i'm out
[22:26:35] bricker: lethjakman: it should be `acceptance: true`
[22:26:41] andywww: i swapped to the passenger.load and passenger.conf files
[22:26:58] andywww: as per http://stackoverflow.com/questions/13082362/ruby-rails-apache2-passenger-setup-returning-directory-listing
[22:27:11] andywww: did a2enmod but its still listing the dir
[22:27:45] lethjakman: bricker: same error
[22:28:02] andywww: FFS, i didn't point to public
[22:28:15] bauerbob: concerning my problem: currently i'm doing params[:model][:number_of_instances] = params[:number_of instances] in the update action, forward params[:model] in the redirect statement to the next wizard step and params[:number_of_instances] = params[:model][:number_of_instances] as well as params[:model].delete(:number_of_instances) in the show action. i think that it's the worst solution one can think of :-(
[22:29:06] andywww: hmm, still didn't work
[22:30:46] bricker: lethjakman: you never said there was an error.
[22:31:15] lethjakman: by error I mean :accepted_terms=>["must be accepted"]
[22:31:19] xibalba: anyone hiring in san diego?
[22:31:24] lethjakman: account.errors error
[22:32:28] bricker: lethjakman: is accepted_terms a real column?
[22:34:10] hendricius: having questions to get the validates acceptance validator to work
[22:34:24] hendricius: there are no errors added to the model
[22:34:38] hendricius: validates :tos_accepted, acceptance: {accept: true}
[22:34:46] hendricius: and i have an attr_accessor :tos_accepted
[22:37:40] hendricius: nvm, got it : )
[22:37:51] hendricius: forgot to add attr_accessible in the rails 3 app
[22:42:39] bricker: lethjakman: forgot to add the attribute to StrongParams?
[22:43:07] lethjakman: bricker: nah it's in there, I'm checking in rails c with: account = Account.new(accepted_terms: '1') now
[22:43:16] HereForTheBoredo: Hey guys, is there any reason I shouldn't install ruby 2.1.0 over an older version like 1.9.3 if I'm just trying to follow some tutorials and learn a little?
[22:43:19] lethjakman: it's in my strong params and seems to make it through
[22:43:25] lethjakman: I'm just getting that 'must be accepted' error
[22:43:27] lethjakman: no matter what I set it to
[22:43:36] bricker: lethjakman: which version of rails?
[22:44:02] lethjakman: tried it as: validates_acceptance_of :accepted_terms, on: :create too
[22:45:43] digital-ghost: Trying to figure out how to use TinyMCE (3.5.9) "paste" plugin in rails. Just stuck hitting wall after wall. Cannot figure out the documentation and how to test if the bloody thing is working. Using the tinymce-gem, and I know that the plugin is bundled with it.
[22:46:51] tubbo: digital-ghost: lol good luck :D
[22:47:08] lethjakman: tubbo: I tried that initializer thing you told me earlier and couldn't get it to work
[22:47:09] tubbo: digital-ghost: tinyMCE is notoriously hard to get working.
[22:47:15] tubbo: lethjakman: you couldn't set the constant?
[22:47:21] lethjakman: my redis variable wasn't available unless it was constant
[22:47:23] lethjakman: that's what it is
[22:47:24] digital-ghost: tubbo: My google-fu has failed me. All I want to do is add a plugin that's bundled with it.
[22:48:00] digital-ghost: There's like no documentation / examples of plugins being used. Crawled through everything on SO that was tagged with it :|
[22:48:29] tubbo: digital-ghost: !google tinymce-rails
[22:48:39] tubbo: digital-ghost: what about this? http://stackoverflow.com/questions/17320638/tinymce-rails-plugins-error
[22:48:50] bricker: lethjakman: can't say for sure without seeing more code. Look at https://github.com/rails/rails/blob/98d06c6bd4eefeeb342d05116fccefa11875cb9b/activemodel/lib/active_model/validations/acceptance.rb - it's pretty simple. It defines readers and writers for the terms_accepted attribute, and then just compares the value to "1".
[22:49:01] digital-ghost: Try like every link for the top 10 pages, I've been to it and crawled through :P
[22:49:09] tubbo: digital-ghost: dunno then
[22:51:00] HereForTheBoredo: what do i need to do if I run gem install rails -V and my output looks like this:
[22:51:05] tubbo: digital-ghost: looks like the paste plugin is included in the tinymce-rails distribution, so you should be able to use it.
[22:51:31] HereForTheBoredo: HEAD https://api.rubygems.org/latest_specs.4.8.gz
[22:51:34] HereForTheBoredo: 302 Moved Temporarily
[22:51:53] HereForTheBoredo: and theres about 100+ steps like that
[22:51:55] tubbo: HereForTheBoredo: interesting.
[22:52:13] HereForTheBoredo: HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
[22:52:15] bricker: HereForTheBoredo: `gem update system` maybe
[22:52:19] tubbo: HereForTheBoredo: what's your `gem --version`?
[22:52:35] HereForTheBoredo: it's all a brand new install, one sec
[22:52:39] digital-ghost: tubbo: Should be able to. figuring out how these plugins are used, is the part I cannot figure out.
[22:52:49] bricker: gem update --system
[22:52:54] bricker: HereForTheBoredo: ^
[22:53:28] tubbo: digital-ghost: yeah...tinyMCE is notorious for its shitty docs
[22:54:43] bricker: digital-ghost: I am not suggesting you do this (because I fucking hate when people tell you to just use something else), but FWIW, we hated TinyMCE so much that we eventually switched to CKEditor and haven't looked back.
[22:55:37] dagen: i try to use nested forms
[22:55:43] Ivanskie_: does rails 4 still use :input_html => {data:{role:'tagsinput'}} ? for some reason it outputs <input id="product_tags" input_html="{:data=&gt;{:role=&gt;&quot;tagsinput&quot;}}" name="product[tags]" type="text" value="[&quot;computer&quot;, &quot;server&quot;, &quot;windward-server&quot;]">
[22:56:03] bricker: Ivanskie_: input_html is SimpleForm
[22:56:05] digital-ghost: bricker: Yeah, another dev with me highly recommended it, but not a solution at the moment :(
[22:56:18] bricker: Ivanskie_: if you're not using SimpleForm, you should just use `html: { data : {} }`
[22:56:34] tubbo: Ivanskie_: i think it's just text_field_tag 'name', option: value now.
[22:56:50] dagen: and try to do something like this: https://gist.github.com/anonymous/06a21adc35ebc8e19b55
[22:56:55] Ivanskie_: im using simple form there..
[22:57:03] bricker: Ivanskie_: sure about that?
[22:57:06] Ivanskie_: at least i think i am.. simple_form_for
[22:57:13] dagen: but 'text_word' is not displayed... i don't understand why?
[22:57:16] tubbo: bricker: tinyMCE is one of the few pieces of software you can reasonably do that for :P it stinks.
[22:57:17] bricker: Ivanskie_: and f.input ?
[22:57:18] HereForTheBoredo: tubbo: gem --version 2.2.0
[22:57:23] Ivanskie_: <%= f.text_field :tags, :input_html => {data:{role:'tagsinput'}}%>
[22:57:41] Ivanskie_: that might do it..
[22:57:45] tubbo: HereForTheBoredo: OH MY GOD TIME TRAVEL IS REAL
[22:57:46] dagen: any ideas?
[22:57:52] tubbo: HereForTheBoredo: how is 2014?
[22:58:05] tubbo: HereForTheBoredo: http://rubygems.org/pages/download (v2.1.11)
[22:58:20] bricker: tubbo: O.o
[22:58:28] HereForTheBoredo: hmm dunno what happened
[22:58:33] tubbo: yeah me neither!
[22:58:43] tubbo: HereForTheBoredo: maybe you built from source?
[22:58:45] HereForTheBoredo: I'm following this guide: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6-with-rvm
[22:58:59] HereForTheBoredo: but instead of rvm install 1.9.3 i just used rvm install ruby
[22:59:17] bricker: tubbo: http://blog.rubygems.org/2013/12/26/2.2.0-released.html
[22:59:29] tubbo: HereForTheBoredo: is there a 'stable' option for `rvm rubygems`?
[22:59:54] tubbo: HereForTheBoredo: also...when you install Ruby you usually *get* RubyGems.
[23:00:06] tubbo: HereForTheBoredo: so i don't even think you needed to do that `rvm rubygems current`
[23:00:15] dagen: anybody can help?
[23:00:41] HereForTheBoredo: gem update --system -V
[23:00:45] HereForTheBoredo: HEAD https://api.rubygems.org/specs.4.8.gz
[23:00:48] HereForTheBoredo: 302 Moved Temporarily
[23:00:53] HereForTheBoredo: HEAD https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
[23:00:57] HereForTheBoredo: 304 Not Modified
[23:01:00] HereForTheBoredo: Latest version currently installed. Aborting.
[23:01:09] Ivanskie_: thanks guys,
[23:01:16] tubbo: dagen: is the markup on th epage?
[23:01:19] tubbo: the page*
[23:01:35] helpa: HereForTheBoredo: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[23:01:35] tubbo: HereForTheBoredo: !gist
[23:01:37] HereForTheBoredo: I can click on https://api.rubygems.org/specs.4.8.gz and download it on my computer
[23:01:48] dagen: tubbo what do you mena by that?
[23:01:50] HereForTheBoredo: but my server doesn't like the link?
[23:01:53] tubbo: HereForTheBoredo: you need to `gem update --system -v=2.1.1`
[23:02:06] bricker: HereForTheBoredo: Oh, you have rubygems pointing to github gems (which doesn't exist anymore)
[23:02:06] tubbo: to get a stable version of rubygems
[23:02:09] bricker: HereForTheBoredo: check `gem sources`
[23:02:28] HereForTheBoredo: ya it returned rubygems.org
[23:02:29] bricker: or gemcutter or something that's not rubygems
[23:02:31] tubbo: bricker: ...no? :O
[23:03:07] tubbo: dagen: like when you load the page that <form> is on, do you see an <input> tag with name="user[passport[pass_last_name]]"?
[23:03:08] lethjakman: bricker: I looked through it...and this is odd, it's not making sense to me. here are some results if you're interested: https://gist.github.com/lethjakman/8228850
[23:03:15] HereForTheBoredo: gem sources *** CURRENT SOURCES *** https://rubygems.org/
[23:03:16] Ivanskie_: now it shows up as the tags.. but each tag shows text like "["computer" "server" "another-tag"]
[23:03:17] tubbo: dagen: the fields_for code should be there i think
[23:03:28] dagen: tubbo you right!
[23:03:35] dagen: i solve it)
[23:03:52] dagen: ACTION shake tubbo hands
[23:03:53] bricker: lethjakman: is that really your entire model?
[23:04:00] tubbo: dagen: yeah you have to actually open your browser and visit http://localhost:3000 to see updates :P
[23:04:21] lethjakman: bricker: I recreated it as that, so yes.
[23:04:33] lethjakman: it wasn't, but I stripped it to the bare minimum and got those results.
[23:04:42] bricker: HereForTheBoredo: is it using https:// or http:// ?
[23:04:51] tubbo: bricker: 18:03:15 HereForTheBoredo | gem sources *** CURRENT SOURCES *** https://rubygems.org/
[23:04:56] tubbo: bricker: like he LITERALLY copy-pasted it :P
[23:04:58] HereForTheBoredo: it says https://
[23:05:14] HereForTheBoredo: It looks like my server doesn't like using https?
[23:05:18] bricker: tubbo: thanks, you are being a tool right now.
[23:05:24] HereForTheBoredo: because I can visit the address on my computer
[23:05:48] tubbo: HereForTheBoredo: yeah but that is probably a red herring, because browsers follow redirects
[23:05:51] tubbo: ahh dammit i think i know what's up
[23:05:56] tubbo: but i have no idea how to fix it
[23:06:09] tubbo: HereForTheBoredo: one thing though...you *are* updated to the stable version, 2.1.1, right?
[23:06:14] tubbo: bricker: sorry :)
[23:06:35] bricker: tubbo: it's okay *hug*
[23:06:49] bricker: tubbo: I'm charging you 20 bricker coins for your outburst
[23:07:02] bricker: tubbo: luckily you have so many, that shouldn't be a problem for you.
[23:07:08] HereForTheBoredo: tubbo: no let me try that now
[23:07:36] tubbo: that would be the first step
[23:07:51] tubbo: at least get to the advertised stable version of rubygems
[23:07:53] tubbo: if youc an
[23:08:35] bricker: lethjakman: show the schema for that table
[23:09:04] HereForTheBoredo: so 2.2.0 is not considered stable? why didn't it install the older version then?
[23:09:19] tubbo: HereForTheBoredo: i have no idea
[23:09:38] tubbo: HereForTheBoredo: 2.2.0 doesn't look like it was actually released.
[23:10:30] HereForTheBoredo: it must come with ruby 2.1.0
[23:11:04] HereForTheBoredo: all I've done on a fresh centos 6.2 install was this:
[23:11:10] tubbo: HereForTheBoredo: don't paste it
[23:11:13] helpa: HereForTheBoredo: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[23:11:13] tubbo: HereForTheBoredo: !gist it
[23:12:15] HereForTheBoredo: https://gist.github.com/anonymous/8228994
[23:12:31] HereForTheBoredo: and it's at that point that gem --version shows 2.2.0
[23:13:48] lethjakman: bricker: that was the problem
[23:13:58] lethjakman: someone added the column to the table while I wasn't looking :/
[23:15:02] HereForTheBoredo: ok I just ran rvm rubygems 2.1.11 so i'm back to 2.1.11
[23:15:17] ace_striker: i have a decent doubt ..if i write "redirect_to @user" will it be same as "redirect_to user_path"
[23:16:18] HereForTheBoredo: lol gem update --system installed 2.2.0 back
[23:17:28] bricker: lethjakman: :P
[23:18:07] thomasfedb: lethjakman, haha. always fun. it's even better when a college removes a column under your feet.
[23:19:28] HereForTheBoredo: https://github.com/rubygems/rubygems/issues/494
[23:19:52] HereForTheBoredo: That is the same issue I'm having when trying to run gem install rails
[23:21:54] Ivanskie_: i think something is odd happening.. it seeeeeeemms that when i ask for gems with certain assets, like js and css, they don't actually get installed into the vendor folder or lib folder..
[23:22:09] thomasfedb: HereForTheBoredo, that issue is closed as "not a bug".
[23:22:25] thomasfedb: Ivanskie_, correct, they are kept inside the gems.
[23:22:35] bricker: Ivanskie_: They don't, the gem's assets get added to your app's lookup path. It doesn't actually copy the assets to your application
[23:22:41] thomasfedb: Ivanskie_, you can reference them and rubygems will sort it out for you.
[23:23:23] Ivanskie_: im trying.. in application.js im doing *= ruquire chosen, but i get sprockets filenotfound error
[23:23:23] Ivanskie_: couldn't find file 'chosen'
[23:23:42] Ivanskie_: same was happening with bootstrap, until i actually put the js and css files into my assets folder
[23:23:59] thomasfedb: Ivanskie_, please gist your gemfile and application.css
[23:24:15] lethjakman: thomasfedb: oh god I'd be so mad.
[23:24:29] tubbo: HereForTheBoredo: you have to pass -v=2.1.11 into gem update --syste
[23:24:43] thomasfedb: lethjakman, due to?
[23:24:56] Ivanskie_: https://github.com/i5okie/redress
[23:24:57] lethjakman: if they removed columns from under my feet
[23:25:10] thomasfedb: lethjakman, yes well. I had choice words.
[23:25:26] lethjakman: was it an important column?
[23:25:32] lethjakman: "oh god....where are all the emails?"
[23:25:33] tubbo: HereForTheBoredo: yeah but you're not getting "Successfully installed rails" right?
[23:26:04] Ivanskie_: i've actually had that issue for a couple months now
[23:26:19] Ivanskie_: but bootstrap and stuff wasnt that crutial at that time
[23:26:25] thomasfedb: lethjakman, it was `type` from a STI model.
[23:26:28] terrellt: lethjakman: "Where are the credit card numbers?!"
[23:26:45] thomasfedb: Ivanskie_, where are you attempting to import "chosen". Can't see it.
[23:27:22] lethjakman: those shouldn't be in your database in the first place...
[23:27:23] terrellt: thomasfedb: He was trying to be less typeist. Are you a typeist? *Shakes head*
[23:27:26] lethjakman: at least most of the time.
[23:27:27] thomasfedb: Ivanskie_, also, your SCSS files are formatted inconsistently. I'm feeling slightly ill.
[23:27:34] Ivanskie_: here https://github.com/i5okie/redress/blob/master/app/assets/javascripts/application.js and here https://github.com/i5okie/redress/blob/master/app/assets/stylesheets/application.css.scss
[23:27:45] terrellt: lethjakman: Plenty of services keep them encrypted.
[23:27:56] lethjakman: terrellt: example?
[23:28:07] Ivanskie_: sorry about that i have not been doing any cleaning up at all just piecing stuff together at this point
[23:28:13] terrellt: lethjakman: Amazon? Every online bill payment system.
[23:28:32] terrellt: lethjakman: Pizza hut.
[23:28:32] lethjakman: nah, authorize.net allows you to keep customer profiles and they store it for you
[23:28:39] lethjakman: that's what I do
[23:28:42] thomasfedb: Ivanskie_, so what's the problem, you're including 'chose-jquery' just fine.
[23:28:46] terrellt: lethjakman: Well, sure, that just means authorize.net has them encrypted in a database.
[23:28:53] lethjakman: that's why I said in most cases
[23:28:59] thomasfedb: Ivanskie_, bootstrap will work the same, although you need bootstrap-sass.
[23:29:01] tubbo: terrellt: ya don't want to store CC numbers :)
[23:29:07] lethjakman: it's legally difficult though...
[23:29:15] thomasfedb: tubbo, I leave that to external PCI certified peoples.
[23:29:17] tubbo: but storing a reference to them is a little loophole that works for most people
[23:29:17] lethjakman: plus the decryption key would have to be kept on that server....
[23:29:17] Ivanskie_: i think i have bootstrap-sass in there..
[23:29:26] Ivanskie_: if not, i had it and it couldnt find the files
[23:29:28] terrellt: tubbo: I'd leave it to someone else too, but that makes for a not-as-good joke.
[23:29:30] lethjakman: so what's the point at that point.
[23:29:35] tubbo: terrellt: i leave it to beaver.
[23:29:38] lethjakman: unless you set up two servers, one to actually authorize.
[23:29:43] Ivanskie_: https://gist.github.com/i5okie/8229308
[23:29:46] lethjakman: lol yeah great not good joke
[23:30:16] thomasfedb: Ivanskie_, you do. But you also have bootstrap files in your assets/.
[23:30:25] Ivanskie_: yah i have bootstrap sass there.. yes, because if i dont, it doesnt work
[23:30:29] thomasfedb: Ivanskie_, which are obviously found before the ones in the gem.
[23:31:21] Ivanskie_: of course, i relise that
[23:31:41] thomasfedb: Ivanskie_, it is pointless to say "there was a problem, now it's patched, here are the patched files and no error messages, how do I fix it?".
[23:32:09] lethjakman: how do you normally run db:migrate on your cap deploys?
[23:32:22] tubbo: cap deploy:migrate
[23:32:46] thomasfedb: Ivanskie_, additionally, the problem with the `require chosen` in your .js is obvious if you look inside the chosen gem: https://github.com/tsechingho/chosen-rails/tree/master/vendor/assets/javascripts
[23:33:20] HereForTheBoredo: tubbo: https://gist.github.com/anonymous/8229373
[23:33:28] HereForTheBoredo: it takes atleast an hour for that process
[23:33:40] Ivanskie_: require chosen is for css
[23:33:49] thomasfedb: lethjakman, my Capfiles will migrate as part of the deploy.
[23:34:05] Ivanskie_: i do require chosen-jquery in application.js
[23:34:19] lethjakman: I think there's a way to go back a deploy too isn't there?
[23:34:21] lethjakman: how is that?
[23:34:27] thomasfedb: Ivanskie_, can see gist of the import statement?
[23:34:29] bricker: deploy:rollback
[23:34:44] terrellt: I migrate on every deploy!
[23:34:46] terrellt: ACTION rebel.
[23:34:49] tubbo: HereForTheBoredo: that sucks man :O
[23:34:51] Ivanskie_: thomasfedb: how do i get the import statement?
[23:35:07] tubbo: HereForTheBoredo: i assume you did `gem update --system -v=2.1.11` right?
[23:35:14] thomasfedb: Ivanskie_, open you application.css.sass, copy it, paste into a gist, paste the URL here.
[23:35:24] tubbo: HereForTheBoredo: so `gem --version` just returns "2.1.11"?
[23:35:32] thomasfedb: Ivanskie_, the @import is at the top of said file, I assume.
[23:35:42] Ivanskie_: https://github.com/i5okie/redress/blob/master/app/assets/stylesheets/application.css.scss
[23:35:57] tubbo: Ivanskie_: if you don't want the crazy messages you can take `-V` off but it's probably good that you have it on for now, while we debug this.
[23:35:57] Ivanskie_: https://github.com/i5okie/redress/blob/master/app/assets/javascripts/application.js
[23:36:02] tubbo: sorry Ivanskie_, meant that for HereForTheBoredo
[23:36:27] HereForTheBoredo: ya gem --version is still 2.1.11
[23:36:34] tubbo: HereForTheBoredo: ok cool
[23:37:10] tubbo: HereForTheBoredo: i have no idea then
[23:37:25] HereForTheBoredo: ya me either, but it's frustrating =/
[23:37:46] thomasfedb: Ivanskie_, try changing it to `@import "chosen";` underneath the header-comment.
[23:38:10] tubbo: HereForTheBoredo: only other thing i can suggest is try ruby 2.0?
[23:38:18] tubbo: maybe 2.1 has a weird bug that no one has figured out yet
[23:38:26] tubbo: due to the whole "it was xmas and new years last week" thing
[23:38:30] HereForTheBoredo: tubbo: I may try that when I get back from supper
[23:38:36] thomasfedb: Ivanskie_, also, have you restarted your server since you installed the gem?
[23:38:57] Ivanskie_: im using a local dev server
[23:39:33] thomasfedb: Ivanskie_, reboot it.
[23:39:40] Ivanskie_: how do i do that
[23:39:49] Ivanskie_: everytime i change something it does it itself
[23:39:50] thomasfedb: Ivanskie_, http://pow.cx/manual.html#section_3.3
[23:39:57] tubbo: Ivanskie_: not *every* time :)
[23:39:59] thomasfedb: Ivanskie_, reload and restart are different.
[23:40:09] thomasfedb: Ivanskie_, `$ touch ~/.pow/restart.txt
[23:40:09] tubbo: and *sometimes*, not ALL the code gets reloaded in time!
[23:40:22] thomasfedb: ACTION slashes his wrists a little
[23:42:21] Ivanskie_: hmm i broke it lol
[23:42:28] Ivanskie_: gonna try rails s instead
[23:42:47] Ivanskie_: nope i broke something
[23:44:37] thomasfedb: Ivanskie_, what's the error?
[23:44:46] thomasfedb: Ivanskie_, also, what is this application?
[23:44:52] Ivanskie_: cant load active_resource/railtie
[23:45:24] Ivanskie_: not really sure why i have it there, i think i was trying so many things.... gonna remove it
[23:46:11] thomasfedb: Ivanskie_, where?
[23:46:26] Ivanskie_: application.rb require
[23:46:49] dagen: so strange... when i try to post data trought nested form i see in server logs this: Processing by UsersController#update as HTML
[23:46:49] dagen: Parameters: {"utf8"=>"???", "authenticity_token"=>"MWm93h+bUTy7XDiewd97RXivGd1dwe6Q5swedewdewgLWTUI=", "user"=>{"passport_attributes"=>{"pass_last_name"=>"testtesttest", "id"=>"2"}}, "commit"=>"save", "id"=>"1"}
[23:46:59] dagen: But nothing happens... why?
[23:47:20] thomasfedb: Ivanskie_, you shouldn't really be requiring active_resource yourself.
[23:47:40] thomasfedb: dagen, 1) define "nothing", 2) gist please.
[23:47:42] Ivanskie_: yah im removing it, i saw it in some article
[23:48:08] dagen: this is my code https://gist.github.com/anonymous/06a21adc35ebc8e19b55
[23:48:38] dagen: thomasfedb what dou you mean by define 'nothing'?
[23:50:23] thomasfedb: dagen, I mean, what exactly happens.
[23:51:23] dagen: thomasfedb i try to post data from form wich generated for users_controller and table users to passports table
[23:51:56] dagen: i mean one part of fields must be posted to users table and other part of fields to passports table
[23:52:10] dagen: trought one form
[23:52:12] dagen: nested form
[23:52:17] dagen: http://railscasts.com/episodes/196-nested-model-form-part-1
[23:52:19] dagen: like this
[23:53:02] dagen: and i doing all my code like in this example, but when i try to post the data - nothing happens.
[23:58:13] thomasfedb: dagen, nothing?
[23:58:24] dagen: i dont understand oyu
[23:58:26] thomasfedb: dagen, gist your controller and models please.
[23:58:36] dagen: ok one moment please
[23:58:59] thomasfedb: dagen, I mean clearly it wasn't NOTHING, clearly SOMETHING happened, it just wasn't what you EXPECTED.
[23:59:28] dagen: https://gist.github.com/anonymous/fb970e652800d2c35ccb
[23:59:35] thomasfedb: dagen, it's like saying "I dropped the orange and nothing happened" when you mean "I dropped the orange and it hit the ground, I thought it would fly"
[23:59:52] shevy: thomasfedb don't drop oranges!