« Back to channel list

#RubyOnRails - 30 May 2013

« Back 1 day Forward 1 day »
[00:00:33] kedarm: cantstanya: also, if you used rvm, do a local (per user) installation to begin with (in ~/.rvm, typically)
[00:01:06] cantstanya: should I remove the users pre-existing ~./gem directory?
[00:01:12] stewart_: cantstanya: yep kedarm is right. That way you totally avoid all permissions issues that your running in to
[00:01:26] stewart_: cantstanya: I would remove everything but your system ruby
[00:01:42] stewart_: gems bundler the whole box and dice
[00:04:37] cantstanya: I left one thing out... apologies. I'm following my distribution's rails documentation for lighttpd and rails and I installed with it's package manager (not with gems) "ruby-fcgi", of which contents contain: http://sprunge.us/OLYE should I remove this package?
[00:07:08] kedarm: cantstanya: once you use rvm, all your gems will be installed in a "gemset". This compartmentalization buys you peace. So, yes, I'd try with using rvm, rvm gem install fcgi etc.
[00:07:23] cantstanya: So I'll remove it
[00:07:49] kedarm: cantstanya: you can leave it alone -- it won't be touched when using rvm.
[00:08:16] stewart_: cantstanya: if your devloping on the machine you don't need fcgi or lighty
[00:08:47] drale2k: Most of my request time goes to Memcache. Is this expected or might there something be wrong? http://cl.ly/image/101r30051d2R
[00:08:47] stewart_: cantstanya: rails comes with a server out of the box when you install it called webrick… it sucks for prod but ideal for development
[00:09:57] cantstanya: machine already has lighttpd running as a webserver for other content.
[00:10:05] terrellt: drale2k: Drill down into it - I'd bet you're doing lots of repeated accesses against the memcache server. That's when I've seen that at least.
[00:10:23] stewart_: drale2k: i would not worry if all your requests are running under 300ms
[00:10:41] drale2k: terrellt: i can't drill down with New Relic i think
[00:10:42] drale2k: more than this
[00:10:57] drale2k: stewart_: i wonder if my request time would be lower without memcache
[00:11:10] terrellt: drale2k: Not with the free version. Chances are what you're doing is low-level model caching?
[00:11:20] drale2k: terrellt: i have the prof version
[00:11:38] terrellt: drale2k: Then you can for slow transactions, I think.
[00:11:40] drale2k: terrellt: All caching is only template caching
[00:11:41] stewart_: drale2k: memcache generates your response. You cant have a request with out a response
[00:12:25] terrellt: drale2k: Check out individual transactions and figure out which ones are spiking the memcache server. See if you can't reduce call-count.
[00:12:38] drale2k: terrellt: you mean sql transactions ?
[00:12:49] terrellt: drale2k: No, web transactions.
[00:22:28] cantstanya: rvm also seemingly wants the user to have be able to be a sudoer for everything.
[00:23:12] stewart_: did you install it with sudo?
[00:24:46] terrellt: cantstanya: Is it a system-wide install? If so, are you a member of the rvm group?
[00:25:43] stewart_: it should all be setup for you as a user/ You should not have to sudo anytihng
[00:25:44] cantstanya: it wasn't a system wide install
[00:25:54] cantstanya: ergo, no rvm group could have been created
[00:26:15] stewart_: so if you do rvm list it asks for sudo?
[00:26:44] stewart_: so rvm install 1.9.3 ?
[00:26:51] stewart_: what happens?
[00:26:52] cantstanya: "no binaries for arch"
[00:26:59] stewart_: ah you have deps to install
[00:27:30] stewart_: there is an rvm command that will list all of the packages that you will need t o install to compile ruby
[00:27:41] cantstanya: I'll check...
[00:28:48] cantstanya: is this rbenv really more difficult, it looks simpler by comparison
[00:30:20] bricker`work: cantstanya: rbenv doesn't install any of the rubies for you, unless you install an extra plugin. rbenv doesn't have gemsets, unless you install a separate plugin
[00:32:08] mmlac-bv: can I do a map but instead of adding the results OR them?
[00:32:57] stewart_: how do OR a result?
[00:33:06] mmlac-bv: true OR false OR true
[00:33:59] mmlac-bv: basically foo = false; loop.each |element| do foo |= element.action end
[00:34:08] stewart_: map will append what ever block result to the array so yes you can do that
[00:35:12] mmlac-bv: was more thinking of an equivalent of the shorthand foo.map(&:bar)
[00:35:18] mmlac-bv: but I just loop, thanks :)
[00:35:30] stewart_: mmlac-bv: more of a ruby question though
[00:35:39] mmlac-bv: oh you are right. sorry
[00:35:54] stewart_: ha… no bother
[00:36:33] scipi0: Hi. I have been setting up a form for my website. I am having trouble due to the fact that there seems to be no path helper for create. I have the routes.rb, rake routes output, and form here. https://gist.github.com/Benjmin/5675002
[00:37:29] s2013: create is new
[00:38:00] s2013: so the path helper is new_user_book
[00:38:20] drale2k: If anyone knows how to ":touch" on a HABTM relation http://stackoverflow.com/questions/16826140/how-to-touch-a-habtm-relation
[00:39:49] scipi0: s2013: wait, but I thought I needed the create POST method. not the new GET method which leads to my form.
[00:40:20] stewart_: no no create is user_blook
[00:40:32] stewart_: you just need to POST to it
[00:40:53] stewart_: google "rails guides rest"
[00:41:28] s2013: yeah Scient
[00:41:31] s2013: scipi0 sorry
[00:41:49] s2013: your form_for will automatically post it
[00:41:59] scipi0: oh cool thanks s2013
[00:42:05] s2013: try it out and see if it works first
[00:43:38] scipi0: It says that I'm POSTing to the /user/new/ route, which would not work.
[00:45:16] apneic: Hi, I'm relatively new to testing. I'm confused how I should approach testing a method. The method defined as follows: def reference_field; self.class.to_s.underscore + '_id' end
[00:45:33] apneic: I feel like any test I write would serve mainly as documentation, as I'd really be testing whether the rails methods are doing their jobs correctly.
[00:45:36] scipi0: it doesn't work s2013.
[00:46:13] stewart_: apneic: got it in one.. if you keep thinking along those lines then you will write good tests
[00:46:50] stewart_: apneic: are you talking about unit tests?
[00:47:24] apneic: stewart_: Yeah, I'm pretty sure. That method is written in a module. So in the rspec suite, I defined a new class and included the module.
[00:48:02] stewart_: i would start with integration tests. A little litegration test goes a long way
[00:48:14] apneic: stewart_: And I feel like testing that method only on one class wouldn't be sufficient. Maybe I should define a second class, just to test more cases. But then I'm really testing whether underscore works properly.
[00:48:57] apneic: stewart_: integration being the overarching goal of the code?
[00:49:37] s2013: whats the error?
[00:50:36] scipi0: No route matches [POST] "/user/new"
[00:51:03] BeegPeeg00: Hi, I would like to convert a money figure to an expression in words, like 3321.12 = > three thousand three hundred and twenty one dollars and twelve cents
[00:51:03] s2013: wait you have nested path one second
[00:51:39] bricker`work: apneic: by the way, Rails Inflector already has a method that does that: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-foreign_key
[00:51:56] s2013: form_for [:user, :book] do |f|
[00:51:58] s2013: use that line
[00:52:01] apneic: bricker`work: this blows my mind.
[00:52:07] apneic: bricker`work: thank you
[00:52:31] bricker`work: BeegPeeg00: I use this library for that, it's pretty good: https://github.com/ged/linguistics
[00:53:02] stewart_: apneic: a unit test might test a model's method an integration test will connect the app and inspect the output. Integration tests while more complex to write and error prone test more code because you bring in to play your views and controllers to your test suite. Check rails guides out I think there is info there on integration testing
[00:53:44] scipi0: s2013: I don't think you understand. I need it to go just to :user. I don't need a books form.
[00:54:29] bricker`work: BeegPeeg00: if you use the Linguistics library, you'll want to use the Numbers module https://github.com/ged/linguistics/blob/master/lib/linguistics/en/numbers.rb
[00:54:32] s2013: so just form_for @user do |f|
[00:54:39] s2013: in your controllser @user = User.new
[00:55:41] bricker`work: BeegPeeg00: one sec, I have an example of something I did with it a while ago
[00:55:52] BeegPeeg00: i'll be here thanks
[00:56:08] zman_: How can retrieve a record which has another record?
[00:57:41] scipi0: s2013: that gives back "undefined method `users_path' for #<#<Class:0x00000004fe07f0>:0x0000000599c6e0>"
[00:59:06] s2013: your routing should be resources :users
[00:59:10] ner0x: Any clever way to use t.money :price in migrations?
[00:59:11] s2013: is your controller plural?
[00:59:39] s2013: rails g migration add_blah_to_table price:money ?
[01:00:01] ner0x: s2013: Not natively supported. Although decimal with precision 2 would work.
[01:01:10] BeegPeeg00: ner0x: I added that in ( precision 2)
[01:01:18] BeegPeeg00: but I can still enter a 3rd decimal place
[01:01:30] s2013: rails g migration add_blah_to_table price:decimal{8,2}
[01:01:34] s2013: that might work
[01:01:44] scipi0: s2013: that doesn't work for me.
[01:01:52] bricker`work: BeegPeeg00: example 1: https://gist.github.com/bricker/4529753
[01:01:57] s2013: what doesnt work scipi0?
[01:02:03] bricker`work: BeegPeeg00: and an example for your case: https://gist.github.com/bricker/5675102
[01:02:16] BeegPeeg00: thanks I'll have a look
[01:02:40] scipi0: s2013: nevermind
[01:03:13] s2013: i dont understand what exactly you are trying to do. you have nested resource but you are trying to do signu pfor a user?
[01:03:24] s2013: can you paste your user controller?
[01:03:41] scipi0: s2013: yes but it's pretty much empty
[01:04:02] s2013: paste the updated code
[01:04:04] s2013: let me see
[01:04:51] scipi0: https://gist.github.com/Benjmin/5675120
[01:05:22] s2013: so its not plural
[01:05:40] s2013: controllers should always be plural
[01:05:56] scipi0: What about Models.
[01:06:05] ner0x: t.decimal will do the trick. I know what precision is... what does the scale do?
[01:06:23] s2013: you didnt define your create function either
[01:06:36] rien: hey folks. I wrote a scope (freaking hard to debug, but works now) and in the rails console it returns 0 results, but when I copy and paste the query it generates and run it in mysql workbench it returns 1 row (which is correct). any clues?
[01:06:50] s2013: should be @user = User.create(params[:user])
[01:13:07] werdnativ: Anyone know how CollectionProxy is delegating method_missing to the @target now? This changed from 3.2 to 4.0, I'm trying to find where it went: https://github.com/rails/rails/blob/3-2-stable/activerecord/lib/active_record/associations/collection_proxy.rb#L39
[01:19:46] scipi0: it's working. sorry about the wq; I use vim.
[01:33:20] w32stuxnet: hi all, I've got a simple_form with the following simple_form_for method call: https://gist.github.com/emilevictor/6fa761b1dd87aa1e7324
[01:33:33] w32stuxnet: It's forwarding me to my "update" method in the controller
[01:33:56] w32stuxnet: instead of "confirm_administrator_password_check", which I thought I had specified with the path
[01:45:34] pushpa: Having a strange problem, haven't used rails for some years and came back to try Rails4, can't get a normal form working, I must be doing something seriously wrong :) ... I just scaffolded a model with 2 fields, when i post the form to create a new the redirect fails and nothing is created ... sad story ... http://pastie.org/7982065
[01:47:41] BeegPeeg00: Hi how do I get rails to return an error if I try to create a product with price that has more than 2 decimal places
[01:53:36] pushpa: It's like it redirect to the total wrong action
[01:54:43] ariedler: meow; how is everyone?
[01:54:49] s2013: if i need to serialize something do i need to do anything special when ic reate the migration
[01:55:07] ariedler: s2013: serialize in which way
[01:55:20] rhizome: rien: based on that? nope.
[01:55:24] s2013: so im going to have serialized data on a field
[01:56:00] s2013: so i just added it as string but im going to have an array per field if that makes sense
[01:56:09] bonhoeffer: hey -- i want to run a spec on my production environment to make sure my data is complete -- how can i do that?
[01:56:17] rhizome: BeegPeeg00: a validation that ensures the format
[01:56:33] ariedler: s2013: as in the field is going to be serialized to the database as a string?
[01:56:38] bonhoeffer: specify the environment -- particularly on heroku -- in the past i set RAILS_EN
[01:56:41] s2013: so the field i have is called states
[01:56:48] BeegPeeg00: yup, I understand it is probably :format => {}
[01:56:48] s2013: so for each row im going to have multiple states
[01:56:51] ariedler: s2013: very good question ....
[01:56:54] s2013: i dont need to query the states so i can serialize it right
[01:57:07] BeegPeeg00: but I haven't a clue on what to place inside the {} as an appropriate reg ex
[01:57:17] s2013: so it can be an array like ["new york", "california", "texas"] etc
[01:57:20] rhizome: a google query perhaps
[01:57:24] ariedler: s2013: generally for that (unless your using a plugin) you would have a field that is on a before_save hook
[01:57:42] pushpa: Having a strange problem, haven't used rails for some years and came back to try Rails4, can't get a normal form working, I must be doing something seriously wrong :) ... I just scaffolded a model with 2 fields, when i post the form to create a new the redirect fails and nothing is created ... sad story ... http://pastie.org/7982065 it's like it redirects to the total wrong action ..
[01:57:49] ariedler: s2013: the field type would be array, the activemodel one would be string
[01:59:19] sevenseacat: pushpa: so what actually happens, or do we have to guess?
[01:59:41] s2013: is there an array field type?
[01:59:50] ariedler: s2013: I don't believe so
[01:59:51] sevenseacat: it's probably posting to /events, not /admin/events
[02:02:26] ariedler: :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean, :references
[02:02:34] ariedler: s2013: ^^^ the valid field types
[02:02:46] asahi: hello, been away from rails for a little while. are people still using rspec + guard + capybara for testing? or is there anything new i should check out?
[02:02:54] Cakey: anyone here have a blog running under obtvse? can i see it? just want to stea-- get some ideas
[02:03:10] s2013: yeah exactly
[02:03:14] ariedler: asahi: generally yes; but not everywhere... minitest for some people; zeus for some people
[02:03:38] Cakey: s2013: how long were you away for?
[02:03:40] ariedler: s2013: you could have a regular ruby attributes; that on before_save you save to a field of type string :)
[02:03:56] asahi: ariedler: glad to hear things haven't changed too much
[02:04:00] s2013: Cakey huh?
[02:04:43] bonhoeffer: still unable to run my spec from development environment
[02:04:48] Cakey: bummer, i meant the other guy, asahi
[02:06:08] asahi: Cakey: was away for about a year
[02:06:33] sevenseacat: dont think too much has changed in the last year
[02:06:34] cantstanya: stewart_: removed rvm, figured out the /real/ issue. `rails new foo` runs "bundle" which needed to be told to install things to the users directory or I needed to install more gems one by one. All works now if I manually tell bundle "install --path ~/.gem/" after running a server and failing.
[02:07:00] asahi: got a job mostly doing spreadsheets and powerpoint presentations, but quitting that job in a month and looking to get back into rails :-)
[02:07:20] cantstanya: thanks anyways
[02:09:06] ariedler: asahi: most people have move to front-end apps... and ripping rails apart
[02:10:07] drale2k: ariedler: i wouldn't say most
[02:10:22] sevenseacat: not most, at all
[02:10:28] ariedler: drale2k: yet we still don't care about JSON performance for some reason lol
[02:10:51] sevenseacat: frontend JS frameworks are gaining popularity, but then again its been doing that for ten years
[02:11:32] drale2k: and having written a full app in backbone JS and then i moved to iOS native, i can tell you it is way behind something like rails
[02:15:13] ariedler: drale2k: I have written in both many times ... results are inconclusive
[02:15:23] ariedler: drale2k: if front-end performance continues to increase it is a viable solution
[02:15:43] drale2k: It is not about performance, it is about code quality
[02:15:47] drale2k: backbone is a mess
[02:15:51] drale2k: if your app gets big
[02:15:52] sevenseacat: the day frontend performance gets decent on mobile devices, i might take it seriously
[02:16:41] drale2k: It needs more time, there is just not a way to do certain things. Everyone does it differently and i don't like that
[02:19:01] ariedler: drale2k: hehe ... actually if you know how to code really well in it, it is not nearly as bad
[02:19:33] ariedler: drale2k: the problem is there is a HUGE gap of knowledge and how to do things properly ...
[02:19:44] bonhoeffer: anyone know how to get rspec to run in development
[02:19:50] ariedler: (and this is not me bragging... i suck at it)
[02:19:56] s2013: just add it? and run it?
[02:19:56] drale2k: ariedler: i don't claim to be top notch in JS or backbone but for me it was a really bad experience
[02:20:03] ariedler: bonhoeffer: RAILS_ENV=development bundle exec rake spec ?
[02:20:12] bonhoeffer: yeah, not working for me
[02:20:24] bonhoeffer: RAILS_ENV=development bundle exec rspec spec/data/data_verification_spec.rb
[02:20:35] bonhoeffer: it runs but returns Rails.env as 'test'
[02:20:37] ariedler: bonhoeffer: are you accidently overriding the environment in rspec init ?
[02:20:45] sevenseacat: rspec *should* be run in test.
[02:20:49] bonhoeffer: not that i can see . . .
[02:21:01] dcope: anyone in here using unicorn + capistrano and asset pipeline? i'm getting some odd errors about it failing to mkdir -p public/assets/{foo}
[02:21:10] dcope: wondering if anyone else has seen this and knows of a workaround?
[02:21:16] bonhoeffer: sevenseacat: i want to test my production or development data
[02:21:29] sevenseacat: bonhoeffer: so load it into your test db
[02:22:24] ariedler: anyone know how to actually debug the sprockets pipeline ? ... I am getting a random Helper not being found error :(
[02:22:24] bonhoeffer: so i can't test my server . . . other than pulling in the data to test . . . got it
[02:22:50] sevenseacat: bonhoeffer: what>
[02:23:22] bonhoeffer: so if i want to test data on server, i should pull it into a test db, not run tests on the server
[02:23:51] sevenseacat: unless you mean you actually want to run your tests on your prod server
[02:24:04] sevenseacat: in which case, someone needs to smack you with a wet trout.
[02:24:13] bonhoeffer: agreed, makes sense
[02:24:25] poincare101: Are there any providers for Rails that are meant for smaller services? Heroku dyno spin up time on the free plan is killing my load time, and $36/month doesn't make sense for side projects.
[02:24:49] dcope: poincare101: digital ocean
[02:25:41] poincare101: dcope: but, that's a VPS. So, I'd have to set up everything myself. That's kind of annoying (possible, but, would take a bit of time)
[02:26:36] sevenseacat: so you dont want to pay for the convenience of having heroku handle everything for you?
[02:26:44] dcope: what sevenseacat said
[02:26:54] dcope: you either do it yourself or pay a 'managed' service
[02:27:00] poincare101: sevenseacat: I do pay for Heroku, just that having a second dyno for small projects doesn't make much sense to me
[02:27:10] sevenseacat: so dont use a second dyno?
[02:27:20] poincare101: sevenseacat: dyno spin up time is killing me
[02:27:26] sevenseacat: welcome to heroku.
[02:27:36] sevenseacat: you get what you pay for
[02:27:49] poincare101: Is there an opportunity here? Would a $8/month or something plan that is managed (but, not top notch) work/sell?
[02:28:08] ariedler: poincare101: servers are expensive.
[02:28:10] solidus-lake: hey all, i'm having a trouble doing rspec capybara tests using .to_time on the :updated_at field
[02:28:21] solidus-lake: claims taht there is no to_time for a nil class
[02:28:23] poincare101: The biggest problem w/ small apps isn't really how fast the hard disk is or network bandwidth, its the damn latency.
[02:28:25] solidus-lake: oh!!! wait i think i have it
[02:29:50] dcope: poincare101: a market for a shell script that takes in a few variables and configures everything?
[02:30:18] poincare101: dcope: roughly, but, it hides all the VPS, and doesn't provide a login. Like heroku, but, no spin-up time, and not more than one dyno.
[02:30:19] ariedler: poincare101: even with big apps its sorta latency
[02:30:29] poincare101: ariedler: yeah, but, small apps latency is king
[02:30:38] poincare101: ariedler: (by far)
[02:31:48] ariedler: poincare101: correct, but then you shouldn't use ruby ^_^
[02:32:21] poincare101: So, no ruby for small apps? :( And, no ruby for extremely large apps? :C
[02:33:19] ariedler: poincare101: haha, in a way yes? idk hmm
[02:33:54] ariedler: poincare101: I guess you could hope that a ruby-implementation becomes fast :)
[02:34:28] cconstantine: hey guys. I'm trying to upgrade from rails4 beta to rails4 rc and I'm getting a weird execption anytime I try to start the app: https://gist.github.com/cconstantine/bfa71de7b57c73be43c6
[02:35:17] cconstantine: you can see my code here: https://github.com/cconstantine/wattle/tree/rails4_rc1
[02:35:23] ariedler: cconstantine: encrypted store is the regular store now I believe
[02:35:35] ariedler: cconstantine: as in non-encrypted store was dropped
[02:35:54] ner0x: If I had an object "Quote" and it had many "Files" would it be fine to add the model QuoteFiles and quote_files in the db?
[02:36:06] cconstantine: ariedler, I don't say 'EncryptedCookieStore' anywhere in my project
[02:36:43] cconstantine: ner0x, what do you mean by 'quote_files in the db' ?
[02:36:59] ariedler: cconstantine: also a headsup, update to rails 2.0.0p195 when you can ... memory leak issues
[02:37:17] cconstantine: ariedler, good to know
[02:37:25] cconstantine: ariedler, this isn't deployed anywhere yet :)
[02:37:44] ariedler: cconstantine: I do have some rails 4 stuff in the wild lol
[02:37:57] cconstantine: I've heard it happen. we're talking about doing it at work
[02:38:10] cconstantine: thought I should try out the latest
[02:39:17] ariedler: codelahoma: "Wattle::Application.config.session_store :encrypted_cookie_store, key: '_wattle_session' "
[02:39:44] cconstantine: ariedler, :( search failed me
[02:39:46] ariedler: when it is loading that in the initializer; it is trying to change encrypted_cookie_store to EncryptedCookieStore constant..
[02:40:03] cconstantine: ariedler, it's just cookie_store now?
[02:41:27] fwaokda: this might seem like a dumb question but... I have generated a scaffold and can see the basic template for my page if i go to /teams/2 -- to see id 2. I'm wanting to create a link though to this page to look more like /team/blueteam (without the 's' on team) and with the actual team name instead of the id... what do i need to search for on google to see an example of this?
[02:41:29] drale2k: I was like in the kitchen and prepared food only to come back and it stil says "Running: rake assets:precompile"
[02:42:37] ariedler: cconstantine: https://github.com/rails/rails/blob/4-0-stable/actionpack/CHANGELOG.md <--- search for cookie
[02:43:30] drale2k: Shouldn't a deploy cause the fragment cache to invalidate itself ?
[02:43:53] cconstantine: drale2k, not always
[02:44:45] cconstantine: drale2k, high-volume sites frequently can't handle all caches getting invalidated at once
[02:44:49] GeekOnCoffee: ACTION mumbles something about chinese dolls
[02:45:23] drale2k: cconstantine: i am talking about my own. I deployed but it did not updat ethe template
[02:45:51] cconstantine: drale2k, if you want that behavior you'll have to add it to your deploy script or do it manually
[02:46:23] drale2k: I don't think it should be that way. What is russian doll caching and cache_digest there for ?
[02:46:38] cconstantine: maybe it would make sense to do it by default in cap and force people to turn it off when it doesn't work for them
[02:47:20] cconstantine: those are there for progressive cache invalidation when model values change
[02:47:54] cconstantine: ariedler, I see it now. Thanks :)
[02:48:04] ariedler: ACTION continues to fight with an old version of sprockets
[02:50:11] drale2k: ariedler: if your enemy is equal prepare for him. if greater elude him. if weaker crush him
[02:50:48] ariedler: drale2k: he has not learned about my powers of git rm -f
[02:51:07] drale2k: that falls under "crush him" i guess
[02:53:11] ariedler: now where is link_to implemented lol
[02:55:05] GeekOnCoffee: ariedler: ./actionpack/lib/action_view/helpers/url_helper.rb
[02:55:57] ariedler: we meet again action_view lol
[02:56:55] ariedler: is it just me; or does anyone else think it is messed up it generates functions on the fly in rails to render templates?
[02:58:40] Titas9x: Is it possible to render edit form with out :password and :password_confirmation without using separate form for each new and edit action? https://gist.github.com/titas9x/5675479
[02:58:44] dcope: i sthere a way to get verbose errors from capistrano? it spits out tons of [err] mkdir -p ...
[02:58:50] dcope: but no reason of the failure
[02:59:57] ariedler: Titas9x: pass something into render
[03:00:24] Titas9x: ariedler: like?
[03:01:05] ariedler: locals: { skip_password: true }
[03:01:58] ariedler: ugliest hack of the day: "::Sprocket::Context.class_eval do; include ...; end" because Railities initializers were not working
[03:05:01] Titas9x: ariedler: tried this but not working = render "form", locals: { skip_password: true }
[03:06:46] sevenseacat: users cant change their passwords?
[03:07:14] ariedler: Titas9x: you still need to user skip_password in the form
[03:07:16] sevenseacat: Titas9x: once you pass the value in, then you use it to determine whether or not to show the fields.
[03:07:30] ariedler: ^^ sevenseacat :)
[03:08:44] Titas9x: ariedler: sevenseacat: got it…trying
[03:19:22] ariedler: ACTION hears the crickets
[03:19:58] ariedler: random slightly off topic question: sharing code between two repositories, does it need a third repo? (GIT)
[03:25:09] drale2k: Shouldn't it be the default when you push to heroku, that it runs all pending migrations automatically?
[03:25:28] drale2k: it happens now and then that i push but forget to run the migrations on heroku again
[03:34:10] aamax: Radar, i remember a while ago you mentioning working with spree. I'm just looking into plugging it into an existing site. any advice, comments, observations before I start on this path
[03:36:04] sevenseacat: read the docs?
[03:38:37] NemesisD: hey guys. do i remember correctly that rails is doing away with the attr_accessible syntax?
[03:39:22] sevenseacat: see: strong_parameters
[03:41:58] GeekOnCoffee: aamax: #spree :) you'll probably want the instructions at https://github.com/spree/spree#using-stable-builds-and-bleeding-edge
[03:42:29] aamax: GeekOnCoffee, yup, that's what i'm reading through now. thx
[03:43:07] GeekOnCoffee: aamax: you'll likely want http://guides.spreecommerce.com/developer/authentication.html assuming you've already got a user model
[03:43:20] ariedler: does anyone know if sprockets has a concept of locale based assets?
[03:49:48] ariedler: ACTION is so close to being alive :)
[03:50:24] bga57: Anyone here like the rails antipatterns book?
[03:50:34] sevenseacat: is a good book.
[03:52:45] bga57: How about either of the refactoring ruby books?
[03:54:11] sevenseacat: cant say i know those.
[04:00:46] aamax: GeekOnCoffee, got it started but the spree generator messed up a bunch of my css (twitter bootstrap stuff). i guess it's gonna take a bit to plug this in
[04:01:53] GeekOnCoffee: aamax: spree uses skeleton, so yeah, there may be some CSS collisions. I'm about to head to bed, and Radar is on vacation this week, so #spree will really be your best bet to get help
[04:02:30] aamax: GeekOnCoffee, thanks a bunch. i'll check them out on #spree. sweet dreams
[04:03:49] Cakey: soz, wrong pane
[04:15:24] blahwoop: any activeadmin pros around? trying to get a nested form to work
[04:18:50] iamjarvo: looking for some ideas. say i want to create the idea of google yahoo user. my service has to know that the user has both types of accounts and create a record for the user. what's the best way to do that? i was thinking the best idea would be to send an email to each account
[04:19:18] iamjarvo: each email would have an activation link
[04:20:28] sevenseacat: huh? whats a 'google yahoo user'
[04:21:48] iamjarvo: someone that has both a yahoo mail account and gmail account
[04:22:31] iamjarvo: its hypothetical
[04:22:38] sevenseacat: let's ditch hypotheticals.
[04:22:43] sevenseacat: what are you actually trying to do?
[04:22:47] Cakey: Biggest takeaway when working with small classes/modules. Everything fits even if you have a dozens of panes / windows open
[04:23:26] RubyPanther: iamjarvo: you ask the user. and they tell you.
[04:23:37] Cakey: ACTION *sigh.. wrong window again
[04:24:04] RubyPanther: Cakey: <3 emacs
[04:26:25] indigo: RubyPanther: HEATHEN
[04:27:17] RubyPanther: I do use vim for editing system files, though.
[04:28:18] indigo: RubyPanther: Ruby system files? On your Macbook? At Starbucks?
[04:29:14] ariedler: yippie git subtrees done :)
[04:29:22] ariedler: time for bed >_>
[04:29:26] RubyPanther: I don't use proprietary computers, or frequent chain stores, no.
[04:31:35] rhizome: i've been looking for a good linux laptop for too long now
[04:32:29] sevenseacat: ACTION hugs laptop
[04:32:35] sevenseacat: i <3 my laptop
[04:34:20] rhizome: is it apple?
[04:36:31] sevenseacat: nah. samsung series 9.
[04:39:12] blahwoop: i just cloned a repo. how do i load the seed file?
[04:46:51] blahwoop: https://gist.github.com/iRichLau/5674227 im nesting forms in activeadmin but i get a has_many is an undefined method. does anyone see anythign wrong with this code?
[04:51:50] ariedler: i love my phone... i code on it everyday ... kidding
[04:52:09] ariedler: blahwoop: bundle exec rake db:seed you mean ?
[04:52:35] blahwoop: yup. got it . thanks though
[04:52:44] blahwoop: i do hate activeadmin
[04:52:47] drale2k: Any idea on how to call an Exercise model which provides default exercises to pick from but where "Exercise" is taken
[04:53:03] drale2k: i can't call it Exercise
[04:54:08] ariedler: drale2k: put it in a module?
[04:54:18] drale2k: ariedler: hm?
[04:54:26] drale2k: i need tables for it
[04:54:32] drale2k: so it has to be a model
[04:54:35] ariedler: drale2k: your talking about the fact you have two Exercise classes?
[04:55:25] drale2k: ariedler: i will quickly explain. I have Workouts which consist of Exercises. Each user has its won workouts and therefore exercises. Now i want to provide default exercises where they can pick from and create their workout
[04:55:32] drale2k: the users exercise models is called Exercise
[04:55:42] drale2k: now i don't know how to call the default exercise pool
[04:55:58] ariedler: s/how/what ?
[04:56:18] drale2k: sorry what?
[04:56:42] ariedler: did you mean what instead of how in the previous statement.
[04:56:58] drale2k: well, how to call the new model
[04:57:03] drale2k: what to call it
[04:57:10] drale2k: can't you say "how to call it"
[04:57:20] drale2k: i am not native
[04:57:26] ariedler: "how to call it" sounds like "how do I invoke it"
[04:57:44] drale2k: no i want to name it
[04:57:54] ariedler: why not name it ExercisePool ?
[04:57:56] drale2k: i have yet to create it
[04:58:15] ariedler: or DefaultExercisePool
[04:58:25] drale2k: ariedler: hm i don't know. I thought i would find a convention on how to name default things like this
[04:59:13] ariedler: drale2k: depending on your situation it might actually make sense to have a list of IDs, and a scope instead
[04:59:22] ariedler: drale2k: given that you seed the database obviously
[04:59:44] drale2k: ariedler: i have not started yet so i am poen for all
[05:00:13] drale2k: I will have a admin panel where i will put in new exercises
[05:00:28] ariedler: drale2k: do those new exercise become part of the default pool ?
[05:00:55] drale2k: ariedler: yes
[05:00:55] ariedler: drale2k: I am confused actually why you even need this concept...
[05:01:12] drale2k: ariedler: hehe yeah sry it's hard to read someones mind
[05:01:14] ariedler: drale2k: what is the difference between Execerise.all ?
[05:01:22] ariedler: and this pool thing
[05:01:27] drale2k: When you create a workout, you will have a text field for every exercise
[05:01:35] drale2k: and when you start typing, i will suggest exercises
[05:01:39] drale2k: that's the pool for
[05:01:49] drale2k: it is not checkboxes or something
[05:01:57] ariedler: drale2k: so really you have a set of ExerciseSuggestion sorta
[05:02:00] drale2k: imagine like google when you start typing
[05:02:06] drale2k: well yes actually
[05:02:48] ariedler: either ExerciseSuggestion or ProvidedExercise
[05:02:53] ariedler: is my suggestion :)
[05:02:53] drale2k: i was thinking if i could somehow link the suggestions to users actuall exercises but i don't think i can
[05:03:08] drale2k: so i could later query on how many people to exercses X
[05:03:11] ariedler: drale2k: not unless you map them somehow e.g. an ID
[05:03:27] drale2k: yeah but how, it is a text field and they can call them whatever they want
[05:03:34] drale2k: would be easy with a checkbox
[05:03:38] ariedler: drale2k: on submit, map them
[05:03:50] ariedler: if there is no mapping; create a new record
[05:04:10] drale2k: hm, you mean find or create kinda
[05:04:33] drale2k: boy this gets more and more complicated
[05:04:42] drale2k: should i put them into the pool
[05:04:42] ariedler: drale2k: but you probably should be a little smarter then that... like lowercase compare etc...
[05:04:48] drale2k: or wait until more people have named it like that
[05:04:50] ariedler: drale2k: up to you!
[05:05:26] w32stuxnet: hi guys, is there any resource with information on inheriting devise/passwords in order to introduce custom logic to its #edit method?
[05:05:36] w32stuxnet: I want to be able to do special things as part of the password recovery process.
[05:05:49] ariedler: w32stuxnet: what kind of special things; and which version of devise
[05:07:11] ariedler: w32stuxnet: anyhow you basically can override anything you want in PasswordsController in Devise, so go for it! (you extend in in your RecoverController)
[05:07:17] w32stuxnet: the newest version of devise, I just want to do things like wire up custom input (i.e. instead of an email being provided, provide other information that we know about you), and then send custom mailers, etc
[05:07:56] ariedler: ACTION sneaks away to sleep
[05:08:04] w32stuxnet: I also need to be able to send a certain user a message using one of our gems if the user who forgot their password doesn't actually have an email address (which is envisaged)
[05:09:09] ariedler: w32stuxnet: my advice is dig through the source
[05:09:29] ariedler: w32stuxnet: I regret not doing it sooner last time I used devise
[05:11:02] ariedler: w32stuxnet: https://github.com/plataformatec/devise/blob/master/lib/devise/models/recoverable.rb
[05:11:24] ariedler: is a good starting point
[05:11:39] ariedler: and then just wiring in your own custom recovery controller potentially
[05:11:42] w32stuxnet: thanks a lot
[05:20:50] drale2k: WIth strong parameters in Rails 4, what about "accepts_nested_attributes_for" and "attr_accessible" for nested attributes?
[05:24:46] drale2k: ok i see you still need to set "accepts_nested_attributes_for" on the modeö
[05:25:01] drale2k: so we got rid of having to whitelist the attributes right ?
[05:25:11] drale2k: instead they now go into the permit! hash
[05:25:39] drale2k: i don't know how i feel about splitting that now between controller and model
[05:28:40] sevenseacat: now its in the right place, so you can pick and choose permitted attributes depending on the controller action
[05:30:07] drale2k: sevenseacat: i understand that it is much easier to handle authorization
[05:35:56] drale2k: "no implicit conversion of Symbol into Integer" https://gist.github.com/drale2k/03bab8db5a384982136c any idea?
[05:36:11] drale2k: google says it was a bug but it should be fixed
[05:36:40] sevenseacat: drale2k: learn how to permit nested attributes properly
[05:37:01] sevenseacat: drale2k: https://github.com/rails/strong_parameters#nested-parameters
[05:37:12] drale2k: I followed this http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html
[05:38:31] sevenseacat: show me where in that code it says to define things like plan_days_attributes[:name]
[05:39:04] rakl: when you create a record that has a belongs_to relationship, will it fail to save if the record on the other side of the belongs_to fails validations?
[05:39:14] drale2k: oh, i screwed up the hash syntax
[05:39:31] rakl: e.g. membership belongs_to user. `membership.user.valid? => false`
[05:39:39] rakl: `membership.save` => ??
[05:39:40] drale2k: not a big deal, works now
[05:40:40] rakl: when I save my membership record, it returns false and doesn't rolls it back, but membership.errors.messages is blank
[05:41:07] rakl: http://pastie.org/7982544
[06:24:31] tagrudev: it's only thursday ;(
[06:28:06] drale2k: do you usually use redirect_to some_path or some_url ?
[06:29:35] sevenseacat: drale2k: full URLs are generally unnecessary.
[06:29:50] sevenseacat: unless sending out a URL in an api or email whatnot
[06:30:11] drale2k: sevenseacat: so i should be save for redirecting with _path when staying on my site
[06:36:10] dopie: sevenseacat, ready for an awesome basic question that i cant find the answer too?
[06:36:21] sevenseacat: if i have to be.
[06:37:22] dopie: I have 2 models, article and article_images ... how do i link my article_images new.html.erb view in the index.html of the article
[06:37:49] sevenseacat: you use the rails helper for creating a link, and you give it the right route name.
[06:38:12] sevenseacat: then you read a tutorial on how to get started with rails.
[06:38:19] dopie: I do all the time
[06:38:33] beneggett: Rolify question: If have a user model with rolify/resourcify enabled, I also have two subclasses: Parent < User model and Donor < User model with unique methods. Is there a way I can call Parent.has_role? :role_name through the User class, so I don't have to manage unnecessary roles like user_roles, parent_roles, donor_roles for the same data type?
[06:39:21] beneggett: like inherit rolify from the parent class and access its methods
[06:39:59] sevenseacat: rakl: if your before_create returns false, the save will not go ahead.
[06:42:30] tagrudev: beneggett, I suppose rolify is a gem, so the answer to your question is hidden inside the lib/ folder most probably :)
[06:42:35] tagrudev: read the code
[06:43:17] drale2k: With strong params when you don't white list the nested models :id and :_destroy attribues, instead of deleting it duplicates the entries
[06:43:21] drale2k: is this expected?
[06:44:37] sevenseacat: well, not needing to whitelist is expected, those are reserved field names.
[06:44:52] tagrudev: drale2k, https://github.com/rails/rails/issues/9558
[06:45:34] beneggett: tagrudev: yeah, in the middle of that; thought I'd ask here, as its quite a commonly used gem
[06:46:21] tagrudev: beneggett, I guess I am not up to date :)
[06:46:40] sevenseacat: ive never seen anyone use rolify before :p
[06:46:40] tagrudev: first time I hear about it
[06:46:45] drale2k: tagrudev: thank you read that but i don't understand why it duplicates all entries
[06:46:46] sevenseacat: ive heard of it though
[06:46:53] sevenseacat: drale2k: show us
[06:47:29] drale2k: sevenseacat: i can gist the code
[06:47:37] tagrudev: that's what she meant :D
[06:49:23] drale2k: sevenseacat, tagrudev: https://gist.github.com/drale2k/b252fe3157f65be771f9
[06:49:51] beneggett: really? odd. cancan/rolify combo are quite common
[06:49:55] beneggett: or so i thought
[06:50:24] sevenseacat: drale2k: great. now show us the actual problem.
[06:50:29] tagrudev: drale2k, and can you explain what do you mean by duplicated ?
[06:50:45] drale2k: tagrudev: that's why i said record so you can see
[06:50:53] sevenseacat: that looks like what i would expect to happen
[06:51:00] sevenseacat: if you dont permit the ID, how does it know what to update?
[06:51:07] drale2k: but why does it duplicate it ?
[06:51:14] tagrudev: duplicate ?
[06:51:23] sevenseacat: because it doesnt know it has to update an existing record, you've stripped out the ID
[06:52:22] drale2k: so it sends a POST instead of a DELETE ?
[06:52:36] tagrudev: and please fix your indentation
[06:53:04] drale2k: tagrudev: it#s fine, only in the gist
[06:53:16] maloik_: I'm playing around with the Multitenancy with Rails book, and ran into this issue while trying to scope the Forem gem's forums on my account model: https://gist.github.com/hannesfostie/53d0b5a9aac1d41f0de9
[06:53:28] sevenseacat: if you say update Plan ID 2 with the attributes plan_days_attributes: { name: 'test' }, how does rails know that the plan day is an existing plan day and it should update it?
[06:53:30] drale2k: sevenseacat: how does it CREATE a new entry without POST ?
[06:53:52] drale2k: if i don't white list :id and :destroy it CREATES instead od deleting
[06:54:04] sevenseacat: drale2k: i know. now read what i'm saying.
[06:54:48] drale2k: ok so because of the lacking ID, it thinks "test" is a new entry
[06:55:17] drale2k: ok i get it thanks
[06:55:29] sevenseacat: try reading instead of CAPSING next time.
[06:55:45] dopie: sevenseacat, thanks for the quick tip :)
[06:55:51] dopie: im learning alot because of you :)
[06:56:03] drale2k: those things are CAPSED
[06:56:09] drale2k: i am not yelling ;)
[06:56:30] sevenseacat: i didnt say you were. again, try reading.
[06:56:45] drale2k: you have to be a women
[06:56:48] sevenseacat: if you dont start reading, i'll stop helping.
[06:57:05] sevenseacat: drale2k: your powers of observation are astounding.
[06:57:23] drale2k: apparently
[06:57:32] sevenseacat: given tagrudev already said 'she' a few times
[06:57:36] sevenseacat: guess you didnt read that either
[06:57:54] drale2k: i did, i am just confirming
[06:58:09] drale2k: i don't know what the english word is for people like you
[06:58:10] sevenseacat: its a miracle.
[06:58:36] sevenseacat: throw me a word in whatever language you want
[06:59:03] drale2k: i don't want to insult you, this is from translate so sorry if it is insulting: smartypants
[07:01:59] tagrudev: sevenseacat, is the god of diet coke don't put her down to only a she
[07:24:52] dopie: sevenseacat, heres another one :)
[07:28:22] dopie: I have uploaded an image and i its called foo.jpg i have a each.do running where i show the image , now.... i want to also show the filename of that image (not in the alt) but where the user can visually see the filename
[07:32:15] tagrudev: dopie, are you using any lib for image uploading ?
[07:34:37] tbuehlmann: (I should write an image upload library called AnyLib)
[07:34:50] sevenseacat: dopie: so whats the problem?
[07:35:23] tagrudev: tbuehlmann, would cause a serious word game trouble
[07:36:11] tbuehlmann: also, that library would take care of bread crumbs, pagination, background jobs, …
[07:36:19] tbuehlmann: an all-in-one library
[07:38:22] omarqureshi: going to call my ruby library "then"
[07:38:26] omarqureshi: i have no idea what it would do
[07:38:56] dopie: tag carrierwave
[07:39:05] omarqureshi: just trying to think of a "fuck you - i'm ungoogleable" word
[07:39:27] dopie: sevenseacat, how do i list the filename?!
[07:39:58] sevenseacat: just output the field
[07:40:07] sevenseacat: the name is stored in the field
[07:40:18] sevenseacat: omarqureshi: go? >_>
[07:40:25] omarqureshi: go is a good one
[07:40:53] dopie: <%= f.file_field :image %>
[07:40:58] tagrudev: dopie, @object.original_filename
[07:41:02] dopie: :image.to_s
[07:41:23] sevenseacat: :image is a symbol, not a model's field
[07:41:31] dopie: @image.to_s
[07:43:05] rzs: Need some help understanding how foreign keys work in Rails.I have a model Orders which has an attribute called product_id . I have belongs_to :product in Orders and has_many :orders in Product, to setup a one to many association. product_id is supposed to be a foreign key, but in MySQL the foreign key association is not seen. Why is this so ?
[07:43:09] Veejay: Hello everyone
[07:43:35] sevenseacat: rzs: rails does not do foreign keys at the db level
[07:43:53] sevenseacat: it does them at the application level
[07:44:08] rzs: sevenseacat: oh i see
[07:45:15] Sylario: rzs : and if you use a DB client (like php MyAdmin) you should never use it to do modification on the DB structure
[07:45:45] avril14th: what's the point of around_ model callback?
[07:45:45] sevenseacat: do it through rails
[07:45:48] omarqureshi: rzs: use execute and run SQL in your migration to add the foreign key
[07:45:50] rzs: Sylario: thanks for pointing this out, infact im using it to view the tables.
[07:46:10] omarqureshi: with the mysql drivers, you can only run one query / ddl change per execute
[07:46:16] dopie: https://gist.github.com/staycreativedesign/5676318
[07:46:28] Sylario: rzs: i did php in the past, and i consider it a good habit to not use that at all, you want to view tables ? use schema.rb
[07:46:43] rzs: omarqureshi: do i need to add a foreign key at the database level or is handling it at the application level by rails sufficient ?
[07:46:44] sevenseacat: @image is actually multiple images?
[07:47:02] sevenseacat: dopie: have a look what i.image is in that loop.
[07:47:08] omarqureshi: rzs: i dont think handling at the application level is sufficient personally
[07:47:18] omarqureshi: others disagree
[07:47:23] omarqureshi: its a matter of opinion
[07:47:28] rzs: omarqureshi: ok
[07:47:46] rzs: Sylario: alright
[07:47:51] dopie: its an image tag
[07:47:54] sevenseacat: where i think handling keys in the app level falls down is when people dont handle dependencies on associations and you end up with invalid FKs
[07:48:09] sevenseacat: dopie: no, its an image tag when you wrap it in image_tag like you're doing
[07:48:27] Veejay: If I need to specify special durations for different environments (shorter times for testing in development, the real times in production for example)
[07:48:36] dopie: GOT IT!!!
[07:48:49] Veejay: That goes into config/environment.rb? Do I create environment variable?
[07:49:02] sevenseacat: dopie: great.
[07:49:03] omarqureshi: nothing goes into config/environment.rb
[07:49:04] dopie: sevenseacat, youre like an old ninja master beating on his student
[07:49:08] omarqureshi: unless you are running Rails 2.3
[07:49:21] omarqureshi: use config/environments/x.rb
[07:49:22] Veejay: config/environments/development.rb etc/
[07:49:35] Veejay: etc. I mean
[07:49:41] omarqureshi: and those arent environment variables
[07:49:45] omarqureshi: those are something else.
[07:50:40] Veejay: Yeah, thus my question
[07:50:50] sevenseacat: they're config variables
[07:51:02] Veejay: I could go Rails.env.development? 10.minutes : 30.days
[07:51:14] sevenseacat: argh phantomjs is hating me today
[07:51:30] Veejay: So maybe something in my .bashrc imported in an initializer or something?
[07:52:54] Veejay: sevenseacat: It's a common practice. Not for durations of course, I was a tad silly there
[07:53:33] Veejay: What do you mean no?
[07:53:52] omarqureshi: try not to put shit in your bashrc regarding how your app works
[07:54:12] omarqureshi: if its something to do with the system, use facter - otherwise, put it in the rails app
[07:54:21] omarqureshi: in config/environments/x
[07:54:55] Veejay: Alright, thanks
[08:02:38] tastycakeman: does anyone know if there is a simple rails solution for something like this: https://www.cloudflare.com/apps/trumpet
[08:02:56] tastycakeman: a site wide notice/single-use notify bar?
[08:03:50] tastycakeman: without using flash?
[08:03:54] tastycakeman: oh you meant flash
[08:04:19] omarqureshi: you could do something with the session, maybe
[08:04:32] tagrudev: or you can hire someone to respond to each request
[08:05:08] tastycakeman: hmm i guess it would be easy just to make one
[08:05:12] tastycakeman: figured there'd be something simple
[08:09:58] sevenseacat: see the railscast on site wide notification
[08:10:39] xhoy: sevenseacat: what is with that?
[08:25:18] maloik_: I'm playing around with the Multitenancy with Rails book, and ran into this issue while trying to scope the Forem gem's forums on my account model: https://gist.github.com/hannesfostie/53d0b5a9aac1d41f0de9
[08:32:12] xhoy: sevenseacat: about the side wide notification?
[08:32:31] sevenseacat: it answers the question that was asked by tastycakeman?
[08:32:51] xhoy: i scrolled back and couldn't find the question :)
[08:33:06] xhoy: that is why i wonderd because i read he was sick, tought maby he quit or something :)
[08:41:48] olivier_bK: http://facebook.github.io/react/
[08:43:03] tagrudev: The XML syntax inside of JavaScript is called JSX
[08:43:13] tagrudev: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBYHuqDnzn7XNHd8qOarFQioSn6yyjFzTlaDzn8tsFoHN61e14
[08:45:06] carlos_: olivier_bK: thanks for the link, it looks quite awesome
[08:45:41] olivier_bK: carlos_, your welcome
[08:46:22] carlos_: I wonder how it could be integrated on CoffeeScript
[08:46:49] carlos_: perhaps the nature of the language itself could make it a bit more annoying (whitespace oriented)
[08:51:29] skroon: when i'm trying to start rails console i'm getting the error: No such file to load -- irb/error.rb i'm wondering though which gem has this irb/error.rb and who's trying to require it
[08:51:39] skroon: anyone have some ideas perhaps?
[08:53:11] tagrudev: yolo clocKwize
[08:53:20] clocKwize: this is technically true
[08:53:45] clocKwize: unless there is some kind of heart surgery
[08:53:49] clocKwize: where my heart is stopped
[08:53:57] clocKwize: then i am technically dead
[08:54:04] clocKwize: so when I'm brought back
[08:54:07] clocKwize: is that living twice?
[08:54:08] tagrudev: I suppose you're right
[08:54:23] tagrudev: but if we consider your lifespan as a start and an end yolo is correct
[08:54:50] tagrudev: how's Britain :D
[08:55:48] tagrudev: didn't expect that
[08:56:31] clocKwize: need summer.
[08:56:44] clocKwize: how about you?
[08:57:57] tagrudev: summer has come here, waiting for the lunch though
[08:58:38] clocKwize: where are you? bulgaria domain? :p
[08:59:03] carlos_: southern spain… hot as hell already
[08:59:37] clocKwize: I need some spain. hopefully have a week in spain/greece at end of august (If I pay off my car:D)
[09:00:47] tagrudev: clocKwize, yup
[09:00:50] carlos_: nice beaches
[09:01:03] clocKwize: tagrudev: bulgaria nice right?
[09:01:26] tagrudev: clocKwize, for a holiday yeah :D
[09:01:38] clocKwize: living there not so good?
[09:02:28] tagrudev: most of the natives think so :)
[09:05:19] clocKwize: wait, most think its not so good, or it is good?
[09:05:23] clocKwize: ACTION confused
[09:06:21] tagrudev: clocKwize, I'd like to think that's a personal option :D
[09:06:41] clocKwize: still confused :p which is your opinion lol
[09:07:18] happy_: hey guys. I got a very good one:
[09:07:22] happy_: (rdb:1) organization.owners_team.members.include?(user)
[09:07:22] happy_: (rdb:1) organization.owners_team.members.collect(&:id).include?(user.id)
[09:07:38] happy_: if that rings a bell to anyone...
[09:08:06] tagrudev: clocKwize, yoloing :D lunch is here gotta go, if you're interested I would share more information for Bulgaria after that
[09:08:50] elaptics: lunch? It's only 10am here :)
[09:11:15] xhoy: i have an app in a relative root path, but devise still redirects them to / instaed of the subdir..
[09:11:21] xhoy: any suggestions where to look?
[09:11:38] elaptics: devise documentation?
[09:12:35] xhoy: yeah it is but i dont get it :P
[09:12:48] xhoy: i mean why it doesn't just respect the relative root url :)
[09:16:08] lessless: guys, how are queses managed in sidekiq/dj? can I be sure that tast will be executed immediately after it gets in the queue?
[09:16:20] xhoy: have you watched the railscast?
[09:16:47] xhoy: and, no you cant, because that is the concept of a queue and background tasks :)
[09:20:32] elaptics: xhoy: I don't really use devise but I think by default it redirects to root_path so you would need to set that to be whatever you want. Otherwise I suspect that you would need to override whichever controllers as necessary to redirect where you want
[09:21:05] joonty: xhoy: you can use after_sign_in_path_for()
[09:21:06] xhoy: going to make some debug stuff really weird
[09:21:20] xhoy: joonty: yeah but that is different for production, staging en dev :P
[09:21:39] elaptics: lessless: the best you can do is send it as a priority job so that it can jump the queue but there's still no guarantee how fast it's going to get executed. That's up to you to make sure you have enough workers working the jobs off the queue as fast as possible - then it will be as quick as it can be
[09:21:52] xhoy: so i then need to hack something like after_sign_in_path_for('#relative_root_url'/user/login)
[09:21:56] xhoy: or something
[09:22:02] xhoy: witch feels like a hack :)
[09:22:22] elaptics: these are the reasons I don't use devise :)
[09:22:40] xhoy: what do you use?
[09:22:46] elaptics: seems to always have to hack at it when your app doesn't conform
[09:22:59] joonty: elaptics takes the chuck norris approach and does it himself
[09:23:00] elaptics: I just tend to write my own auth now
[09:23:08] elaptics: joonty: damn right :)
[09:23:31] joonty: before breakfast
[09:23:56] elaptics: it's quick to do the basics and then you don't spend loads of time mucking about when the client wants something special and you have to hack around getting devise or whatever to do it, you just write what you need
[09:24:35] xhoy: heheh it worked in rails 3.0 :P
[09:24:43] xhoy: (or i didn't notice it was broken :)
[09:37:46] ftlstrm: hello, i am having gem issues https://gist.github.com/anonymous/8dcbdefc049887d098e4
[09:39:38] DouweM: ftlstrm: it's pretty straightforward. spree_auth_devise requires an older version of jquery-rails then the one you're including
[09:40:28] ryorky1: what's the lowest version of jquery-rails that includes jquery-ui 1.8?
[09:41:35] ftlstrm: in gemfile, it is defined as gem 'jquery-rails' (no version number)
[09:42:15] jarr0dsz: hi everyone, anyone knows if its possible to make this a 1 liner: http://pastie.org/7983067 ?
[09:42:42] DouweM: ftlstrm: and what does your Gemfile.lock say?
[09:42:43] jarr0dsz: ofcourse putting it in 1 line but with code refactor will be multiline again something like puts "bla" if ...
[09:43:14] DouweM: jarr0dsz: why would you ever want to make that a one-liner
[09:43:39] jarr0dsz: DouweM: cause im having 200 of these blocks and it would save 400 lines when refactored to 1 line
[09:43:55] DouweM: jarr0dsz: :D
[09:43:56] ftlstrm: my gemfile : http://d.pr/n/DqVn gemfile.lock: http://d.pr/n/GjpY
[09:44:27] DouweM: jarr0dsz: I don't think there's a one-line syntax for that. You could define one though
[09:44:59] DouweM: ftlstrm: you're currently on 3.0.0, so you need to downgrade in order to install spree_whatever
[09:45:49] DouweM: jarr0dsz: def resized_version(name, size); version(name) do process :resize_to_fill => size; end; end
[09:46:01] DouweM: jarr0dsz: followed by resized_version :img29x29, [29, 29]
[09:46:32] jarr0dsz: thank you DouweM i try that
[09:47:05] DouweM: you might need def self.etc, but you'll figure that out
[09:47:36] DouweM: jarr0dsz: also, if you've got 200 versions, you might be doing something wrong
[09:51:16] elaptics: jarr0dsz: 200 versions?!?!
[09:51:30] gamov: Hello the Pro. I'm about to break a model table in two… it feels scary and I want to be sure there are benefits to it. I have a Shipment model and I want to shift all processing information into a new model/table called ShipmentProcessing where I'll store all sort of dates and information (that I need only the processing area of my app). In broad terms, do you think I'll have speed benefit or I should just continue adding fields to my
[09:51:30] gamov: Shipment model?….. thanks!
[09:52:53] gamov: I could stuff all those in a AR::Store but I still need to do some queries on the data
[09:53:36] lessless: dudes, what can I use to describe my api?
[09:54:28] DouweM: lessless: English?
[10:04:39] ryorky1: ftlstrm: there are versions of jquery-rails though
[10:08:10] drale2k: was is always application.css ? not a .scss file?
[10:09:45] carlos_: you can have both, no? :|
[10:10:05] carlos_: depending on your extension, it'll just interpret it as such
[10:11:30] carlos_: oh sorry, it's .css by default and then you use the require directives http://guides.rubyonrails.org/asset_pipeline.html
[10:11:47] drale2k: carlos_: yeah i was just thinking it used to be a .scss
[10:11:59] drale2k: i renamed it to .scss and it works fine, any problem with that?
[10:12:21] carlos_: if it works it works I guess heh
[10:13:47] ryorky1: gamov: optimizing databases is always preferential
[10:14:01] ryorky1: sounds like a good idea to me
[10:14:39] ftlstrm: DouweM: thank you
[10:14:44] gamov: ryorky1: yes, that's why I feel I should do it…. I'm a bit wary of the consequences I can't see beforehand..
[10:15:57] drale2k: gamov: test everything as much as you can locally and have a db backup
[10:16:08] drale2k: in the worst case just restore
[10:18:10] gamov: drale2k: yep… I must make sure the attributes I want to extract are not needed by associations ie….
[10:18:33] lessless: how to query only certain attributes from a model: User.only(:email, :last_name, :first_name, :address, :phone_code, :phone_number).find(1)
[10:18:43] gamov: thanks for your comments drale2k ryorky1
[10:19:43] gamov: lessless: User.where(email: 'efefe@.com', lastname: etc…).first
[10:20:39] drale2k: gamov: is it a site with traffic?
[10:21:55] lessless: gamov, ohh, sorry, I put it wrong: not query, but select... select only specified attributes :)
[10:24:38] ryorky1: gamov: u should be good to go
[10:26:08] clocKwize: anyone know how to fix the problem of deploying to heroku and your app taking like 20 seconds to respond
[10:26:11] james_woods: Is it possible to debug the javascript of a ruby on rails app in chrome and edit the source directly in chrome as well using the local webrick server?
[10:26:34] elaptics: lessless: #select is what you want
[10:26:43] DouweM: clocKwize: the dynos and your Rails app will restart, so of course there'll be some downtime while they do
[10:26:45] gamov: lessless: for one attribute: .pluck(column_name) (will be extended to support multiple attributes soon (https://github.com/rails/rails/commit/e5cd300becab8e05f4568a402e3fce4f4497733a) I use the valium gem for now
[10:26:51] elaptics: lessless: User.select(:field1, :field2)
[10:27:11] clocKwize: DouweM: I know. I asked a solution to the problem, not an explanation of it… I'm aware of the reason
[10:27:41] gamov: lessless: elaptics solution will instantiate ruby models, pluck and valium not
[10:27:43] drale2k: lessless; User.select("email", "last_name", ...).find(1)
[10:27:47] DouweM: clocKwize: all right. I'm not aware of a solution, unless you can change the Heroku deploy process
[10:27:51] drale2k: where 1 would be the id
[10:28:40] elaptics: gamov: yep correct, lessless can decide what is actually desired behaviour
[10:29:19] drale2k: clocKwize: i asked that on the support some time ago. They said they were working on zero-downtime deploys
[10:29:32] drale2k: that was over 6 months ago
[10:30:06] elaptics: clocKwize: do you use unicorn?
[10:30:32] elaptics: clocKwize: and using preload_app true?
[10:31:06] elaptics: clocKwize: as far as I know that's about as quick as you can get right now then
[10:31:20] drale2k: http://stackoverflow.com/questions/9344788/am-i-preloading-the-app-in-heroku-unicorn-correctly
[10:32:39] DouweM: I'm not sure what kind of solution you are looking for anyway, the app will always need to restart, there's no way around that...
[10:33:22] drale2k: DouweM: yesterday i was on a Sitepoint chat session and i asked how they handle deploys for Learnable.com
[10:33:41] elaptics: clocKwize: stack overflow article points to https://devcenter.heroku.com/articles/labs-preboot/
[10:33:41] drale2k: he said they where spawning workers and then swaping them out when the app is ready or seomthing
[10:33:57] drale2k: something like that, i did not really understand it
[10:35:17] DouweM: elaptics: :O
[10:35:32] clocKwize: might give this a go
[10:35:47] DouweM: drale2k: yeah, that's like what elaptics linked to, but I didn't know that was possible with Heroku
[10:41:19] drale2k: could heroku do faster asset precompilations or is ruby the bottleneck ?
[10:44:13] DouweM: drale2k: https://github.com/ndbroadbent/turbo-sprockets-rails3
[10:44:31] drale2k: DouweM: you gave me that before and i use it but it is still slow
[10:44:34] drale2k: ~ 60 seconds
[11:16:48] clocKwize: coffee script makes js so much like ruby, that I keep binding.pry'ing in there
[11:18:51] tagrudev: that's a nice idea
[11:19:50] tagrudev: gotta think, there's got to be something like that already written
[11:21:20] DaniG2k: omg im so bored at work -_-
[11:21:26] DaniG2k: can someone send me something amusing plz
[11:22:05] tagrudev: DaniG2k, me doing meditation https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-frc3/969877_10151939364659008_1980138949_n.jpg
[11:25:59] tagrudev: http://coding.fm/ - angry coding sound :D epicness DaniG2k
[11:29:12] elaptics: tagrudev: angry dev coding is just a live recording of omarqureshi :)
[11:29:37] elaptics: tagrudev: when he's not even angry :)
[11:29:58] tagrudev: you know emacs can make you nervous :D
[11:30:00] DaniG2k: i cant listen to it now
[11:30:04] DaniG2k: will do later
[11:38:20] lxsameer: is there any way to force rails generate command, to generate translate marked strings ?
[11:40:50] lessless: ok, how, do I select only desired attributes if user instance is passed in to the method (callback) ?
[11:41:48] lessless: user.attributes(:email, :last_name, :first_name, :address, :phone_code, :phone_number).to_xml :)
[11:45:18] daniel_-: HI all. isnt there a assets/images directory in rails 4? do I have to create it to make image_tag work?
[11:48:24] jost: In rails, there is the method "test" for creating tests with readable names. So I can write 'test "Description of the test case" do [...] end'... Where is this method documented?
[11:49:20] elaptics: lessless: what are you trying to do? Only have certain fields when you output it as xml or json or something?
[11:49:33] lessless: elaptics, exactly
[11:50:26] lessless: oh,, there is an only option for to_xml ;)
[11:50:43] elaptics: lessless: so you can pass lots of options to as_json, including only:
[11:51:14] elaptics: and yep, same with to_xml
[12:02:27] daniel_-: why is there a assets/images directory created by default rails 3.1 and not in rails 4 ?
[12:20:45] greengriminal: Quick question is there a particular reason why there is not a default directory `assets/images` when you generate a Rails 4 app (Rails 4 rc1). Whereas if i do this using Rails 3.2/3.1 it is generated.
[12:20:57] greengriminal: I'd be interested to hear an answer from anyone who can shed some knowledge on this.
[12:22:34] maloik_: is rails.png in public or assets/images when you generate? I'm not sure...
[12:22:44] maloik_: that might be the explanation: that image is no longer being generated
[12:24:10] greengriminal: maloik_ There is no assets/images directory what so ever. However I can manually create this, but this is not the point
[12:25:17] maloik_: in 3.2.13 I meant
[12:25:23] Radar: Good morning.
[12:25:58] greengriminal: Oh in 3.2.13 it creates an assets/image directory
[12:26:01] elaptics: maloik_: I haven't tried the latest rc so far but I think that there's no index.html in public any more either because it's done dynamically
[12:26:06] greengriminal: but moving to Rails 4 it doesn't
[12:26:34] maloik_: elaptics: thats my point: in 3.2.13 it might generate the directory as it has to generate rails.png inside of it (unless its in public)
[12:26:46] maloik_: in r4 there's no image anymore, so the directory might not get generated any longer
[12:27:10] elaptics: yep, could be the case
[12:28:16] greengriminal: so my question is then if I want to load images into my application I have to put this in the public directory?
[12:28:29] maloik_: not at all, just create app/assets/images
[12:28:42] elaptics: greengriminal, daniel_- https://github.com/rails/rails/pull/10436
[12:29:17] daniel_-: greengriminal: I had the same question eheh
[12:29:41] daniel_-: thx elaptics
[12:32:57] daniel_-: elaptics: in order to use image_tag I need assets/images right?
[12:33:45] greengriminal: daniel_- Thats what you would do in Rails 3.2.13 so i believe so yes
[12:34:07] elaptics: daniel_-: kind of. Technically no, since there are multiple locations for assets and it looks everywhere
[12:34:23] elaptics: e.g. lib/assets/images and vendor/assets/images
[12:35:11] elaptics: and you can also disable the pipeline so you can continue to use public/images too
[12:35:14] ryannielson: Hey, I use Gravity Forms in Wordpress, which allows you to easily create forms using drag and drop. And then rendering them on the front end. Are there any rails gems to do something similar?
[12:35:52] greengriminal: elaptics: But when the application looks for the assets would it not look in the 'app' directory first, then progress in looking in different locations
[12:36:50] elaptics: greengriminal: yes afaik, but if the directory isn't there it'll carry on looking
[12:37:07] greengriminal: ryannielson: Look into using jquery draggable - http://jqueryui.com/draggable/
[12:37:24] greengriminal: elaptics: Cool beans
[12:37:51] ryannielson: greengriminal: Ya, this will come in handy if I want to make it myself. But I was just hoping there was a gem that did that already.
[12:38:52] greengriminal: ryannielson: Well I am sure if you have a form you can set a `div` around it and assign it an id. Then you can just call the .draggable() function in your application.js
[12:41:15] Sep1: Hi guys, I have a ruby script in /lib folder and from this script I would need to connect to the Rails' database and fetch some data, but how to do that? I've tried to add into this script following: "require 'active_record'". But then when I ran "Article.each …", I got the error "uninitialized constant ActiveRecord (NameError)"
[12:41:38] Sep1: could you help me, please, how to fetch data from a database from a ruby script?
[13:00:21] juo100: how about http://stackoverflow.com/questions/1643875/how-to-use-activerecord-in-a-ruby-script-outside-rails
[13:00:39] juo100: or http://sequel.rubyforge.org/
[13:04:31] universa1: or just require config/environment; put it in a rake task ;)
[13:10:14] criten: Does anyone here use raphael?
[13:10:30] elaptics: criten: used it a little bit
[13:11:30] jezi22: i can't find the right keyword to search for. what do you call if i want to add a custom page for rails_admin?
[13:11:43] criten: I have about 84 paths on my screen and when i click one i reset them to the natual state then set the one clicked to active. But the second time I do that the st[x].attr is set to the attributes, not to the normal function to set the attributes.. it's a really weird problem...
[13:12:46] Radar: criten: there's a raphael channel and a javascript channel. I don't see how this question has anything to do with Raisl.
[13:13:25] beckyconning: hi! i've put some code that works in the rails console into a migration however it doesn't seem to work at all in the migration. could anyone shed some light on this? maybe point me towards some resources on custom migrations or good practice? https://gist.github.com/beckyconning/5677706
[13:14:09] Radar: beckyconning: please define "doesn't seem to work"
[13:14:50] Radar: beckyconning: I would think it's because you might need to do ReviewUser.reset_column_information before calling ReviewUser.all.each
[13:15:36] beckyconning: runs but doesn't update the ids which i'm specifying
[13:15:37] Radar: Because during the .all.each, the column information has not been updated with the new field.
[13:15:51] beckyconning: oh! that sounds really likely : ) thanks radar
[13:16:59] jarr0dsz: hi anyone have issues with keep getting a block in materialize': Could not find multi_json-1.7.4 in any of the sources (Bundler::GemNotFound) ?
[13:17:11] jarr0dsz: i tried everything remove lockfile, specify version that error keeps :(
[13:18:02] Radar: jarr0dsz: wat
[13:18:48] jarr0dsz: on rails server start it throws that error, also removed older multi_json gem versions
[13:19:06] maloik_: what does bundle say ?
[13:20:53] beckyconning: radar: that worked perfectly thanks : )
[13:23:55] Radar: jarr0dsz: that's seriously all the output
[13:24:23] maloik: I have a feeling he forgot to run bundler after removing the lockfile, as he jumps to talking about rails s output :-)
[13:24:40] jarr0dsz: Radar: yes but it was a rvm issue so it seems it used the wrong gemset ;s
[13:24:57] Radar: And this is why you shouldn't use gemsets
[13:25:14] jarr0dsz: created new project to testdrive some of devise features ;p
[13:26:01] zeel_: what is a better alternative to using gemsets ?
[13:26:19] Radar: zeel_: Using Bundler.
[13:26:38] Radar: zeel_: Bundler solves the problem by only loading the gems that you need. Gemsets were another way to limit the gems that would be available in your application.
[13:27:17] zeel_: ok thanks Radar, much appreciated
[13:27:25] elaptics: gemsets are nice if you use them exclusively then you don't need to constantly prefix stuff with "bundle exec"
[13:27:35] zeel_: the railsapps tutorials recommend using gemsets
[13:28:56] kedarm: I like using gemsets for the compartmentalization they provide (and I always use project specific .rvmrc).
[13:29:49] zeel_: yeah that's what I thought would be the most manageable way of doing it, if you don't set a .rvmrc I would imagine it being a ball ache
[13:29:57] Radar: imo bundler solves that problem
[13:30:09] Radar: elaptics: you can stop that by doing bundle --binstubs and then using bin/<command>
[13:30:20] Radar: some people even add the bin directory to their $PATH
[13:30:52] elaptics: Radar: yep, - I actually use this https://github.com/mpapis/rubygems-bundler/
[13:32:38] tubbo: Radar: that's what i do, i use autoenv to do PATH=$PWD/bin:$PWD/vendor/gems/bin:$PATH
[13:32:43] tubbo: in each ruby dir
[13:34:44] maloik: Radar: if you work on multiple projects, wont bundler keep overwriting (and removing) gems from your other projects ?
[13:35:20] maloik: I use gemsets with no issues (but also display current gemset in my terminal to the right at all times) because I thought that's how it works
[13:35:26] Radar: maloik: no
[13:35:53] maloik: also, not having to use bundle exec is kinda nice :D
[13:35:56] kedarm: maloik: ditto. I use oh-my-zsh that has support for that.
[13:35:57] hoffmanc: does anyone know if O(n*4) is basically just O(n) ?
[13:36:12] hoffmanc: as far as O(n) meaning linear
[13:36:15] Radar: maloik: gem v0.0.1 in one project should == gem v0.0.1 in another
[13:36:31] hoffmanc: more generally: O(n*c), where c is a constant
[13:37:08] kedarm: hoffmanc: yes.
[13:37:25] hoffmanc: sweet, so I didn't answer my interview question incorrectly
[13:38:29] hoffmanc: wish there was a map of where everyone here lived (at least city)
[13:38:35] kedarm: hoffmanc: it's a little convoluted. if an algorithm takes a n times constant steps then it is O(n).
[13:38:58] hoffmanc: yeah, it feels almost like a differential equation or something
[14:10:00] miskander: Would anyone know if sending USR2 signal to unicorn will restart workers based on old configs or new?
[14:10:24] miskander: It seems that USR2 restarts workers but the code is still cached as the old version
[14:23:35] weckl: tuga powa
[14:24:10] mklappstuhl: is there a way to disable a submit FormHelper.submit button? I can easily disable a submit_tag button but apparently not this one..
[14:33:20] allaire: Hey guys, I have a polymorphic type called Person, I have 3 types: Contact, User, Tenant. Contact and Tenant have an organization_id column. in the table "people" Thing is, User may have multiple organizations, so it has a dedicated table named "users_privileges", meaning that the organization_id in the table "people" is null for the type User, since it has many. Is there anyway to tell ActiveRecord when I do a Person.all,
[14:33:20] allaire: that for User, it must not check the column organization_id in the table "people" and look for the has_many in "users_privileges" table ?
[14:35:55] dcope: does anyone have a working deploy.rb and unicorn.rb that they wouldn't mine sharing?
[14:36:55] juo100: dcope: I've been using https://github.com/sosedoff/capistrano-unicorn
[14:38:10] dcope: juo100: awesome, thanks
[14:41:38] dcope: juo100: i have this problem where whenever i deploy cap throws a bunch of errors about not being able to make public/{foo}
[14:41:43] dcope: and then it doesn't start unicorn
[14:43:50] dcope: juo100: have you seen anything like that?
[14:44:47] juo100: dcope: hold on show you the deploy I've got for one of my websites
[14:44:50] juo100: using that plugin
[14:45:32] dcope: juo100: awesome, thanks. do you also use a unicorn.rb to help? sorry for the noob questions, i just tried switching from passenger to unicorn last night.
[14:45:36] dcope: and ran into those problems :(
[14:47:24] juo100: dcope: http://pastie.org/private/j2tcnacundjkrhlqoilhta
[14:47:36] juo100: yeah I've got a very simple unicorn.rb
[14:48:44] dcope: awesome, thanks for sharing this.. ill use it as a template and (hopefully) get this working! :D
[14:49:06] clocKwize: expected: #<BigDecimal:7fd39bd56148,'0.23052E3',18(36)> got: #<BigDecimal:7fd39bd56418,'0.14936E3',18(18)>
[14:49:21] Radar: sounds fiar
[14:49:28] clocKwize: anyone get the feeling that big decimal should maybe have .to_s in the .inspect
[14:51:46] juo100: dcope: if thats the actual error it sounds like you're doing "/foo/{bar}" rather than "/foo/#{bar}"
[14:52:28] dcope: juo100: oh, that's not.. sorry, i was just using that as an exmample. it fails to create about 10 folders in public
[14:52:37] juo100: oh did you do
[14:52:43] juo100: bundle exec cap:setup
[14:52:53] juo100: cap deploy:setup
[14:53:00] dcope: yep, i did all that.
[14:53:05] ahawkins: can I make rails server vendor/assets/fonts like normal assets?
[14:53:14] dcope: i was using a complex deploy though.. here it is https://ariejan.net/2011/09/14/lighting-fast-zero-downtime-deployments-with-git-capistrano-nginx-and-unicorn/
[14:53:31] dcope: juo100: are you achieving zero downtime?
[14:53:35] keiga: question, i have a controller/view with 3 variables I have condensed into an object i want to pass to the view. Following conventions, where should this go?
[14:53:37] dcope: when you deploy
[14:53:53] dcope: awesome! :D
[14:53:58] dcope: that is exactly what i'm aiming for
[14:56:39] keiga: question, i have a controller/view with 3 variables I have condensed into an object i want to pass to the view. Following conventions, where should this go?
[14:56:46] juo100: id need some visitors to my website for it be an issue :P
[14:57:12] keiga: can anyone hear me at all? Not sure if my text is going out or not?
[14:57:28] fryguy: keiga: it is
[14:57:41] keiga: nice, anyone have a guess at my question?
[14:57:43] fryguy: keiga: you could try reading about presenters
[14:58:31] juo100: make an instance variable?
[14:58:45] juo100: <%= @var %> in the view
[14:58:58] keiga: right now i have three of them, which as i understand is bad style
[14:59:00] keiga: so i have like
[14:59:06] keiga: @var1 = 1
[14:59:10] keiga: @var2 = 'test'
[14:59:14] keiga: @var3 = list of stuff
[14:59:23] keiga: i condensed it down to one object to do this
[14:59:31] keiga: @var = method to fill it
[14:59:43] keiga: and access it via @var.var1, @var.var2...
[15:01:11] juo100: so if you set the @var = Object
[15:01:11] juo100: and just call the methods from within the view
[15:01:27] juo100: that would be fairly normal
[15:01:35] keiga: that is the whole point, i am not certain where to put this class though
[15:01:42] keiga: in helpers?
[15:01:43] slash_nick: keiga: what class?
[15:02:03] helpa: keiga: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:02:03] slash_nick: keiga: !gist the class? :)
[15:02:12] slash_nick: I assumed you had just used an Ostruct or something
[15:02:25] slash_nick: OpenStruct, sorry
[15:02:36] juo100: if the objects data is to be persisted in the database you'd put it in the model, otherwise stick it in the lib directory
[15:02:41] juo100: it really depends what this class is
[15:04:07] keiga: i make ea class as a container for X variables i will use in the view which pertain in my case to blog posts in some way. Perhaps the mos tpopular posts, a list of popular posts, a list of all posts etc. Instead ofr declaring a bunch of instance variables, i wrapped them into one class as a proxy to access them
[15:04:18] keiga: essentially just a container object
[15:04:25] slash_nick: keiga: http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html
[15:04:31] slash_nick: let the class be definedi n ruby. :)
[15:04:33] keiga: and it works, i was curious as to where i should put this
[15:04:46] juo100: you might also be interested in http://cells.rubyforge.org/
[15:04:51] keiga: the question is where, if i wanted to follow convention, should the ruby file be placed
[15:04:54] keiga: in helpers, models?
[15:05:35] slash_nick: keiga: australia = OpenStruct.new(:country => "Australia", :population => 20_000_000) ... OpenStruct is a class provided to you by plain old ruby
[15:05:50] Radar: keiga: show us what this class looks like?
[15:06:13] keiga: so just put everything in a hash instead?
[15:06:18] keiga: i suppose that would work too
[15:06:34] juo100: put it where it makes sense :)
[15:06:37] keiga: Radar, it really doesn't matter what the class looks like.
[15:06:39] kedarm: keiga: why not use plain old Struct (since this is just a struct)?
[15:06:42] slash_nick: but if you want to define a class to hold a few variables... either in lib as juo100 suggests, or in app/models/
[15:06:53] timmillwood: I'm using devise for authentication across multiple subdomains, it only seems to be working across the subdomains if I check the "remember me" box at login"
[15:06:57] keiga: slash_nick, that was my question
[15:07:10] keiga: and kedarm, that was my thought
[15:07:19] slash_nick: keiga: yes... use a Struct, OpenStruct, or Hash... no need to define a class... there are three valid ones right there
[15:07:23] keiga: you do lose intellisense, but thats not a big deal
[15:07:34] Radar: keiga: sharing is caring and you're not caring right now.
[15:07:47] juo100: talk is cheap, show me the code
[15:08:36] keiga: Radar, the problem/question itself doesn't pertain to code, it pertains to conventions. It boils down to, I have an extra model, where does it belong, in helpers or models. As some have pointed out though, what I am trying to accomplish could be done with hashes almost as well
[15:08:45] rehat: rails how to grab attributes from a join table
[15:08:49] slash_nick: keiga: NOT helpers.
[15:08:59] Radar: keiga: When people ask for code, it's generally polite to show it.
[15:09:04] Radar: So, please show us the code.
[15:09:12] kedarm: keiga: I am not sure it's a model -- it's a way to share instance variables between C and V.
[15:09:18] blahwoop: good morning!
[15:09:32] keiga: true kedarm
[15:09:33] Radar: It sounds like a ViewModel similar to what Draper has.
[15:09:59] blahwoop: vim users: how do i paste outside of vim lol
[15:10:06] keiga: so in that case, should it just be a hash of variables and pass the hash? Seems like the cleanest way. Is that how its commonly done? I am sure its common case that you want multiple accesible variables in a view
[15:10:29] Veejay: Is it possible to have a cookie be destroyed either after an expiry date OR when the browser is closed?
[15:10:30] keiga: and also, as a followup question, generally what should helpers be reserved for? Helper methods only
[15:10:44] kedarm: keiga: yes and yes ;)
[15:10:57] Veejay: i.e. if the broswer is open, wait for a timeout, as soon as it's closed, destroy the cookie
[15:11:01] Radar: blahwoop: #vim
[15:11:04] slash_nick: keiga: my helpers just reduce a big ol' block of html to a method call
[15:11:26] kedarm: slash_nick: +1
[15:11:58] kedarm: Veejay: see session cookies
[15:12:36] blahwoop: any activeadmin pros here? i have a nested form that doesnt have any errors but the form isnt rendering
[15:12:56] blahwoop: using semantic_form_for
[15:13:00] slash_nick: kedarm: well they also handle any sort of if-elsiness involved in choosing the html
[15:13:02] blahwoop: aka formtastic
[15:13:31] kedarm: slash_nick: I meant that is a good use of helpers.
[15:13:54] dpritchett: Is there a straightforward way to skip all callbacks on bulk create/delete options in Rails?
[15:13:56] slash_nick: just coming clean in that they also contain logic :)
[15:14:09] dpritchett: well, not bulk actions so much as a large batch of single actions
[15:14:23] helpa: http://www.pxleyes.com/images/contests/rube%20goldberg/fullsize/rube%20goldberg_4a3c0e06144db.jpg
[15:14:49] dpritchett: how's that slash_nick?
[15:15:56] slash_nick: dpritchett: http://stackoverflow.com/a/633330/1152759
[15:16:26] Veejay: kedarm: That much I know but I was wondering about the mechanism to handle BOTH a timeout and a session cookie with no expiry date
[15:16:52] Veejay: The former will be destroye after a timeout, the latter when the browser is close
[15:16:54] slash_nick: or update_columns, seems better received
[15:18:22] maloik: Radar: if you'd happen to have a minute, do you spot a problem here instantly? https://gist.github.com/hannesfostie/53d0b5a9aac1d41f0de9
[15:18:31] Radar: maloik: pebkac
[15:18:49] kedarm: Veejay: I am confused.
[15:18:52] maloik: hmmm :< was afraid so
[15:19:34] luckyruby: Is there a way to tell what version of rails is currently running?
[15:19:41] dpritchett: thanks slash_nick
[15:19:49] dpritchett: Rails.version
[15:20:04] luckyruby: dpritchett: I mean from a client like the browser
[15:20:36] kedarm: luckyruby: not many rails servers would want to tell you that ;)
[15:20:39] dpritchett: only indirectly, as far as I know
[15:20:48] luckyruby: I have a situation where gemfile says 3.2.13 but error messages via exception notification shows 3.2.11.
[15:21:06] maloik: Radar: is using class_eval on the forum model not possible then? Cause I really can't spot what I'm doing wrong
[15:21:25] dpritchett: That sounds like a problem, but I can't see why you'd need a browser involved in the solution.
[15:21:33] dpritchett: Can you put "#{Rails.version}" in a template?
[15:21:52] luckyruby: dpritchett: good idea, let me try that
[15:22:51] dpritchett: also did you run bundle update rails after tweaking the gemfile?
[15:24:41] Veejay: kedarm: Basically I'd like the user to get logged out after 30 minutes of idling AND for him to not be able to log back in when he closes his browser and reopens it later
[15:28:24] kedarm: Veejay: perhaps http://stackoverflow.com/questions/5860950/setting-session-timeout-in-rails-3 would help?
[15:28:27] luckyruby: dpritchett: yeah, I have. I'm thinking it might be an issue with unicorn and rolling restarts.
[15:28:44] Veejay: I'm considering updating some session cookie in the application_controller for each request, but that might be heavy-handed
[15:29:35] elaptics: Veejay: I missed the start, what is your issue?
[15:32:01] Veejay: kedarm: I'll have a look thanks
[15:32:53] S1kx: anyone know a decent tool to mirror data from one cloud storage provider to another (s3 => google cloud storage)?
[15:33:00] Veejay: elaptics: I need a way to have the current user session be destroyed after a given timeout
[15:33:16] dpritchett: S1kx the fog gem has decent abstractions
[15:33:30] Veejay: So I'm trying something in a before filter
[15:33:36] mantas322: Hello I'm trying to install d3js gem
[15:33:37] dpritchett: You'd probably need to write your own sync wrapper but it makes it easy for you to generalize cloud storage
[15:33:48] Veejay: Where I check the content of a value I store in the session cookie
[15:33:53] mantas322: but it wont work : gem install d3js-rails
[15:33:59] HardFu: anyone got roadie working with RC1
[15:34:35] mantas322: says "Error fetching data: SocketError: getaddrinfo : nodename nor servname....""
[15:35:58] luckyruby: dpritchett: added render text: Rails.version to my controller. /version now shows 3.2.11 after rolling restart. After I deploy:stop and deploy:start the app, it now shows 3.2.13.
[15:36:32] luckyruby: so makes me think that if I bundle update, I have to stop/start instead of restart with unicorn.
[15:37:24] dpritchett: What do you mean by "restart with unicorn" exactly?
[15:37:48] elaptics: Veejay: that's fairly straightforward, just a before filter to check and set expiry timeout in a session and if it's expired then log them out
[15:38:35] luckyruby: dpritchett: kill -s USR2
[15:38:50] s2013: veejay what elaptics said
[15:41:43] mantas322: anyone know the solution to my problem?
[15:42:33] webdestroya: mantas322: are you just installing the gem from commandline, or are you using bundler?
[15:42:43] mantas322: commandline
[15:44:19] webdestroya: mantas322: try `gem install d3js-rails --backtrace` ?
[15:44:52] webdestroya: mantas322: or ask in #rubygems
[15:47:36] webdestroya: mantas322: can you ping rubygems.org ?
[15:48:09] mantas322: no, no I cannot
[15:48:20] mantas322: how do I fix rubygems.org?
[15:48:29] webdestroya: that sounds like a network error on your end
[15:48:38] webdestroya: can you ping google.com?
[15:48:38] mantas322: can u ping it?
[15:48:53] mantas322: google pings just fine
[15:48:58] webdestroya: mantas322: er, not ping
[15:49:05] webdestroya: PING rubygems.org ( 56 data bytes
[15:49:08] webdestroya: like, does it get an IP
[15:49:40] mantas322: yeah I get the IP back
[15:49:47] mantas322: but requests time out
[15:50:10] evenix: I'm having an issue with the javascript of FileUpload + Carrierwave + Nested Form: https://gist.github.com/richardsondx/5678906 I'm basically just trying to inmplemant a way to upload multiple image dynamically with a nested association where Product have multiples Previews
[15:50:12] webdestroya: maybe ask around #rubygems
[15:50:46] mantas322: I commanded them to fix it
[15:50:59] webdestroya: evenix: alert('FUCK')
[15:51:06] eph3meral: evenix: nested forms break down pretty quickly, I'm not surprised
[15:51:13] webdestroya: evenix: so what is wrong with what you have?
[15:51:15] eph3meral: evenix: I usually prefer JS to nested forms when possible
[15:51:19] webdestroya: do you want more preview files?
[15:51:25] eph3meral: by nested forms I specifically mean rails form helpers
[15:52:14] webdestroya: evenix: do you just want more image fields to show by default?
[15:52:37] evenix: webdestroya: yes I'd like to show more images by default
[15:52:49] evenix: I want to be able to upload new file and see the thumbnails right away
[15:52:56] maloik: Radar: found the problem :-) submitting a note on twist
[15:53:08] webdestroya: evenix: then in products#new do 10.times {@product.previews.build}
[15:53:14] webdestroya: that will give you 10 preview fields
[15:53:23] evenix: so The previews should be created as Im uploading new images.. the problem is... its a nested association and I cannot create the nest without creating the product first.
[15:53:42] evenix: webdestroya: interesting ive never used that
[15:54:55] evenix: webdestroya: what about the js issue?
[15:55:03] webdestroya: what is the js issue
[15:55:54] webdestroya: evenix: what is "new_product" what is that ID attached to?
[15:56:28] evenix: So far in the backend when I create a new product and select multiple images. It actually record it properly in the backend.. I have my PRoduct that have multiple previews that each have their own image_url. The problem is that fileUpload is supposed to show the preview and the create action is supposed to use the create.js.erb
[15:56:43] evenix: to check if its a new_preview record and then display it on the form
[15:56:53] webdestroya: im not sure on that one :(
[15:57:14] webdestroya: im not sure you will even be able to do that with what you have now
[15:57:22] evenix: I've been struggling with that because I don't know how I am going to create the preview with js if the product is not saved
[15:57:25] webdestroya: since that relies on previews being created, before you even create the product
[15:57:37] evenix: I'm open for alternative
[15:57:43] evenix: eph3meral : ^ :)
[15:58:14] webdestroya: i guess you would need to create previews without a product
[15:58:19] webdestroya: and somehow link those back
[15:58:20] webdestroya: when you save
[15:58:37] webdestroya: or save the previews to some location on s3
[15:58:47] webdestroya: and when you save the product, read the files in a certain s3 path
[15:59:05] webdestroya: s3://preview-temp-files/SOME_UUID/preview1.jpg
[15:59:12] evenix: yes I guess I can't create a nested_association then but just cerate the Preview independently
[15:59:13] webdestroya: and scan that folder when they save the product
[16:04:06] eph3meral: evenix: tbh I haven't been following your conversation closely enough to advise you well, my main "alternative" isn't really special, I just suggest doing more of the "heavy lifiting" such as nested forms related stuff using JS in general rather than rails form helpers
[16:04:47] eph3meral: evenix: it's just been my experience that nested forms get too complicated very quickly (I believe the official convention is not to use them any more than one level deep anyway)
[16:05:21] eph3meral: evenix: and esp that you're dealing with adding in JS anyway for your uploader - that's why I suggested going a more JS based approach, but if webdestroya's suggestions work for ya, then awesome
[16:05:58] webdestroya: eph3meral: i think the problem lies more with him needing to create a preview before creating a product
[16:06:05] webdestroya: and preview belongs to a product
[16:06:06] mikecmpbll: why is .classify not singularising in my app ;@ works fine in rib
[16:06:09] mikecmpbll: ACTION pulls hair out
[16:06:13] webdestroya: which is a chicken-and-egg problem
[16:06:42] eph3meral: evenix: upload the pictures against a UUID instead of a record ID, then when you create your new record, send the UUID and attach any pics with that UUID after the record is created
[16:07:29] eph3meral: evenix: but doing a preview is A) HTML5 compliant only and B) "not easy" (™)
[16:07:56] eph3meral: evenix: you'll need to bind to the multi upload file element and grab the thubmnails from there and additionally bind to the file onload event
[16:08:08] eph3meral: evenix: again another reason I would suggest just doing it yourself in JS
[16:08:24] eph3meral: I have no idea what kind of code this jquery file uploader has, so unless you feel like digging through it...
[16:11:32] evenix: eph3meral: yea.. I guess you're right
[16:11:34] evenix: thanks guys
[16:11:47] eph3meral: evenix: hey, see my /msg
[16:28:05] chase-work: I have a text_field_tag with the value set as the second parameter. value="" shows up in the HTML with the correct value, but the input field itself is still empty. any ideas?
[16:28:51] pwz2k: Hey if someone can help that would be appreciated. I am stuck on my previous/next functions for my inbox messaging. For starters on certain messages I am getting a "no route matches" error. And then in addition the previous/next links are skipping messages. It should go in order, as in if you're on message 8. The previous link should be 7, and the next link should point to 9. https://gist.github.com/pwz2k/5679191
[16:36:44] chase-work: quiet day today
[16:40:27] scyllinice: pwz2k: Are you sure you're skipping numbers? The only way it would be in numerical order is if all the recipient_ids were the same
[16:43:14] pwz2k: scyllinice: Well I would need for it to be in order based on the users inbox. I am in the inbox now. It starts with message 7. The next message is 8 and the last message is 12. Now when I go to next when I start on message id 7 it takes me to 11. If I go to previous it takes me to 10.
[16:47:02] bauerbob: hi, here's a ruby question: in my table i've got a string: hello #{ User.first.name }, notice: it's w/o quotes (as usual in the database)! now i want to evaluate this string, i've fetched it in a variable named str, so I do: eval str. ruby complains about "hello". so I guess I need to add quotes, so I do: eval %Q/str/, but now I get: hello #{ User.first.name }, so it's not evaluated anymore at all
[16:47:34] scyllinice: Evaluating code from the database is generally a bad idea
[16:48:22] terrellt: bauerbob: Look into implementing liquid templates. What you're doing is a pretty huge security risk.
[16:48:23] bauerbob: so it's better to write "hello @user@" into the database and do a regexp-replace later on?
[16:48:33] Nyris: Hello, i know that this is against BDD, but, I implemented CSV import , And now i want to write Rspec tests, should i write Controller or Model tests for this ?
[16:49:05] scyllinice: pwz2k: I'd run your queries in the console and see what data comes out. Inspecting the result array will probably show you wants wrong
[16:49:55] tkrajcar: bauerbob: terrellt is right, liquid is perfect for this.
[16:50:59] bauerbob: https://github.com/Shopify/liquid/ <-- this liquid?
[16:51:11] scyllinice: Nyris: Where did you implement it?
[16:51:21] scyllinice: bauerbob: That's the one
[16:51:30] Nyris: in my app scyllinice :D
[16:51:30] terrellt: Nyris: Both! Model tests to make sure your converter's individual functions do what you need them to do and controller tests to make sure restrictions and the end result is what you want.
[16:51:32] tkrajcar: bauerbob: yes
[16:51:35] bauerbob: ok, thank you very much!
[16:52:11] Nyris: thanks terrellt
[16:52:13] scyllinice: Nyris: Ok. Someone else will help you. I don't respond well to flippant responses
[16:52:34] Nyris: i think your question was "flippant" :)
[16:52:41] scyllinice: Nyris: Nope, it was not
[16:52:56] scyllinice: If you implemented it in a file in lib, then it would be a different answer
[16:53:04] scyllinice: than if you implemented as a method in a model
[16:53:30] Nyris: oh right, i owe you an apology .. scyllinice
[16:53:54] scyllinice: No big deal now. :)
[16:58:02] jarr0dsz: does anyone know of a gem or solution to save all messages that are send true actionmailer in a log?
[16:58:18] criten: ^ I would also like that actually haha
[16:58:24] jarr0dsz: i wish to log all transactional mails in my app and be able to later review them
[16:58:35] linguini: Is there an easy way to get the return value 'save' would give (ala validation checking) without invoking 'save'?
[16:58:38] jarr0dsz: could code something but perhaps there's a nice maintainted repo havent found anything on github so far yet
[16:58:53] criten: Well when i'm on heroku it logs them for you
[17:00:01] jarr0dsz: some sinatra webinterface engine would be great ;p
[17:00:30] scyllinice: You could use email like it was intended and just bcc yourself on all of the emails
[17:00:39] jarr0dsz: criten: https://github.com/dpickett/postmaster_general only match
[17:00:50] jarr0dsz: thats a neat idea also yes. bcc the message *smart*
[17:10:47] slash_nick: linguini: @object.attributes = { height: 4, weight: 40 } ; @object.valid?
[17:20:19] sam113101: I want to use the AR with eventmachine, is there a way to make asynchronous calls?
[17:28:15] scyllinice: sam113101: You might try https://github.com/igrigorik/em-synchrony
[17:30:52] bauerbob: is there a one-liner to concat a text field of various activerecord results? something like Account.where(foo: true).sum(&:amount), but for strings
[17:32:19] daniel__2: i have a strange issue with a counter_cache not incrementing, what could cause that?
[17:32:35] daniel__2: using rails 4 if it matters
[17:32:55] daniel__2: the line in my schema is: t.integer "events_count", default: 0
[17:33:08] daniel__2: and in the Event model: belongs_to :ticket, counter_cache: true
[17:33:27] daniel__2: it always remains at 0
[17:34:18] jarr0dsz: a perhaps stupid question but i never came across it, inherit multiple levels deep in classes.. like class Mailer < Devise::Mailer < AsyncMailer what would be the way to do this?
[17:34:57] jarr0dsz: daniel__2: could be a bug perhaps check the issues for it on github before spending many times in debugging
[17:35:00] DouweM: bauerbob: lookup the #inject method
[17:35:24] DouweM: jarr0dsz: just < your immediate parent
[17:39:18] daniel__2: jarr0dsz: i think i found a related issue, thanks for the tip
[17:39:25] daniel__2: ill try installing edge ActiveRecord
[17:41:30] rhizome: ACTION wonders if rackspace is taking a dump again
[17:43:59] GeekOnCoffee: github is down :(
[17:44:47] daniel__2: GeekOnCoffee: indeed :(
[17:45:56] rhizome: daniel__2: it's going to look for tickets_count in Event that way
[17:46:54] daniel__2: rhizome, the docs say the counter_cache flag goes on the belongs_to association, but the column on the other
[17:46:58] daniel__2: are you sure?
[17:47:27] daniel__2: github is under DDoS apparently
[17:47:27] zoned: is github down?
[17:47:46] daniel__2: and it's back
[17:47:56] zoned: i just spent an hour typing a readme for a fork, hit save, and its down
[17:48:04] DouweM: daniel_-: not for me
[17:48:08] DouweM: yes for me ;)
[17:48:34] DouweM: zoned: hit back, your browser might have remembered the textarea contents
[17:48:41] zoned: didn't :(
[17:48:51] zoned: because i was in zen probably
[17:49:02] zoned: and it switched back to normal edit when i hit back
[17:49:07] zoned: that sucks
[17:51:47] rhizome: daniel__2: what do you want to be happening, and what model does "in my schema" refer to?
[17:52:01] zoned: and its gone again
[17:52:25] criten: thats a reason why if i'm doing allot of writing.. i don't do it in a web browser :P
[17:54:14] freesteph: is there any gotchas on :validates numericality >= with floats?
[17:54:19] daniel__2: rhizome, thats the tickets table in the schema
[17:54:27] daniel__2: so a ticket should keep a count of how many events it has
[17:54:44] freesteph: because I have a float attribute in my model
[17:54:52] freesteph: and this validation in place
[17:54:58] DouweM: freesteph: makes no matter
[17:55:01] freesteph: validates :credit, :numericality => {:greather_than_or_equal_to => 0.01}
[17:55:12] freesteph: I can validate a record with -12.0
[17:55:17] freesteph: which makes no sense whatsoever
[17:55:29] tkrajcar: typo? :greatHer?
[17:55:41] freesteph: motherf- hell
[17:56:10] freesteph: I am extremely happy and ashamed at the same time
[17:56:15] freesteph: need to get some rest I guess
[17:56:17] freesteph: thanks guys!
[17:56:24] freesteph: tkrajcar: :)
[17:56:32] tkrajcar: that's why we're here :)
[18:00:51] rehat: how to call another active model serializer from another serializer
[18:02:53] blahwoop: whats usually the problem if i can't rollback the db once
[18:03:18] blahwoop: it shows the select statements but it doesnt do anything
[18:03:48] kalleth: yay, github.
[18:04:55] blahwoop: i havent' deleted any migration file
[18:12:50] HardFu: anyone using roadie with Rails rc1
[18:24:20] rhizome: surveys don't really work on irc
[18:26:42] arielserafini: I'm trying to figure out the proper way to extend a model class in Rails
[18:27:02] bricker`work: arielserafini: extend?
[18:27:18] arielserafini: for example, having a Admin model that extends User
[18:27:32] arielserafini: subclass? i don't even know the proper name for that
[18:27:48] bricker`work: arielserafini: that is the proper name for it. "extend
[18:27:55] bricker`work: " means something different in Ruby
[18:28:09] DouweM: arielserafini: are you using ActiveRecord?
[18:28:23] arielserafini: DouweM: yes I am
[18:28:43] rehat: is it normal to create two different models from one path? Like I have a foreign key table that has data related to the two other models
[18:28:58] arielserafini: I tried having User < ActiveRecord::Base and then Admin < User
[18:29:04] DouweM: arielserafini: Look into ActiveRecord STI (Single Table Inheritance)
[18:29:11] DouweM: arielserafini: that'll actually work
[18:29:18] arielserafini: but when I run Admin.all in rails console it lists all Users
[18:29:29] arielserafini: DouweM: cool, will do
[18:29:36] DouweM: rehat: huh?
[18:31:09] terrellt: arielserafini: You can implement STI like that by adding a 'type' column to your users table. After that it should just work. =)
[18:31:28] arielserafini: terrellt: thanks a bunch!
[18:31:30] rhizome: well, the type column has to be populated, too :
[18:31:43] terrellt: If it's empty it defaults to user, no?
[18:32:29] jarray52: When using the surveyor gem, where are the survey files cached? After making modifications to the surveys, I'm not seeing the corresponding changes in the local web application(running on a browser).
[18:32:43] DouweM: terrellt: for before-we-used-STI compatability, sure
[18:32:49] rehat: anyone have an idea as to why I can't access current_user from my active model serializer
[18:32:59] bricker`work: the 'man' command makes for some intersting bash history
[18:33:25] bricker`work: "man brew", "man expand", "man strip", "man touch", "man man"
[18:33:27] bricker`work: and my favorite
[18:33:30] terrellt: DouweM: I seem to remember a spec that showed me that BaseClass.new.type.blank? == true, but I may be mistaken.
[18:33:51] bricker`work: "man whoami" is a unix admin having an existential crisis
[18:34:04] DouweM: bricker`work: :)
[18:34:22] rhizome: rehat: use more words
[18:35:25] rhizome: bricker`work: http://www.feep.net/~roth/geek-humor/unix/unix.shell.jokes
[18:35:36] bricker`work: rhizome: excellent
[18:36:04] krat0sprakhar: hi, i have question about best practices in rails.. I'm trying to add a few constants.. eg. ROLES of users.. which can be admin, moderator, etc etc..
[18:36:15] krat0sprakhar: where should I add these constants
[18:36:21] bricker`work: krat0sprakhar: in the User class
[18:36:50] krat0sprakhar: what if roles are not only associated with users?
[18:37:14] kalleth: fuck me, apt-get install imagemagick
[18:37:18] kalleth: why do you need to install x11-common
[18:37:30] krat0sprakhar: i'll give a more practical example.. each user in my app can refer people.. and on basis of number of people he's a assigned a badge
[18:37:33] bricker`work: krat0sprakhar: what else are they associated with?
[18:37:44] krat0sprakhar: user.badge = "seed"
[18:37:49] krat0sprakhar: or user.badge = "sapling"
[18:38:50] krat0sprakhar: so for example on the home page.. i might have a table that shows badge and no. of referrals reqd..
[18:38:58] bricker`work: krat0sprakhar: Think about it this way, if someone had never seen your code before and you asked them to go in and change the title of each of those roles, where would be they first place they would look probably?
[18:39:04] krat0sprakhar: so in this case it might not be wise to associate a badge only with a user
[18:39:13] bricker`work: krat0sprakhar: just based on your explanation, I would probably check the User class first
[18:39:23] krat0sprakhar: bricker`work, probably a config file?
[18:40:02] krat0sprakhar: so that tomorrow if they want to the seed badge to be awarded to the one who referers to 10 ppl instead of 15
[18:40:04] krat0sprakhar: something like that
[18:40:18] bricker`work: krat0sprakhar: *maybe* in the locale files, but I would personally put them in the User class probably, based on my limited understanding of the app
[18:41:02] krat0sprakhar: how do get a list of badges to display on the home page for example?
[18:41:25] bricker`work: krat0sprakhar: <%= User::ROLES.to_sentence %>
[18:41:26] krat0sprakhar: (just the badges, not users - assuming i go ahead with your solution)
[18:41:51] DylanJ`: kalleth: you can always compile imagemagick from source with --without-x
[18:42:09] kalleth: DylanJ`: yeah, i know
[18:42:12] kalleth: i just tweeted about https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/199418
[18:42:16] kalleth: 4 years to add a compile flag
[18:42:24] krat0sprakhar: so ROLES would be hash in the user class, bricker`work
[18:42:31] DylanJ`: well ubuntu is a satisfy everyone distro
[18:42:36] bricker`work: krat0sprakhar: an array
[18:42:41] kalleth: yes but even on ubuntu-server it's not using that flag
[18:42:43] kalleth: 4 years later
[18:42:53] DylanJ`: does ubuntu-server and ubuntu even have different repos?
[18:43:08] krat0sprakhar: thanks a ton, bricker`work :)
[18:43:11] kalleth: meh, no, actually, DylanJ`
[18:43:16] kalleth: i figured they would have
[18:43:16] DylanJ`: i'd say use gentoo but that's crazy talk
[18:43:27] kalleth: i'm a ruby developer the only linux that exists is debian
[18:43:38] krat0sprakhar: one small question... what are some good open-source rails apps out there whose source code i can browse?
[18:43:40] kalleth: ACTION uses an arch laptop at home
[18:44:58] Aloysius1: Hi, guys. Trying to test a rails engine and running into name space issues I can't figure out.
[18:45:33] helpa: Aloysius1: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[18:45:33] slash_nick: Aloysius1: !gist the bits that will help us... the errors, the classes at play, etc.
[18:49:25] Aloysius1: OK, here's the engine: https://gist.github.com/anonymous/5680135
[18:49:40] Aloysius1: And here's the environment.rb: https://gist.github.com/anonymous/5680145
[18:50:12] Aloysius1: And the error is "uninitialized constant Mine:ApplicationController". But it shouldn't be namespacing to Mine for ApplicationController (I don't think).
[18:51:06] bricker`work: Aloysius1: it's looking in the global namespace too, that's just the error it's displaying
[18:51:17] bricker`work: Aloysius1: this probably just means that this file is getting loaded before ApplicationController has been loaded
[18:52:01] gabeodess: Is anyone here familiar with Paperclip's post_processing callbacks? I'm trying to implement a background job to handle image processing, but I can't seem to get Paperclip to skip the image processing.
[18:54:34] gabeodess: here are the details: http://pastie.org/7984904
[18:54:53] Aloysius1: So, yeah, I started this mess because my test is trying to get to MyController and can't. So I added in the spec_helper.
[18:55:51] bricker`work: gabeodess: look at how delayed_paperclip does it. Here's an example too: https://github.com/SCPR/AssetHost/blob/master/lib/asset_host_core/model_methods.rb That is still using Paperclip 2.7.0 thought so it might be a bit different now.
[18:55:51] gabeodess: Aloysius1: are you getting @controller is nil errors?
[18:56:51] Aloysius1: Nope. Just uninit const.
[18:58:24] gabeodess: bricker`work: I was looking at delayed_paperclip, but I was having trouble following it… but shouldn't my example work? Also it looks like delayed_paperclip hasn't been updated for 2 years so I'm hesitant to go off that.
[19:00:52] blahwoop: good mornings!
[19:01:41] Aloysius1: Also, the actual application works. It's just the testing I can't get going.
[19:01:51] bricker`work: gabeodess: I've never used the paperclip callbacks, but just based on the documentation it seems like that should work. Which version of paperclip and rails?
[19:02:36] gabeodess: bricker`work: Rails 3.2.11; Paperclip 3.4.2
[19:03:11] blahwoop: https://gist.github.com/iRichLau/5674227 how would i go about making line 11 display each line item with its own quantity input. instead of doing a select right now
[19:04:07] blahwoop: with a each do
[19:04:15] blahwoop: but not sure how i woiuld do it
[19:10:31] Aloysius1: And this is the code that causes the error: https://gist.github.com/anonymous/5680330
[19:11:02] Aloysius1: Making me wonder: I know I have an engine-specific application controller, as part of the rails mountable engine generation.
[19:11:20] Aloysius1: Do I also have an engine specific action controller somewhere that needs to get loaded?
[19:16:26] Aloysius1: Just seems like the isolate_namespace has gone wrong.
[19:17:52] slash_nick: Aloysius1: got cut off, would you repost the gist or are you getting help already
[19:18:38] Aloysius1: slash_nick: No, I'm still struggling with it.
[19:18:55] Aloysius1: This is my application controller: module Mine
[19:18:55] Aloysius1: class ApplicationController < ActionController::Base #triggers the uninitialized constant Mine::ActionController (NameError)
[19:19:00] Aloysius1: dammit, sorry
[19:19:07] Aloysius1: Here: https://gist.github.com/anonymous/5680330
[19:19:35] blahwoop: gist that baby
[19:19:39] Aloysius1: The engine code: https://gist.github.com/anonymous/5680135
[19:20:00] Aloysius1: The environment.rb: https://gist.github.com/anonymous/5680145
[19:20:02] slash_nick: Aloysius1: for what it's worth, you can put multiple files in the same gist...
[19:20:24] Aloysius1: slash_nick: Thanks.
[19:21:21] helpa: Aloysius1: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[19:21:21] workmad3: Aloysius1: !gist-usage is helpful
[19:22:38] workmad3: Aloysius1: you might need to force ActionController::Base to be loaded
[19:23:34] Aloysius1: yeah, that's what it seems like (though it seems weird to have to)...
[19:23:59] workmad3: Aloysius1: that'll depend a large amount on how exactly you're ending up with the error though, and bearing in mind that if you're trying to test this directly through gem tests without a dummy rails app, you will have no autoloading behaviour
[19:24:56] Aloysius1: I'm using RubyMine. I have a dummy installation that works. I'm trying to couple that with testing. And...requiring actioncontroller did ... something.
[19:25:31] Aloysius1: Empty test suite now...I guess that's progress...
[19:26:08] workmad3: Aloysius1: yeah, testing engines needs a certain level of knowledge about the difference between a rails environment with autoloading and a normal gem without
[19:26:47] bauerbob: DouweM, concerning your answer with #inject, first of all: thank you! but when searching for inject i came across some benchmarks and all said: use each instead of inject. so now I use a solution with tap, I find it's pretty cool: values << "".tap { |s| post.comments.each { |c| s << c.text }
[19:27:10] DouweM: if you want performance, drop # tap asll ;)
[19:28:04] jarray52: Where does surveyor store surveys? I modified a survey, but the old survey keeps appearing. Not sure how to get the new version to display.
[19:28:13] Aloysius1: OK, so I've added "require 'action_controller/base'" but this just causes the test suite to abort. Hence the "empty test suite" complaint. (Not progress after all...)
[19:28:22] workmad3: bauerbob: any idea on how old those benchmarks were? (I'm gonna guess pretty old, pre 1.9)
[19:28:34] DouweM: jarray52: look through the source, it looks like no-one here has uesd it
[19:29:22] bauerbob: workmad3, yes, I also thought they might be pretty old, so I took a closer look. but it was 1.9.3
[19:29:33] bauerbob: i don't know the exact release anymore
[19:29:58] DouweM: bauerbob: workmad3: it makes little sense to me that #inject would be much slower than using #each, because the implementation is (hopefully) very similar anyway
[19:30:15] workmad3: bauerbob: what was the inject doing? was it doing str += text?
[19:31:00] workmad3: bauerbob: if so, you would probably find doing post.comments.inject("") {|str, post| str << post.text} would help ;)
[19:31:04] Aloysius1: "base.rb" requires "action_controller/log_subscriber" which aborts on the very first line "class LogSubscriber < ActiveSupport::LogSubscriber", sending the code "runner.rb" and an ensure block that says "RSpec.reset".
[19:31:58] bauerbob: http://stackoverflow.com/questions/3230863/ruby-rails-inject-on-hashes-good-style
[19:32:03] bauerbob: that's my source
[19:32:28] workmad3: bauerbob: that source is old
[19:32:33] bauerbob: workmad3, well, the benchmark uses a hash (update vs store)
[19:32:42] bauerbob: but i use str << some_str
[19:33:27] workmad3: bauerbob: the 1.9 way to do that is 'values.each_with_object({}) {|ele, hsh| hsh[ele.key] = ele.value
[19:34:33] workmad3: each_with_object was introduced to allow a way to avoid misuse of inject to build a hash while also avoiding the creation of a closure (which can itself be a weird performance nightmare) in the .each variant
[19:35:24] workmad3: ah, I see the benchmark has .each and .each_with_object
[19:35:33] workmad3: and they're close enough that I'd disregard the difference ;)
[19:40:18] bauerbob: that each_with_oject thingy looks interesting
[19:40:49] bauerbob: anyway - FEIERABEND :) good night!
[19:40:55] workmad3: bauerbob: haha, just spotted why the .update method is bad :D
[19:41:29] workmad3: bauerbob: it's having to create a new hash for the .update call, which is then merged straight into the hash
[19:42:24] DouweM: workmad3: Ha, I hadn't even noticed that
[19:42:37] jarr0dsz: hey guys any suggestion on how to make form action dynamic like: = simple_form_for @profile, :html => { :class => 'form-horizontal' } do |f| be able to change @profile to something else? lambda if statement a good solution?
[19:44:12] DouweM: what do you want to make dynamic?
[19:44:50] jarr0dsz: DouweM: Im trying to make the form action dynamic based on a variable value
[19:45:28] jarr0dsz: the :url => part to be more precise
[19:45:49] jarr0dsz: think i could use lambda statement inside the form definition but not very clean perhaps better way to do it?
[19:46:10] elaptics: jarr0dsz: dynamic based on what?
[19:46:16] DouweM: it will also adjust the action/method based on @profile
[19:47:01] jarr0dsz: something like this: http://pastie.org/private/dd7chaysydko6w7ngftg
[19:47:20] rhizome: jarr0dsz: use a partial and pass the object in, helper optional
[19:47:20] jarr0dsz: problem is then i have to put the whole form below the form_for basically i want that form_for to be dynamic
[19:48:00] rhizome: jarr0dsz: there is no :url part in the example you're using
[19:48:23] toretore: form_for(*(user.welcome ? [args1] : [args2]))
[19:48:37] jarr0dsz: rhizome: correct simplified it a bit i need to do multiple changes url and method post
[19:48:51] rhizome: whatever that means
[19:49:29] rhizome: feel free to use grammar
[19:50:10] jarr0dsz: rhizome: sorry :url and :method i try suggestion by toretore
[19:50:47] workmad3: rhizome: you're in an optmistic mood tonight... are you going to hope for something more reasonable next... maybe the discovery of FTL travel?
[19:52:16] olivier_bK: i have a question
[19:52:29] helpa: olivier_bK: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[19:52:29] workmad3: olivier_bK: !ask
[19:52:42] workmad3: I was looking for the 'don't ask to ask, just ask' macro
[19:52:47] toretore: that should be what we all expect it to be
[19:52:48] olivier_bK: in my methode edit i've write redirect_to user_calendar_url(@calendar)
[19:53:15] olivier_bK: but he dont make a redirection :(
[19:53:24] toretore: that sucks :(
[19:53:29] DouweM: olivier_bK: is he making an error?
[19:53:36] helpa: olivier_bK: 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.
[19:53:36] toretore: olivier_bK: !code
[19:53:38] olivier_bK: he do nothing
[19:53:52] olivier_bK: toretore, yes ang one minute please
[19:53:54] DouweM: what does he write in the logs?
[19:54:02] wheeee: Hey ya'll, I'm having what I think is a CSRF issue with rails + devise + an AJAX call and have a few questions
[19:54:54] DouweM: wheeee: go ahead
[19:56:11] olivier_bK: https://gist.github.com/anonymous/6846ef5a7754a071a4e2
[19:56:48] DouweM: olivier_bK: are you sure your user_calendar_url doesn't need a @user as well?
[19:59:12] jakzale: hi, I have a problem using the cookies with rspec, it keeps giving an error message that the `cookies` object does not exist.
[19:59:51] olivier_bK: DouweM, i try to but i get nothing
[19:59:57] olivier_bK: i see nothing sorry
[19:59:59] wheeee: DouweM: So I'm using a jquery plugin to hit an api controller within my application.
[20:00:34] wheeee: DouweM: I'm able to create a new record but at the time of the creation current_user is nil and then once I step out of the debugger I'm logged out
[20:00:48] DouweM: olivier_bK: user_calendar_url(@user, @calendar)
[20:00:57] wheeee: I think the problem is that the apicontroller is giving back a session cookie that is different than my current session cookie, but not sure.
[20:01:17] wheeee: I also get a CSRF warning after I step out of the debugger and the create action finishes.
[20:13:47] ctrinh: Whats the best practice to initialize ActionDispatch::RemoteIp middleware with a custom_proxies?
[20:13:49] olivier_bK: when i write this on my function edit in the controler calendar redirect_to edit_user_calendar_url(@user,@calendar)
[20:14:23] olivier_bK: i get Erreur 310 (net::ERR_TOO_MANY_REDIRECTS) : Trop de redirections
[20:23:31] denom: If I pass a lambda to a named scope, is it possible to introspect upon that scope to discover the scope chain (tell if it was accessed from an instance or the class)?
[20:24:03] bricker`work: denom: you might be able to access that information with `caller`
[20:25:07] bricker`work: denom: it would be better just to pass the information you need into the lambda though
[20:25:54] denom: that's true, it would be more straightforward
[20:32:36] krat0sprakhar: Hi, anyone here used the sucker_punch gem for async tasks?
[20:36:11] dingus_khan: oi, sou um desenvolvedor morando em San Francisco na California, e eu gostaria de saber qual e o nivel de atividade da communidade ruby on rails no Brasil
[20:36:28] jonathanwlee: Hey all, I'm trying to get JQuery-UI to work and have tried 3 or 4 different setup guides with no luck. Can anyone help me through this?
[20:36:51] Travis-42: I'm trying to use checkboxes to create the join records for a has_many :through relation (User has_many :user_problems, :through => :problems). This works pretty easily just by making the form return the array of problem_ids when updating User. *But*, I also want the user to set an additional value when they check something ("priority" should be low, medium, high). How could I pass those in too to get rails to create/update the join
[20:42:10] MrPunkin: Anyone know of a gem that will compile SASS inline into an ERB template for say HTML emails?
[20:44:11] jonathanwlee: anyone know how to setup JQuery UI?
[20:45:16] DouweM: jonathanwlee: there is no setting up, only using
[20:46:07] jonathanwlee: well how do I get something like: <script>
[20:46:07] jonathanwlee: $(function() {
[20:46:08] jonathanwlee: $('.datepicker').datepicker();
[20:46:57] jonathanwlee: If I put that in a view file I get nothing. If I put basic JS alert though it works fine.
[20:48:24] famemonster: how do i simplify current_user ? current_user.id : nil if when it returns false when no user is logged in ... ?
[20:48:32] DouweM: jonathanwlee: be sure to actually javascript_include_tag "jquery-ui"
[20:48:42] dingus_khan: (if that hasn't landed with anyone that speaks portuguese, English is actually my first language and I just wanted to know what the rails community is like in Brasil right now)
[20:48:46] DouweM: jonathanwlee: better yet: move that stuff to a dedicated JS file, with #= require jquery and jquery-ui
[20:49:05] jonathanwlee: I've done both of those and still can't get it to work
[20:49:50] DouweM: jonathanwlee: are the files properly being included in the HTML file? or are you getting JS or network errors
[20:50:22] jonathanwlee: This is what I have in my application.js file:
[20:50:24] jonathanwlee: /= require jquery
[20:50:25] jonathanwlee: /= require jquery_ujs
[20:50:26] jonathanwlee: /= require jquery.ui.all
[20:50:26] jonathanwlee: /= require_tree .
[20:50:35] jonathanwlee: I'm not getting any errors of any kind
[20:51:21] DouweM: jonathanwlee: in that case, have you considered that the jQuery code actually is being executed, and there's something unrelated that's wrong?
[20:51:50] jonathanwlee: Not sure what you mean
[20:52:19] jonathanwlee: do I need to place any JQuery UI assets anywhere or does rails already have those?
[20:52:47] DouweM: you say you can't get it to work, what exactly do you mean? if there are no errors in the web inspector, JS or network or otherwise, that part of the equation is fine.
[20:53:04] DouweM: if you include the jquery-rails gem, you're done as far as assets areconcerned
[20:53:13] wheeee: If the session cookie changes will devise log me out?
[20:53:20] wheeee: automatically?
[20:53:27] jonathanwlee: I'm trying to get a basic grid to show in my view file, that's my issue
[20:53:34] DouweM: wheeee: probably
[20:53:44] DouweM: jonathanwlee: post some code to a gist
[20:53:46] OneMT: can you truncate a render of a partial ?
[20:54:03] DouweM: OneMT why'd you want that?
[20:54:29] famemonster: how do i simplify current_user ? current_user.id : nil, ... current user returns false when no user is signed in
[20:54:31] jonathanwlee: what's a gist?
[20:54:38] DouweM: gist.github.com
[20:55:08] kara_sweets: is there an easy way to run something like User.last(14).emails
[20:55:21] kara_sweets: instead of u = User.last(14), and then iterating through and printing each email
[20:55:25] DouweM: kara_sweets use .pluck(:email)
[20:55:50] kara_sweets: can you run pluck on an array?
[20:55:54] kara_sweets: it appears not
[20:55:57] jonathanwlee: I'm just trying to get these 5 lines to work:
[20:55:59] jonathanwlee: $(function() {
[20:56:01] jonathanwlee: $('.datepicker').datepicker();
[20:56:19] DouweM: jonathanwlee: we need context, please post (excerpts of) all related files to a gist
[20:56:33] GarethAdams: yeah that's exactly what gist is supposed to stop you doing
[20:56:36] DouweM: kara_sweets: User.last(14) is an AR collection though, right? Are you getting an error?
[20:56:36] jonathanwlee: There is not context. An empty view file.
[20:56:53] kara_sweets: DouweM: yea , undefined method pluck for Array
[20:57:05] GarethAdams: jonathanwlee: where are you expecting the datepicker() jquery plugin to be loaded from?
[20:57:10] DouweM: kara_sweets: .map(&:email) then
[20:57:17] DouweM: jonathanwlee: you're talking about jQuery UI, so post the JS assets you're including
[20:57:26] GarethAdams: jonathanwlee: where are you rendering any element with the 'datepicker' class?
[20:57:30] DouweM: jonathanwlee: as well as the view or layout where you're including that JS asset
[20:57:40] GarethAdams: jonathanwlee: all of these questions and MORE! coming soon to a gist near you
[20:57:55] kara_sweets: DouweM: ahh sweet!
[20:58:13] kara_sweets: DouweM: Ive always had a hard time understanding map and the & syntax, would you mind explaining ?
[20:58:37] OneMT: DouweM, the index is of my products. I want to display the top two comments (voting system) on the index in a truncate. https://gist.github.com/OneMT/2cb0ff3ce18e27d295c1
[20:58:42] jonathanwlee: Yah I don't know how to answer any of these.
[20:58:47] DouweM: kara_sweets: I could, but I wouldn't do it justice compared to http://stackoverflow.com/questions/1961030/ruby-ruby-on-rails-ampersand-colon-shortcut
[20:58:53] wheeee: Thanks douwem
[20:58:54] GarethAdams: kara_sweets: all the & does is call .to_proc on its argument
[20:58:56] jonathanwlee: All I want to know how to do is to implement a UI element
[20:59:10] DouweM: jonathanwlee: upload your entire view and assets
[20:59:12] jonathanwlee: what process do I go through in rails to do that?
[20:59:19] DouweM: we need to know what's going on in order to *help you*
[20:59:34] GarethAdams: kara_sweets: and :method.to_proc is the same as Proc.new { |x| x.method }
[21:00:00] kara_sweets: DouweM: ahh sweet, thanks for linking
[21:00:14] DouweM: OneMT: Use a _comment partial, and use render @comments to automatically repeat rendering that partial for every object
[21:00:40] DouweM: GarethAdams: pretty much, with the addition of it being able to take arguments
[21:00:57] GarethAdams: jonathanwlee: sounds like you need to read the documentation for the plugin you've got
[21:03:19] OneMT: DouweM, I am using a comment partial, and my mistake the "index.html.erb" is the product partial.
[21:03:46] DouweM: OneMT: you're using a comments partial, plural. You need a comment partial, singular, to render a single comment
[21:04:11] jonathanwlee: okay. I have an html table and I want to use a JQuery Gridview instead. I'm not sure how to set that up though. Here is my code: https://gist.github.com/anonymous/5681217
[21:04:13] DouweM: Then you can just select the number of comments you want, and render that partial for any of them
[21:20:34] NemesisD: hey guys. trying to do a fields_for on a serialized attribute. the attribute is an array of hashes with a few defined attributes on them
[21:21:43] NemesisD: if the attr is "filters" i can do f.fields_for :filters, and that renders the form, but i want it to prefix the fields to "filters[]" or the server won't parse it an array
[21:22:27] NemesisD: how can i accomplish this with the least amount of fighting rails possible
[21:29:15] jonathanwlee: is there a native grid for JQuery or are they all plugins?
[21:40:37] NemesisD: its always a fight with rails forms
[21:42:31] geoffw8_: hi all, I just wondered - I used to use hidden fields to "store" stuff so that I could use it in Javascript, now I'm doing it in javascript objects
[21:42:33] geoffw8_: how do you all do it?
[21:42:46] geoffw8_: I'm using Rails, which is why I'm asking here
[21:44:15] sinclair: hi everyone
[21:44:23] geoffw8_: hi sinclair
[21:46:27] sinclair: i got a problem that's getting my head to spin a bit... how would i go about modelling a relationship between projects and users, if the owner of the projects could instead be a business and the user then related to the business inherits those projects
[21:46:35] NemesisD: geoffw8_: recently i did $('some_element').data('thing_i_need', <%= data.to_json %>); but i'm not proud of that necessarily :/
[21:47:16] NemesisD: been a professional rails developer for 3 years, find myself doing things like this just to get rails to do what I want so I can get some actual work done
[21:47:54] geoffw8_: NemesisD: ok, I've got ya. The thing is, at this point Rails doesn't have the data. Its stored in an unsubmitted unfinished form. Its just I need to pop a modal up to say "Hey you sure you want to make a table, that will cost you £x" - where X depends on what they've put in the form
[21:47:59] geoffw8_: NemesisD: lol don't we all
[21:48:28] geoffw8_: i think how I do it is "ok", I'll put put the data into a javascript object, build the link when they click create that generates the relevant modal
[21:48:37] yairgo: I want to have my script runner use a different log file from production, how do I do that?
[21:48:44] geoffw8_: part of me thinks it feels fragile, part of me thinks its the smart way to do it
[21:49:25] geoffw8_: sinclair: errr, so let me get this straight. A business always owns the projects? And you want a user to have access to those projects?
[21:49:35] geoffw8_: sinclair: or are you saying that sometimes a user owns them, sometimes a business owns them
[21:50:18] terrellt: geoffw8: Usually I ask a JSON API for it via an ajax request and store it in a variable.
[21:50:25] sinclair: geoffw8_: yeah, either the user in this case is a freelancer or tied to an actual business
[21:51:29] geoffw8_: terrellt: ok, that kind of sounds like what I'm doing. I'm going to wrap the data up in the client side, when they click Create instead of submitting the form I'm going to ping an action that will take the JSON, and return the modal, which if they click "Create" on will actually submit the form
[21:51:55] geoffw8_: thanks NemesisD and terrellt
[21:51:58] terrellt: geoffw8: That sounds lovely.
[21:52:22] geoffw8_: sinclair: so whats the problem? Sounds like something you could use a polymorphic association for
[21:53:13] sinclair: yeah no biggie, if i knew what the hell you where talking about =]
[21:53:40] geoffw8_: sinclair: give it a google. i only picked it up recently
[21:53:42] sinclair: thanks for the pointer though = )
[21:53:46] geoffw8_: sinclair: i don't think it will beimpossible though
[21:54:05] sinclair: yes found a railscasts episode =)
[21:55:27] terrellt: sinclair: Chances are you're going to have user has_many :projects and user has_many :projects, :through => :businesses
[21:55:36] terrellt: business_projects maybe? Meh.
[22:03:22] whowantstolivefo: hi, i have an example file bacon/spec/bacon_spec.rb and file has code so > describe Bacon do it "is edible" do Bacon.edible?.should be_true end end < and i get the following error when i run rspec spec in terminal https://gist.github.com/whowantstolivefo/5681607 whats strange in my code any idea ? i made follow the Rails 3 In ActionIA3
[22:05:29] pushpa: Hmm, I've been trying to set TEMPLATE_DIRS in settings.py, found 4 different ways but none works and none returns any error, it still uses the old ones ... At the moment I use: os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'), inside TEMPLATE_DIRS = ( and import os.path before that ... Any ideas? I am running osx and my template folder is mysite/templates/admin
[22:05:54] pushpa: sry, wrong channel
[22:07:36] sinclair: terrellt: yeah that was exactly my line before i dropped in here...
[22:12:07] bricker`work: whowantstolivefo: rspec expects your tests to be in the spec/ directory
[22:12:18] bricker`work: whowantstolivefo: if you're running "spec" like that
[22:12:28] bricker`work: whowantstolivefo: you should be running `rspec bacon/spec` it seems
[22:18:41] daniel_-: Is it ok to define methods like this: "def has_entries? !entries.empty? end" to get back a true? or is there a nicer way? thx
[22:20:02] bricker`work: daniel_-: sure, that's fine.
[22:20:54] whowantstolivefo: bricker`work: here is the screenshot http://ctrlv.in/195741
[22:21:05] whowantstolivefo: you can see code and structure
[22:21:06] centrx: That's excellent!
[22:21:15] daniel_-: bricker`work: thx for feedback
[22:22:29] bricker`work: whowantstolivefo: yeah because you're telling rspec to run the specs in the "spec" directory, which doesn't exist. You should run "rspec bacon/spec", or cd into "bacon" then run "rspec"
[22:22:33] whowantstolivefo: bricker`work: and here is the what says when i type rspec bacon/spec
[22:23:15] whowantstolivefo: thank you bricker`work i figure it out. i am newbie
[22:23:24] bricker`work: whowantstolivefo: by the way, are you really writing a library called bacon, or is this just for experimenting?
[22:24:00] whowantstolivefo: im at the 33rd page of Rails 3 In Action. just for experimenting
[22:24:16] bricker`work: whowantstolivefo: oh okay. I was going to tell you there's already a bacon lib
[22:24:44] whowantstolivefo: bricker`work: thanks anyway and i will keep disturbing channel as long as i read the book