« Back to channel list

#RubyOnRails - 19 August 2014

« Back 1 day Forward 1 day »
[00:00:15] lilia: same question for increment, decrement, update, and reset counters
[00:00:38] lethjakman: anyone ever had an app stuck in production mode even if you specify -e?
[00:00:45] lethjakman: clobbered assets as well
[00:00:57] bricker`work: lethjakman: with rails server?
[00:01:00] lethjakman: bricker`work: yeah
[00:01:46] bricker`work: lethjakman: try with RAILS_ENV=development, if that doesn't work then something is setting it inside the app probably
[00:02:33] lethjakman: bricker`work: shoulda mentioned I've tried it.
[00:02:37] lethjakman: it's a fresh spree app....
[00:02:50] lethjakman: so not sure, I'm thinking it might be something weird somewhere in my environment
[00:06:18] bricker`work: which serveR?
[00:07:53] jkmcrg: does anyone know why hashes in #order no longer work? Or what we can do instead to specify a specific table column when sorting a query with an #includes in it?
[00:08:05] lethjakman: bricker`work: webrick
[00:09:59] lethjakman: also hi, how are you?
[00:10:05] lethjakman: been a minute since I've seen you
[00:10:57] lethjakman: something was botched in the install process
[00:11:08] lethjakman: that makes sense now!
[00:11:21] lethjakman: it didn't copy over the assets. I figured it was served out fo the engine like normal.
[00:15:11] benlieb: Is there a way to override to_param, but only for :show actions?
[00:25:12] Radar: benlieb: why?
[00:25:55] lilia: benlieb: sounds dubious. are these the droids you're looking for? https://github.com/norman/friendly_id/
[00:26:52] benlieb: Radar I sometimes want the /1234-some-useful-text version of the url for the show action, but not for internal use (destroy, edit, etc) that can get weird
[00:27:01] Radar: benlieb: why?
[00:27:07] Radar: lilia: +1
[00:27:34] Radar: I've used friendly_id with great success on several projects
[00:28:21] benlieb: will check, thanks
[00:40:37] _808chris: hey guys/gals. I'm having issues with Resque. I'm using it in a Sinatra app but I cant figure out how to debug errors.
[00:41:19] _808chris: should i just spin up an instance of resque-server on another port or something?
[01:23:46] capin: hehe, yoyoyo
[01:24:25] sevenseacat: whenever anyone says that i have the urge to say 'hey yo' and flick a toothpick
[01:25:36] capin: yoyoyo is a breaking bad reference ;)
[01:26:42] sevenseacat: i figured it was a reference, so was mine :P
[01:34:50] Matadoer: can someone help for minute :/
[01:35:13] Matadoer: I'm trying to install the mongoid gem on my win7 machine, already installed devkit
[01:35:20] Matadoer: but it keeps yelling at me about makefile
[01:35:38] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[01:35:39] sevenseacat: !gist the full error you get
[01:37:49] Matadoer: https://gist.github.com/anonymous/4bf8380a249c45b45251
[01:38:53] Matadoer: I tried appending --platform=ruby
[01:41:12] sevenseacat: does the devkit provide make?
[01:42:10] sevenseacat: hmm ruby 2.0 is still a bit flaky on windows iirc, that is likely unrelated to this though
[01:42:40] Matadoer: the problem is bson specific
[01:42:50] Matadoer: I'm pretty sure
[01:42:57] sevenseacat: no, the problem is that it cant find make
[01:43:13] sevenseacat: you'd have the same problem with any gem with native extensions
[01:44:05] Matadoer: I must have installed devkit wrong then?
[01:44:13] sevenseacat: did you install the right devkit for the version of ruby/playform you're on?
[01:44:32] Matadoer: I'm pretty sure
[01:44:37] Matadoer: is there a way I can uninstall
[01:44:40] Matadoer: and reinstall
[01:45:44] roramirez: i have two tables tablea and tableb, without association. How is possible do SELECT * FROM tablea, tableb; ?
[01:46:15] roramirez: i am using activerecords
[01:46:50] Matadoer: you don't need sql... activerecord is an ORM
[01:47:10] Matadoer: you would use the object for that model and do object.all()
[01:47:25] Matadoer: without the brackets
[01:47:31] sevenseacat: Matadoer: https://groups.google.com/forum/#!searchin/rubyinstaller/make/rubyinstaller/TaoAxlo_TEk/8Rvc4sGHH4MJ suggests just reinstalling with a --force option
[01:48:03] roramirez: thanks i am check
[01:49:17] Matadoer: I'll give it a whirl
[01:51:27] Matadoer: it tricked me D:<
[01:51:37] sevenseacat: same error or different error? if different error, progress!
[01:51:55] Matadoer: still same error
[01:52:21] Matadoer: I lied again
[01:52:21] Matadoer: different error
[01:53:19] Matadoer: I think I installed wrong dev kit
[01:53:19] Matadoer: I think I installed 64bit by accident
[01:53:31] sevenseacat: on a 32 bit system, thats probably not good
[01:53:54] sevenseacat: (people are still using 32 bit stuff? >_<)
[01:56:30] kevinem: can someone please help me?
[01:56:52] sevenseacat: if you tell us your problem, we can try
[01:57:05] kevinem: rails generate model work
[01:57:24] kevinem: i'm waiting for the command's reply
[01:57:41] kevinem: for about half an hour i think :D
[01:58:22] sevenseacat: it didnt do something like this? https://gist.github.com/karpah/cd6bace174e24eed40b6
[01:58:35] kevinem: sevenseacat: someone from #ruby-lang told me it might be problem with some spring
[01:59:16] sevenseacat: wouldnt surprise me if it was something with spring - try stopping it? `spring stop`
[01:59:30] kevinem: https://gist.github.com/kevin-madhu/40c7daa6df4e33d1239f
[01:59:43] kevinem: i ctrl-c ed after long time and got this
[01:59:50] kevinem: lemme try spring stop
[02:00:28] kevinem: sevenseacat: yup now it worked
[02:00:37] sevenseacat: bloody spring
[02:01:02] kevinem: what's that actually? :-/
[02:01:21] sevenseacat: its an application preloader - keeps your app in memory to make spinup faster
[02:01:29] sevenseacat: in actuality its just a pain in the ass though
[02:01:45] kevinem: is there any problem if i keep 'spring' stopped?
[02:01:54] kevinem: all the way
[02:01:57] sevenseacat: nope, just remove it from your Gemfile
[02:02:35] kevinem: sevenseacat: thanks :)
[02:04:10] sevenseacat: youre welcome
[02:06:37] Matadoer: I had the edit the win32.h header file
[02:06:53] Matadoer: because some variables were undeclared
[02:07:10] Matadoer: https://github.com/mongoid/mongoid/issues/3489
[02:08:05] kevinem: sevenseacat: is there a gem file for every app?
[02:08:19] kevinem: or just one globally?
[02:08:31] sevenseacat: kevinem: you should have one per app, to specify the dependencies of that app
[02:08:44] sevenseacat: Matadoer: that seems like a hellish hack but if it works, then awesome
[02:08:46] kevinem: name of the file?
[02:08:59] sevenseacat: kevinem: Gemfile - should be in the root directory of the app
[02:09:49] Matadoer: apparently it's a problem with rubyinstaller
[02:09:56] Matadoer: god knows why they haven't fixed it yet
[02:09:56] sevenseacat: doesnt surprise me
[02:10:11] sevenseacat: because 2.0 is still flaky on windows, as the installation page says
[02:10:23] sevenseacat: you have to realize that windows is the least popular OS to run ruby on
[02:10:35] Matadoer: *installs linux*
[02:10:45] sevenseacat: (for one, linux doesnt get the short end of the stick! woo)
[02:11:18] sevenseacat: ACTION hugs linux laptop
[02:11:40] Matadoer: ACTION throws windows laptop off the balcony of his apartment
[02:11:51] kevinem: haha :D i love that
[02:12:11] sevenseacat: i have a linux laptop for everyday use, and a windows desktop machine just for gaming
[02:12:19] sevenseacat: is a good system.
[02:12:23] kevinem: Metadoer: don't throw it away...burn it :P
[02:12:32] kevinem: sevenseacat: i
[02:12:44] kevinem: i've never touched a windows system in years
[02:12:53] Matadoer: KILL IT WITH FIRE
[02:13:05] sevenseacat: i wouldnt either, if gaming support was all there for linux
[02:13:22] kevinem: yeah...that's the kill
[02:13:27] kevinem: i don't play games
[02:13:37] Matadoer: I think steambox will change that a bit
[02:13:50] kevinem: but whenever i argue with my friends, they gain with the topic of games
[02:14:01] kevinem: i've played CounterStrike on linux :)
[02:14:27] kevinem: yeah...Metadoer: i don't know why it's taking so long
[02:14:31] sevenseacat: i cant play elder scrolls online on linux - instant lose
[02:14:46] Matadoer: kevinem: It's because you can't sell software on linux
[02:15:18] sevenseacat: people are just a lot less likely to buy it :P
[02:15:20] Matadoer: but I think the software industry will change because of pirating... people won't sell games anymore they will just ask for donation for support
[02:16:09] Matadoer: which I think isn't a bad idea because if people can't afford your game and have to pirate it, it's not like your losing money xD
[02:19:42] kevinem: Metadoer: are you kidding?
[02:20:30] kevinem: people sell a lot of things on linux
[02:21:26] kevinem: and the amazing fact is that even opensource softwares, for which the source is available...there are people ready to buy even that
[02:21:57] kevinem: just because they don't have enough time to spent of customizing or learning a new platform to deploy the app
[02:22:17] sevenseacat: free as in speech, not free as in beer :P
[03:51:59] ziggles: What is the arel syntax for getting a list of all Users grouped by their created_at date?
[03:52:16] ziggles: Everything i see on google basically just uses a sql string
[03:54:57] bratsche: Why not just use the ActiveRecord syntax?
[03:55:37] sevenseacat: where's the fun in that
[03:55:50] bratsche: morning sevenseacat
[03:56:14] bratsche: How's it going?
[03:57:32] ziggles: bratsche: I'd be interested to see that too if it's different. I'm trying to learn how to build a query without actually writing out a query. (thought arel was the correct way to do this)
[03:59:29] ziggles: I'm able to do something like: User.all.group_by { |c| c.created_at.to_date } but i believe this is wrong because it loads everything from the DB then sorts it out in Ruby
[03:59:33] sevenseacat: meh, the usual
[03:59:43] sevenseacat: hating life but continuing anyway
[03:59:47] bratsche: ziggles: You want to group by created_at or order by created_at? Because grouping by is not going to be very useful unless you're grouping by the year or the month or something.
[04:00:19] ziggles: bratsche: Grouping by day in a month actually. I'm basically trying to create a blog where each day shows a bulleted list of the posts.
[04:00:23] bratsche: ziggles: User.group(:created_at) - but like I said, that's not going to really do anything useful with that column.
[04:00:48] bratsche: sevenseacat: :( what's wrong?
[04:00:52] ziggles: sevenseacat: that's dark man
[04:01:02] sevenseacat: ACTION shrugs
[04:01:05] sevenseacat: i'm working on it,.
[04:01:40] ziggles: bratsche: that code actually doesn't run: PG::GroupingError: ERROR: column "users.id" must appear in the GROUP BY clause or be used in an aggregate function
[04:02:33] bratsche: ziggles: You can do User.group(:created_at, :id) then.
[04:03:39] bratsche: ziggles: You're going to need to use some SQL if you want to group by month or something, I think mysql and postgresql do it slightly differently. I think in postgresql you'll need to gropu by date_trunc('month', created_at)
[04:04:34] ziggles: bratsche: ah i see. So if i write this postgresql specific query then im kind of tied to that db :/
[04:05:28] bratsche: ziggles: Yeah, but honestly that's not a problem. It's not like you're going to be swapping databases out during the life of an app. You might change databases between different apps, but you're unlikely to be switching a single app back and forth.
[04:05:59] ziggles: bratsche: Yeah, i see what you're saying
[04:06:06] bratsche: ziggles: And the only reason to be using mysql is if you're already stuck on it. If it's a new app you'd have to be crazy to choose mysql over postgresql.
[04:06:42] sevenseacat: its not completely uncommon to switch dbs during the development of an app
[04:06:49] ziggles: bratsche: i'm also deploying to heroku so pg's the path of least resistance :)
[04:06:50] sevenseacat: uncommon, but not totally out of the realm of possibility
[04:07:07] lilia: ziggles: you could do a where for each month instead...
[04:07:22] ziggles: lilia: isn't that a n+1 query?
[04:07:24] sevenseacat: ACTION has worked on one app that went mongodb -> mysql -> postgres over its dev lifecycle
[04:07:29] lilia: ziggles: only 12 months
[04:07:33] bratsche: Wow, that's crazy.
[04:07:44] bratsche: I've switched an app from mysql to postgresql, but that's it.
[04:07:58] lilia: constant number of queries
[04:08:04] sevenseacat: and for the most part that should be straightforward, if you didnt need to migrate data
[04:08:26] ziggles: lilia: i guess that's true. thanks for the suggestion
[04:08:57] bratsche: The last company I was at was using mysql, and we all desperately wanted to switch to postgresql but we just had 1/ too much data and 2/ too many mysql-specific queries. It would have been possible, but we were unwilling to risk it.
[04:09:26] sevenseacat: 'for the most part' == 'if youre not writing SQL and just using AR functionality'
[04:10:13] bratsche: That never happens to me though for some reason. :)
[04:10:54] sevenseacat: you are a special snowf.... i mean, yeah that happens to us all
[04:12:54] sevenseacat: even the most innocuous of custom sql can trip you up when switching dbs
[04:13:13] sevenseacat: especially given a lot of rails devs are not super-expert at SQL (myself included)
[04:15:26] bratsche: Yeah, me either.
[04:19:29] barhum2013: Hello, I am loooking at some syntax. in the model I have a method called process and inside of it a variable called gateway. I see this code inside other class methods process do |gateway| Can someone shed some light on the matter???never used methods like this before???thanks
[04:21:15] ziggles: bratsche: Does this look at all close to what you were suggesting? User.select("id, date_trunc('day', created_at) as date").group(:date, :id)
[04:22:39] ziggles: bratsche: i'm not sure why but it returns an AR_Relation that's just a list of objects with an id and date property... Not grouped by day though
[04:23:00] ziggles: i was kind of expecting something like a hash or similar where a date key has an array of objects under it
[04:23:06] bratsche: Well, you're grouping them by day. Like, monday, tuesday, etc.
[04:23:14] EasyCo: I'm pretty new to the concept of state machines and was wondering if it was common (or at least acceptable) practice to manage state changes within a conditional: https://gist.github.com/trev/0c24a3cb8d3b2565d6c7
[04:23:32] bratsche: No that's not going to happen. It will always be an AR::Relation list.
[04:24:18] lilia: ziggles: s/id/* if you want the whole object
[04:24:30] lilia: not just the id
[04:24:58] bratsche: ziggles: If you go into your psql console you can type in the SQL the same way you see it in the Rails console (just make sure to add a semicolon to the end) and it will return just a list of lines. The group is just changing the order of the rows being pulled out so that everything with the same day (or month or whatever you group by) is together.
[04:27:17] ziggles: bratsche: i see. I thought it would aggregate results under each day. i will check this out in psql to confirm my retardation
[04:27:31] ziggles: lilia: thanks! that definitely got the entire object back in the rails console
[04:34:56] axsuul: Anyone looking for part-time work? PM me please
[04:39:59] _lazarevsky: can I use the default rails logger in a PORO ?
[04:40:17] _lazarevsky: I know it can be used from within Rails specific objects like controllers, models, mailers, etc..
[04:40:27] _lazarevsky: but can I use it from a normal, custom defined class?
[04:43:13] bratsche: _lazarevsky: Just do Rails.logger.warn('foo') or whatever I think.
[04:45:52] rickjamesthethir: Hey could someone help me with a webhook for a mailer(sendgrid). My mx record for my domain is set to SendGrid and they parse the email and send me the data in a json. I am receiving post request to my app from sendgrid but my app controller that is supposed to receive the data and create a new email (model) and the view that is supposed to show Model.all of the email is not working.
[04:45:58] rickjamesthethir: here is the gist of the heroku logs
[04:46:14] rickjamesthethir: https://gist.github.com/plutocoin/955ea64500b3271b6f38
[04:47:06] rickjamesthethir: Sendgrid keeps trying to send me the email every 5 minutes as my app keeps failing
[04:47:46] rickjamesthethir: I am using the gem Griddler to help with receiving the email post
[04:49:12] bratsche: Did you setup griddler correctly?
[04:49:54] rickjamesthethir: I followed the readme for griddler although I didn't use their default filenames so in the initializer > griddler.rb I changed the configuration
[04:50:32] bratsche: Did you define config.email_service in your griddler config?
[04:50:44] bratsche: There you go.
[04:50:51] rickjamesthethir: :) let me try that
[04:50:59] bratsche: That should fix this error.
[04:53:48] hadifarnoud: my server is not loading ENV from .env
[04:54:08] hadifarnoud: I do have dotenv-deployment installed
[04:54:55] sonvu_ae: Hello guys, when you use devise gem would you prefer to create 2 login for 1, normal user in front end, 2 admin user in back end or just 1 login and if role is user redirect to front end?
[04:56:13] _lazarevsky: bratsche: that did not work :(
[04:56:22] bratsche: _lazarevsky: What's the error now?
[04:56:24] _lazarevsky: bratsche: I can't see any of the lines I'm logging
[04:56:30] _lazarevsky: bratsche: no error.. just there's nothing in the log
[04:56:39] sevenseacat: one login and redirect to frontend for all users, with an admin link for admin users
[04:56:40] _lazarevsky: there's only rails.log
[04:56:40] bratsche: Oh sorry, I was getting confused.
[04:57:01] _lazarevsky: which basically contains all the server get requests and DB calls
[04:57:10] bratsche: _lazarevsky: Sorry, you need to do Rails.logger.new
[04:57:24] bratsche: Or maybe it's just Logger.new
[04:58:18] sonvu_ae: Hmm, so 1 login maybe better
[04:58:32] rickjamesthethir: bratsche when I included config.email_service = :sendgrid I received the following error C:/Ruby200/lib/ruby/gems/2.0.0/gems/griddler-1.0.0/lib/griddler/configuration.rb:49:in `block in email_service=': Griddler::Errors::EmailServiceAdapterNotFound (Griddler::Errors::EmailServiceAdapterNotFound)
[04:59:37] _lazarevsky: bratsche: never mind, my bad
[04:59:41] _lazarevsky: bratsche: it does work..
[04:59:49] _lazarevsky: however, it dumps everything in the same stream
[05:00:05] _lazarevsky: bratsche: it does not matter whether I use warn, debug, info or error it would still append it to the rails.log
[05:00:15] _lazarevsky: still better than nothing I guess
[05:00:18] _lazarevsky: thanks a million aye!
[05:00:22] bratsche: Then you need to do Logger.new('some other file.log')
[05:12:35] rickjamesthethir: Ah figured out why I was getting that error
[05:12:50] rickjamesthethir: didn't install the additional gem needed for sendgrid (gem 'griddler-sendgrid')
[05:13:00] bratsche: Ah, there you go.
[05:13:10] rickjamesthethir: rookie mistake >.< lol
[05:13:26] rickjamesthethir: thanks for your help bratsche :)
[05:35:55] rickjamesthethir: on Rails 4 should i get any gem for sanitizing user input or is it automatically sanitized by rails?
[05:37:05] sevenseacat: define 'sanitizing user input'
[05:37:55] bratsche: omg I need a faster computer.
[05:45:14] pontiki: WE ALL NEED FASTER COMPUTERS!! MOAR RAM!!! MOAR DISC!!!
[05:45:20] sevenseacat: moarrrrrrrrrrr
[05:45:32] sevenseacat: actually i just need a better CPU in mine
[05:45:36] sevenseacat: the rest is okay
[05:45:46] sevenseacat: but it is an ultrabook sooooo
[05:45:57] pontiki: i used to think i was so cool when i had 2G
[05:46:40] sevenseacat: it was so much easier when you could just go by raw numbers for cpu power
[05:46:52] mozzarella: should have bought a macbook pro sevenseacat
[05:46:59] sevenseacat: mozzarella: hahahahaha that was funny
[05:47:29] sevenseacat: yes, i should have spent an extra $1200 to get a slightly faster CPU and a better screen o.O
[05:48:39] mozzarella: more like $300
[05:49:06] robscormack: that's half a dollar
[05:49:16] sevenseacat: mozzarella: yes, tell me more about australian macbook pricing
[05:49:34] mozzarella: oh right, you're Australian
[05:50:07] robscormack: hi sevenseacat, hi mozz
[05:50:08] sevenseacat: and tell me more about how much you think i spent on my own laptop and like you think i just pulled the numbers out of my ass
[05:50:16] sevenseacat: robscormack: afternoon
[05:50:20] mozzarella: I??remember the price of electronic is slightly inflated due to koalas scratching the boxes on deliverly, is that correct?
[05:50:26] sevenseacat: when i said $1200, i meant $1200
[05:51:04] robscormack: prices here in Chile are surreal. normal exchange is 1 USD = 600 CLP but when it's about Apple, 1 USD = 1000 CLP. It hurts!
[05:52:08] sevenseacat: there looks to be about a $600 price difference between the US/AU apple sites
[05:52:18] robscormack: is that the case there in au, seven? I'm concerned bc have to buy adapters and so...
[05:52:55] sevenseacat: from $200 for the lower airs up to $600 for a specced up rMBP
[05:53:20] mozzarella: sevenseacat: it's an ativ book 9 you have, right?
[05:53:24] sevenseacat: everything is more expensive here.
[05:53:27] sevenseacat: samsung series 9
[05:55:05] mozzarella: but why is that?
[05:55:25] sevenseacat: if i could answer that question, i'd be prime minister.
[05:58:03] robscormack: it's mostly because of the taxes applied in customs. can I be prime minister? :D
[05:58:29] sevenseacat: you couldnt do a worse job than the one we have
[05:59:08] robscormack: of course not, I love Australia
[06:22:48] joy4u: tagrudev: morning
[06:24:41] joy4u: demo project to show the Polymorphic Association using Devise - https://github.com/himadriganguly/devise-polymorphic-association
[06:28:02] tagrudev: that's nice
[06:30:54] maodun: I have an instance of a model (City.find_by_name 'New York') that I want to load on rails start up and keep around for easy access for the duration of my application, how can I do this?
[06:31:30] maodun: The city to be loaded will be determined by environmental variables on start up
[06:32:24] liquid-silence: any idea why this never logs to the console? http://pastie.org/private/miqwyps8p7zzc8h4chmsdw
[06:33:07] liquid-silence: well it should bind to all input boxes
[06:40:04] rickjamesthethir: if a :string cant accept a hash in postgresql what can?
[06:41:04] sevenseacat: rickjamesthethir: im not sure that made sense.
[06:42:05] rickjamesthethir: my column i created is accepts strings but I cant figure out how to get this 3rd party app to submit it as a string
[06:44:16] rickjamesthethir: works now but gives too much data
[06:49:02] riotjones: rickjamesthethir, to_s
[06:51:51] Ainieco: does anyone here using rinari? wondering how to make it use bundle exec instead of plain ruby invocation while running tests
[07:39:53] kevinem: can somebody please tell me what's going on
[07:40:04] muhammadn: Hello boys.
[07:40:11] kevinem: i did "sudo gem uninstall rails"
[07:41:11] kevinem: can u help me?
[07:41:39] sevenseacat: you havent yet stated a problem
[07:41:43] sevenseacat: so until then, no :)
[07:41:58] kevinem: haha okay :) you're always here :P
[07:42:05] kevinem: i did "sudo gem uninstall rails"
[07:42:13] _bart: Either run `bundle` inside a rails project or run `gem install rails`
[07:42:23] kevinem: and "sudo apt-get purge rails"
[07:42:26] kevinem: nothing there
[07:42:36] kevinem: but the rails command still works
[07:42:54] _bart: run `which rails`
[07:42:57] sevenseacat: what does `which rails` tell you
[07:43:11] kevinem: /usr/local/bin/rails
[07:43:30] sevenseacat: is that a symlink to something?
[07:43:54] muhammadn: i have two controllers, one is the new action and the other is the create action with new.json and create.json. When i access http://localhost:3000/controller/new.json it shows the fields and if i go to /create.json it throws about no template for create action.
[07:43:55] muhammadn: do i need to POST to the create.json to create the new fields in controller/new.json and how do i go about it?
[07:44:06] kevinem: -rwxr-xr-x 1 root root 464 Aug 19 05:10 /usr/local/bin/rails
[07:44:20] sevenseacat: kevinem: whats in that file
[07:44:31] sevenseacat: and how did you install rails?
[07:44:43] _bart: kill it with fire and rails is gone?
[07:44:48] muhammadn: i am sorry, i got it wrong. there is no create.json. it is only http://localhost:3000/controller
[07:45:40] kevinem: sevenseacat: i don't know what all i did, i did not know what i'm doing back then...but apt-get purge and gem remove should take care of everything right?
[07:45:55] sevenseacat: depends on how you installed it
[07:46:03] kevinem: i did not install it manually
[07:46:08] sevenseacat: you installed it today, so
[07:46:30] kevinem: how will i clean my whole system of rails?
[07:46:35] sevenseacat: depends on how you installed it
[07:46:37] waseem_: muhammadn: If you're following the convention, create.json will be rendered once you POST something to the created action and action is successful.
[07:47:06] kevinem: sevenseacat: i never installed it manually, i'm sure...either using apt, or gem or both
[07:47:06] waseem_: kevinem: Are you on Ubuntu?
[07:47:10] sevenseacat: whats in that /usr/local/bin/rails file
[07:47:26] waseem_: kevinem: Last I heard it did not come with Rails preinstalled.
[07:47:53] kevinem: it's a script
[07:47:56] waseem_: kevinem: What does `file /us/local/bin/rails` give?
[07:48:08] sevenseacat: i didnt even know rails was in the ubuntu repos... and its only 3.2.13, cripes
[07:48:19] sevenseacat: kevinem: i know its a script
[07:48:44] kevinem: https://gist.github.com/kevin-madhu/ec89ecae21f9b4e5c83c
[07:48:48] waseem_: sevenseacat: People just don't maintain what they put in official repos.
[07:49:07] sevenseacat: kevinem: did you install the ruby-rails-40 package?
[07:49:19] sevenseacat: so uninstall it
[07:49:24] kevinem: rails -v was 4
[07:49:36] sevenseacat: apt-get remove
[07:49:44] kevinem: i already did "gem remove" and "apt-get remove"
[07:49:50] kevinem: "apt-get purge"
[07:49:59] sevenseacat: yes, and before you said rails, not ruby-rails-4.0
[07:50:03] sevenseacat: different packages
[07:50:15] _bart: just don't use the apt-get packages
[07:50:22] kevinem: i installed ruby-full
[07:50:29] sevenseacat: ruby is not rails
[07:50:41] kevinem: sevenseacat: yeah, i know...
[07:50:43] sevenseacat: dont confuse the two
[07:50:49] waseem_: But Ruby is on Rails.
[07:50:51] sevenseacat: so *which package did you install*?
[07:50:54] kevinem: rails is a framework
[07:50:57] sevenseacat: whatever you installed, uninstall it
[07:51:07] kevinem: i installed... ruby-full
[07:51:12] kevinem: that comes with rails?
[07:51:32] sevenseacat: that installs ruby
[07:51:41] kevinem: that's all i did
[07:51:49] kevinem: + gem install rails
[07:52:19] sevenseacat: you didnt install it via gem
[07:52:30] sevenseacat: or maybe you did... fuck if i know with system rubies
[07:52:38] sevenseacat: however you installed it, that is how you uninstall it
[07:53:03] kevinem: this is kinda weird
[07:53:03] _bart: or just rm the files that got left behind
[07:53:19] kevinem: python and pip are calling out to me :D
[07:53:46] waseem_: kevinem: Forget all this and use chruby and ruby-install to install ruby on your system.
[07:53:51] sevenseacat: i bet they'd screw you over too if you just run random commands and then dont remember what they are
[07:54:01] _bart: same kind of stuff, different names
[07:55:12] kevinem: i do know i installed it with gem or apt or both
[07:55:20] kevinem: and i removed using all those
[07:55:29] kevinem: can i clean them up manually?
[07:55:37] sevenseacat: great, so every single thing you installed, now uninstall it
[07:55:51] sevenseacat: the software centre will give you a list of packages you installed
[07:56:11] sevenseacat: there are multiple different packages with rails in them and you seem to have no idea which you installed
[07:57:33] kevinem: https://gist.github.com/kevin-madhu/95124ca2d32191779eee
[07:57:35] waseem_: kevinem: Do you have history of commands available so that you could figure out how you installed a particular thing?
[07:58:48] kevinem: sevenseacat: gem uninstall presented me with a list, and asked if one of them or all should be removed...and i said all
[07:58:53] kevinem: https://gist.github.com/kevin-madhu/95124ca2d32191779eee
[07:59:03] sevenseacat: why the fuck does ubuntu have the `rails` package with rails 3.2.13, and the `rails3` package with rails 3.2.16
[07:59:14] sevenseacat: this is why we dont use system packages for ruby stuff
[07:59:49] kevinem: no idea :)
[07:59:58] frank_o: this is why we dont use ubuntu :/
[08:00:17] sevenseacat: open software centre, find which packages you installed,and uninstall them
[08:04:05] kevinem: sevenseacat: as expected, no packages in the name like rails installed...checked software centre
[08:04:32] kevinem: sevenseacat: can i ask you a doubt?
[08:05:04] kevinem: you know virtualenv for python right?
[08:05:39] kevinem: creates a virtual environment for every project we want
[08:05:55] sevenseacat: define 'virtual environment'
[08:06:15] kevinem: and whatever we install in this virualenv is only available to the particular project
[08:06:24] kevinem: does not mess up the whole system
[08:06:28] kevinem: get the idea?
[08:06:35] waseem_: kevinem: You're talking about virtual box, yes?
[08:06:35] _bart: kevinem: like RVM gemsets
[08:06:45] kevinem: waseem_: nope
[08:07:16] waseem_: _bart: It's more like an environmen where _everything_ related to a project is contained in a container.
[08:07:18] sevenseacat: sounds like a waste of space, but okay
[08:07:54] waseem_: _bart: Even database and other system libraries. Waste of space, yes.
[08:08:09] _bart: waseem_: ah ok, that's more like a vagrant/virtualbox setup
[08:08:14] waseem_: kevinem: Then what are you talking about?
[08:08:15] kevinem: just the additionals
[08:08:16] waseem_: _bart: Yes.
[08:08:22] sevenseacat: was there even a question
[08:08:29] _bart: haha is he still trolling?
[08:08:46] kevinem: waseem_: suppose i do gem install rails
[08:09:04] kevinem: this rails will be available to my specific project
[08:09:15] sevenseacat: it will be available to your entire system
[08:09:15] kevinem: may be version matters
[08:09:18] waseem_: kevinem: You're talking about RVM and gemsets.
[08:09:34] kevinem: waseem_: okay lemme check RVM
[08:09:41] waseem_: kevinem: Don't use that.
[08:09:55] sevenseacat: ............ so what was the question
[08:10:07] waseem_: kevinem: Since the advent of bundler you don't need to use rvm.
[08:10:32] waseem_: kevinem: Like I said earlier, use ruby-install to install your Ruby and chruby to change your ruby versions.
[08:10:55] sevenseacat: ACTION gives up
[08:10:59] waseem_: kevinem: https://github.com/postmodern/chruby and https://github.com/postmodern/ruby-install
[08:12:06] hadifarnoud: how can I run a rake task with capistrano 3? it's a one-off task. I do not need to run it everytime I deploy
[08:12:16] waseem_: kevinem: Install those follow the instructions in the Readme and work with me.
[08:15:21] kevinem: lemme try :)
[08:17:43] kevinem: sevenseacat: i removed 'ruby-full' and then rails disappeared...installed it back and rails reappeared...i think ruby-full comes with wails
[08:18:02] sevenseacat: if thats true, im horrified
[08:18:20] sevenseacat: like seriously, wtf
[08:18:46] _bart: maybe hence the -full? :p
[08:18:59] waseem_: That does not even make any sense.
[08:19:13] waseem_: Why the fuck -full mean it comes with rails.
[08:19:29] kevinem: sevenseacat: why should you be horrified?
[08:19:44] sevenseacat: because rails has nothing to do with a ruby setup
[08:19:58] kevinem: is fuck a rails specialist favourite word?
[08:20:11] kevinem: never seen people using it on other channels :D
[08:20:18] _bart: see, now he's just trolling :p
[08:20:26] sevenseacat: yeah i'm starting to suspect that
[08:20:45] waseem_: sevenseacat: It reminds me of mitty.
[08:20:45] sevenseacat: 'people dont swear on the internet!'
[08:21:13] waseem_: sevenseacat: IKR?
[08:21:49] kevinem: i just said everything i did...
[08:22:21] kevinem: lemme check the package details of ruby-full
[08:22:23] waseem_: kevinem: Did you install chruby and ruby-install?
[08:22:55] sevenseacat: ruby-full doesnt depend on anything rails-related, i checked
[08:24:36] kevinem: waseem_: nope...still puzzled over this mystery
[08:24:49] kevinem: thought i'll move on after finding out what is happening
[08:24:57] kevinem: sevenseacat: yeah, wait a sec
[08:25:05] anti-freeze: Hey guys, so I've recently finished writing an application for a client in Rails. Unfortunately, i'm limited to a server that only has ftp & sftp. Does anyone know a way to deploy with only these tools?
[08:25:20] sevenseacat: solution: dont use apt packages for anything ruby and rails related. moving right along.
[08:25:32] anti-freeze: Google hasn't been much help
[08:25:33] sevenseacat: anti-freeze: get a new server.
[08:25:47] anti-freeze: sevenseacat: I'd love to, but that's not an option
[08:25:53] kevinem: sevenseacat: what about installing ruby?
[08:25:57] kevinem: from source?
[08:26:04] sevenseacat: then you probably should have thought of that before writing a rails app
[08:26:21] sevenseacat: kevinem: use one of the ruby management tools you have been referenced already
[08:26:30] anti-freeze: sevenseacat: It's too late for that now. Maybe next time I'll write it in Django :)
[08:26:32] sevenseacat: rvm, rbenv, ruby-build, or ruby-install
[08:26:57] sevenseacat: django doesnt require any console commands?
[08:27:21] kevinem: i'm not into django...i don't like it
[08:27:23] sevenseacat: ACTION checks to see if its a full moon
[08:27:39] anti-freeze: sevenseacat: I was joking. Well, i dont feel like rewriting the entire app in PHP
[08:28:01] sevenseacat: even modern php frameworks will require a console.
[08:28:06] sevenseacat: get a new server.
[08:28:13] sevenseacat: it'll cost you five dollars.
[08:28:14] anti-freeze: sevenseacat: Well, im screwed. I'll look in to it
[08:29:07] helpa: I see dumb people
[08:29:07] waseem_: !sixthsense
[08:29:16] anti-freeze: sevenseacat: What server provider do you suggest?
[08:29:30] sevenseacat: any - digital ocean, linode, etc.
[08:30:50] anti-freeze: sevenseacat: Thanks for the help
[08:33:04] xsannyx: I use redis to cache my autocomplete terms. If I store in the users first name and last name, how can I write this statement: $redis.zrevrange "search-suggestions:#{prefix}", 0, 5 so that it wouldn't care for word order (eg. it wouldn't matter if I write "first_name last_name" or "last_name first_name").
[08:33:43] _bart: anti-freeze: ditigal ocean is quite cheap, get a cheap VPS
[08:34:12] _bart: linode and digital ocean have both been hacked at one point, so not sure which one is actually better haha
[08:35:48] anti-freeze: sevenseacat: Do you think the 5$ plan on Digital Ocean is enough power for a small web app?
[08:36:00] helpa: Your question has just been deemed vague; please consider rewording it. It may also help to give us any relevant code or errors so that we may better assist you.
[08:38:41] wasamasa: anti-freeze: well, describe what it's supposed to do
[08:38:54] _bart: anti-freeze: we'll need to know more about the app to tell, but my experience is that the small package works ok for small apps, but the 10$/month or 20$/month are indeed more capable
[08:39:21] _bart: 512 MB RAM is really minimal
[08:39:34] wasamasa: especially with ruby and rails
[08:39:46] _bart: So I recommend anything with 1GB or more
[08:40:00] wasamasa: at least nginx doesn't use much ram
[08:40:30] anti-freeze: Its 2 pages, one with the company description and another with various sample menus. There's a small admin panel for adding events and sample menus
[08:41:10] wasamasa: so it's just serving some database content occasionally?
[08:41:30] wasamasa: then that plan should be fine
[08:41:44] anti-freeze: Alright, I'll go with that. Thanks a lot guys
[08:41:44] _bart: anti-freeze: that'd probably work with any minimal setup, but still, 10$/month isn't that much
[08:42:16] _bart: anti-freeze: by the way, you can always upgrade later if it turns out you're hitting the RAM cap
[08:42:26] anti-freeze: _bart: I'm getting payed 100 a year for hosting. A colleague of mine made the deal, its complicated. The $10 a month would put me at a loss
[08:43:00] _bart: anti-freeze: ah ok
[08:43:18] wasamasa: anti-freeze: as long as it doesn't get slashdotted of course
[08:43:29] anti-freeze: wasamasa: Slashdotted?
[08:44:07] _bart: anti-freeze: when the website gets suddenly popular by some news story or something
[08:44:32] _bart: anti-freeze: ah minimal machine will not be able to handle the sudden traffic
[08:44:36] anti-freeze: _bart: I doubt that heavily xD
[08:44:46] _bart: anti-freeze: but like I said, you're always able to upgrade in case you'll need more power
[08:44:54] wasamasa: anti-freeze: slashdot, hackernews, any major news outlet might put it down
[08:44:58] _bart: I think both linode and digital ocean allow that easiliy
[08:45:14] wasamasa: anti-freeze: depending on your hoster, they might block it or demand money for that kind of traffic
[08:45:24] anti-freeze: I doubt it will get slashdotted. I mean, its a small website for a small restaurant in the middle of nowhere
[08:45:41] _bart: any nice hoster will just let you know and work something out
[08:45:57] _bart: szuletett: hello
[08:51:54] szuletett: uh, I can't get flash[:notice] to show me anything, any ideas?
[08:52:38] defswork: szuletett, on same request ? flash.now needed maybe ?
[08:53:19] szuletett: I think its on the next request. I assigned it in the controller and I want to show it in the view
[08:53:26] defswork: szuletett, flash shows on the next request by default
[08:53:32] defswork: you need flash.now then
[08:53:51] szuletett: ok ill try that
[08:56:27] szuletett: now I don't get anything
[08:59:03] szuletett: http://pastebin.com/B12KtPxU
[09:02:08] szuletett: ok pastie http://pastie.org/9485151
[09:02:35] defswork: szuletett, so your save/redirect should work
[09:03:03] defswork: your render :new won't - you need to do flash.now http://guides.rubyonrails.org/action_controller_overview.html#the-flash
[09:04:15] defswork: also - line 18 - shoudl be <%= flash[:notice] %>
[09:04:37] defswork: note the missing =
[09:04:56] szuletett: OH THAT WAS IT
[09:05:37] defswork: szuletett, you will still need to use flash.now to render on current request
[09:05:39] szuletett: thank you! And yeah the error one needs .now
[09:05:53] szuletett: yep, i got it
[09:07:29] defswork: seems a default situation that will never be used - I can't think of a single reason why you would want to flash something on the next request but still render something on this one
[09:08:03] defswork: flash ought to be visible for the next render - be it redirected or not
[09:30:44] Macaveli: I've got a problem somewhere with my migrations or something, when I look in the schema.rb it contains the column "visible" for model "pages" but when I go look in the console the model "pages" doesn't contain "visible".
[09:31:06] Macaveli: I've tried doing db:drop / db:migrate / db:seed
[09:31:27] Macaveli: and they all run fine but still that column doesn't appear in console
[09:31:52] rvanlieshout: somebody could have dropped that migration
[09:31:53] defswork: is it actually in the database ?
[09:31:57] rvanlieshout: or altered it after they ran it
[09:32:09] Macaveli: rvanlieshout I'm the only one on this project
[09:32:14] Macaveli: locally everything works fine
[09:32:19] rvanlieshout: then that somebody is you :)
[09:32:38] Macaveli: I havn't dropped any migrations and why is it working fine when i create my db again locally?
[09:32:57] defswork: rails reads the columns from the db - schema.db is just for db setup
[09:33:54] Macaveli: i tried making a new DB but I think rails still connects to the old db
[09:34:04] Macaveli: i'll upload my database.yml file hold on
[09:34:25] Macaveli: https://gist.github.com/YOUConsulting/4b65e4aaab217e332675
[09:36:39] denym_: where can I find the documentation for the associations method that I can use on a class name?
[09:36:53] denym_: checked api.ror but somehow I cant find it there
[09:37:49] defswork: Macaveli, look at the database rails is connecting to - is that column on the table ?
[09:38:11] defswork: run rake db:schema:dump
[09:38:26] defswork: is the column in schema.rb after running that ?
[09:39:57] Macaveli: defswork yes it is
[09:41:21] defswork: then rails will add that attribute to the model
[09:52:43] denym_: I have an array of symbols, how can I remove one specific symbol? array.pop doesnt work with symbols
[09:53:25] mr_foobar_baz: Stupid question, but how can I rewrite /one/path/script.php?params to /different_path/test?params using nginx?
[09:53:40] Macaveli: defswork then why can't I find it via rails console?
[09:53:40] mr_foobar_baz: The second path points to a rails controller action that is a substitute for the php script. Params are the same.
[09:53:45] mikecmpbll: denym_: array.delete(item)
[09:53:58] mikecmpbll: doesn't matter if it's an array of symbols or an array of donkeys
[09:54:43] defswork: Macaveli, what type of column is it ?
[09:54:54] defswork: does visible? work ?
[09:55:03] Macaveli: what do you mean by work?
[09:55:11] denym_: mikecmpbll: tried that to but it doenst remove the item at all oO
[09:55:23] helpa: 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.
[09:55:46] denym_: mikecmpbll:ahh nvm .... typo
[09:55:52] denym_: mikecmpbll:thanks for that
[09:59:27] defswork: hmm - should I have a table of countries by ISO3166 code or just store the ISO code in the dependent tables
[10:02:57] Macaveli: defswork the boolean works yes
[10:19:48] shredding: i see it???s auto_now_add
[10:20:46] liquid-silence: the world of javascript
[10:29:37] tagrudev: good news it's not Monday...bad news it's not Friday
[10:30:33] walidvb: i'm writing a unit test that checks that no <p> in my html does NOT have a certain attribute.
[10:30:51] walidvb: using rspec-html-matchers, with the following line: expect(chapter.body).not_to have_tag('p', :without => {"data-id" => /^\d{1,3}?/})
[10:31:38] walidvb: it this fails because it finds <p>s but it's somehow skipping the :without statement.
[10:33:17] walidvb: it looks like my regexp syntax is wrong, too..
[10:33:36] tagrudev: I don't see without option
[10:33:39] tagrudev: http://rubydoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:have_tag
[10:33:43] mikecmpbll: parsing html with regex :d
[10:33:56] walidvb: tagrudev: https://github.com/kucaahbe/rspec-html-matchers
[10:34:23] tagrudev: so that doc is old
[10:34:34] walidvb: tagrudev: it's another gem
[10:34:40] walidvb: that adds options
[10:34:53] walidvb: my spec is simply that i want all <p> to have a certain tag on save
[10:35:14] walidvb: https://gist.github.com/walidvb/f7d13095af495d0a0676
[10:36:53] tagrudev: and what's wrong with that ?
[10:37:06] walidvb: well it doesn't behave as expected
[10:37:19] sergey_makagon: expect('<p data-id="123" id="qwerty">Paragraph</p>').to have_tag('p', :without => { "data-id" => /\d{1,3}/ })
[10:37:39] sergey_makagon: try this one. found example in docs and updated it to your case.
[10:37:52] walidvb: i want it to fail if it finds a tag without the data-id attr
[10:37:59] walidvb: sergey_makagon: will give it a go
[10:38:25] sergey_makagon: walidvb, so the goal is to fail if there is a p without data-id ?
[10:38:32] walidvb: and actually, the regexp is wrong, as its value will prob be read as a string.
[10:38:35] walidvb: sergey_makagon: yes
[10:38:56] walidvb: also, to ensure no p has the same data-id, but that's another story
[10:39:26] walidvb: sergey_makagon: https://gist.github.com/anonymous/d1544d601cb2063931e3
[10:40:12] sergey_makagon: walidvd, yeah, need to update to check that data-id is present
[10:41:10] walidvb: sergey_makagon: update what?
[10:41:24] walidvb: that was the idea of the regexp, to just match anything
[10:41:24] sergey_makagon: something like this: expect(chapter.body).to have_tag('p', :with => { "data-id" => /\d/ })
[10:41:27] hadifarnoud: how can I run a rake task with capistrano 3? it's a one-off task. I do not need to run it everytime I deploy.
[10:41:52] hadifarnoud: is there something like 'heroku run' for capistrano?
[10:42:58] walidvb: sergey_makagon: hm.. then I should add the count to make sure i get all the ps.
[10:45:25] walidvb: sergey_makagon: still not finding the ps
[10:47:13] sergey_makagon: try to find all p's without any data-id. just to make sure it finds at least all p's in chapter
[10:47:46] walidvb: that's what im saying, it doesn't find the p's without data-id
[10:51:43] greengriminal: Simple question providing i have the following: https://gist.github.com/anonymous/d91214b3e28334337026 how would i access a property from the data property.
[10:51:59] greengriminal: in fact it's okay
[10:53:12] walidvb: sergey_makagon: expect(chapter.body).not_to have_tag('p:not([data-id])')
[10:53:20] walidvb: went the CSS way ;P
[10:53:49] sergey_makagon: walidvb does it work? ))
[10:54:05] walidvb: looks like it
[10:57:54] emka: Looking at different auth gems for rails 4.
[10:58:14] emka: What would you recommend. Devise, Sorcery or Authlogic?
[11:05:16] seuros: emka: It depend on your usage. Devise is authored by members of railscore.
[11:17:51] emka: Probably a good point seuros. But its also full of features I dont need.
[11:18:27] emka: But its the only one I???ve used before so Im quite familiar with it
[11:19:04] seuros: That why i said that it depend on your usage. But you are not oblige to use all modules.
[11:19:24] emka: no I know.
[11:19:37] emka: devise is good and easy to customize and understand
[11:22:19] luckyruby: 4.1.5 released btw (topic)
[11:41:45] walidvb: any nokogiri guy here?
[11:42:10] walidvb: i got working code, but i feel i'm not using the right classes.
[11:43:46] walidvb: I use Nokogiri::HTML::DocumentFragment.parse to get and edit the _exisiting_ nodes of an html string, and i'd now like to append a node to that nodes_list
[11:44:02] walidvb: but DocumentFragment doesn't seem to have an append method
[11:44:15] walidvb: (which I need to use in my test)
[11:56:26] exadeci: I'm starting with Pundit and I can't find a way to force authorize on all controller like I could do with cancan (instead of having to put authorize in all actions) does it have something to do with scope ?
[11:56:43] rvanlieshout: exadeci: add a before_filter
[12:00:04] exadeci: rvanlieshout: to my application_controller with something that I code to check ?
[12:01:12] xsannyx: I am using select2 to create tagging for my application. It works fine, but I wanted to add saved tags into suggestions. So I followed this guide: http://hoff2.com/2013/11/09/acts_as_taggable_on_active_admin_select2.html The problem occurs at the last step when you have the javascript code. If I use it the Select2 functionality brakes
[12:01:33] xsannyx: Does anyone have experience with select2 and acts_as_taggable_on? I can't seem to find the solution for the jst fix
[12:02:40] rvanlieshout: exadeci: similar to load_and_authorize_resource
[12:02:45] rvanlieshout: it's not really a complex method
[12:03:20] walidvb: i somehow have my before_save filter run multiple times, but I really can't tell why/how. how can I debug this?
[12:04:11] hadifarnoud: how can I fix this? You have already activated rake 10.1.0, but your Gemfile requires rake 10.3.2. Prepending `bundle exec` to your command may solve this.
[12:04:22] rvanlieshout: walidvb: you could begin \n raise "foo \n rescue => exception \n Rails.logger.info exception.backtrace \n end
[12:04:33] rvanlieshout: hadifarnoud: 'Prepending `bundle exec` to your command may solve this.'
[12:04:55] hadifarnoud: rvanlieshout: I know. how can I fix this for ever?
[12:05:17] rvanlieshout: easy.. determine why it's been called twice and fix it
[12:05:24] hadifarnoud: bundler is old version on my server?
[12:05:39] rvanlieshout: hadifarnoud: you'll always have to use bundle exec
[12:05:42] rvanlieshout: if you have conflicting gems
[12:05:48] rvanlieshout: and your binary isn't 'bundle aware'
[12:06:30] hadifarnoud: rvanlieshout: I wonder why is that though. since I have just one app on my server, updating bundler may solve it. correct?
[12:06:45] rvanlieshout: hadifarnoud: removing the conflicting rake version solves it
[12:07:22] walidvb: rvanlieshout: thx
[12:26:09] emka: Anyone used Sorcery?
[12:26:29] helpa: emka: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[12:26:48] emka: Sorry :)
[12:27:08] mikecmpbll: ACTION bows to helpa
[12:27:11] rvanlieshout: cause i would have to anser with no
[12:27:15] rvanlieshout: but that does't mean i can't help you
[12:41:29] exadeci: rvanlieshout: again with Pundit, when you define in your policy that for example only user admin can use index it won't check if you don't add authorize to the index in the controller ?
[12:43:24] rvanlieshout: exadeci: protect_from_forgery ?
[12:43:39] vlad_starkov: Question: I'm using Rails 4.1.4 and Versionist gem for version my API. Does anyone know why the route defined in ./config/routes.rb inside "api_version" clause can be invisible to Rails? `bundle exec rake routes` says "You don't have any routes defined!"
[12:44:19] pontiki: show the routes file?
[12:44:25] pontiki: that sounds rather odd
[12:44:37] hadifarnoud: anyone used dotenv-deployment
[12:44:50] helpa: hadifarnoud: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[12:44:50] waseem_: hadifarnoud: !used
[12:44:54] pontiki: what is that, hadifarnoud ?
[12:45:13] hadifarnoud: my ENV variables do not load from .env
[12:45:36] hadifarnoud: I do have set :linked_files, %w{config/database.yml .env} in deploy.rb (capistrano 3)
[12:45:51] vlad_starkov: pontiki: https://gist.github.com/starkovv/d8deb74f613335c6c0a3
[12:46:43] exadeci: rvanlieshout: I guess I have something not working correctly then, thanks
[12:46:55] rvanlieshout: on the phone, but ok
[12:48:13] pontiki: vlad_starkov: nothing stands out...
[12:49:43] vlad_starkov: pontiki: this happen after I updated my ruby in RVM and reinstall all gems from Gemfile (I deleted Gemfile.lock and run `bundle`)
[12:49:48] hadifarnoud: this is my capistrano deploy.rb https://gist.github.com/210ba1f1ff7695e5f3a0.
[12:50:27] hadifarnoud: problem is, secret_key_base is not loading from .env file
[12:50:59] pontiki: vlad_starkov: it was working before?
[12:51:40] pontiki: do you have a .bundle directory in your app?
[12:53:42] pontiki: vlad_starkov?
[12:54:35] hadifarnoud: my .env file content should be something like SECRET_KEY_BASE=mysecret
[12:55:56] _bart: Hi all, I'm using cocoon with has_many :through, https://github.com/nathanvda/cocoon/wiki/A-guide-to-doing-nested-model-forms#the-has_many-through-relation
[12:56:22] _bart: But now I need to click two links before being able to add a new 'Tag' instance, how do I just make it one (because another view already shows existing tags)
[12:58:27] pontiki: vlad_starkov: ok, i'm not so much an expert on bundler, just use it; when i want to "start fresh" so to speak, i also blow away the .bundle directory with the Gemfile.lock. in your case, i might suggest just renaming it, and/or back up the application tree someplace
[12:58:35] pontiki: probably *and*
[12:59:48] vlad_starkov: pontiki: I'll try it
[13:00:17] sonOfRa: are multiple before_action callbacks guaranteed to be executed in a certain order?
[13:00:38] vlad_starkov: pontiki: nope...
[13:00:51] pontiki: i'm out of quick ideas, vlad_starkov
[13:01:34] pontiki: i'd suggest something stupid like adding a plain resources line in routes to see if *anything* shows up
[13:01:55] pontiki: but that seems like flailing
[13:02:31] vlad_starkov: pontiki: Oh, thanks for your efforts, anyway! Plain resources work fine
[13:02:41] vlad_starkov: pontiki: looks like an issue in versionist gem
[13:04:03] alaing: any ideas why ruby would be pointing to rbenv but bundler isn't
[13:04:58] workmad3: alaing: try reinstalling bundler with your rbenv ruby activated
[13:05:13] pontiki: ok, vlad_starkov
[13:05:22] workmad3: alaing: sometimes the bundle executable can go a bit screwy and end up with a hardcoded path to the wrong ruby binary
[13:05:55] waseem_: workmad3: How do you know all this? You must be Gandalf.
[13:06:09] vlad_starkov: workmad3: you mean reinstall bundler in system wide perspective?
[13:06:10] pontiki: he is pretty grey
[13:06:18] workmad3: waseem_: gandalf knows nothing compared to me! :P
[13:06:29] waseem_: pontiki: He is slightly ligter and with an accent.
[13:06:41] workmad3: I'm also more pasty white...
[13:06:51] workmad3: vlad_starkov: I mean 'gem install bundler' again
[13:07:06] waseem_: workmad3: Did you drink your tea today?
[13:07:08] alaing: hohow do i reinstall bundler with rbenv
[13:07:14] pontiki: must post-eagles' mount Gandalf then
[13:07:19] workmad3: waseem_: I don't drink tea
[13:07:40] waseem_: workmad3: Not enough English in you. :)
[13:07:53] vlad_starkov: workmad3: the same result
[13:07:58] waseem_: workmad3: Do you have a black friend whose name is Nigel?
[13:08:02] alaing: rails seems to be pointing to /usr/local/bin as well
[13:08:15] workmad3: waseem_: heh :) yeah... I don't like tea, beer, soccer, cricket or rugby...
[13:08:23] workmad3: waseem_: and no... but my dad is called Nigel
[13:08:24] vlad_starkov: workmad3: Is it fine if I'll switch to ruby-2.1.0 ?
[13:08:53] workmad3: ACTION reads the logs to find out who actually has what problem
[13:09:12] waseem_: workmad3: I highly doubt that you're an English now.
[13:09:43] workmad3: waseem_: I love talking about the weather and feel at home with drizzle rather than sun
[13:10:46] waseem_: workmad3: What is there to talk about the weather. It's cold all the time.
[13:11:36] workmad3: vlad_starkov: ok... so yeah, your problem has nothing to do with what I was saying to alaing...
[13:12:05] muhammadn: I think it's safe now to switch to rails 4.0 from 3.2 with most of the gems almost completed migrating their code to support it.
[13:12:37] workmad3: waseem_: english people love talking about the weather :P
[13:12:59] waseem_: workmad3: What kind of weather do you like?
[13:13:05] workmad3: waseem_: I also respond to the question 'How are things?' with 'Not too bad'
[13:13:06] muhammadn: heard a couple of bad things about turbolinks and really awesome stuff about rails 4.1 with the development "caching" i think.
[13:13:25] muhammadn: waseem is not an english name, it's arabic?
[13:13:40] workmad3: waseem_: no... not about what weather we like... what the weather *is* like... and yes, it's normally along the lines of 'it's a bit wet today isn't it?' while flood water is lapping around our ankles...
[13:14:27] blackmesa: Hi all. Id like to validate form input to be only words, numbers and words with umlaut (?? ?? ??). So far Ive used this /\A[a-zA-Z\s]+\z/ anyone can help?
[13:14:44] waseem_: workmad3: What do you call it when you're knee deep in snow?
[13:14:58] workmad3: waseem_: jacket weather
[13:15:12] waseem_: workmad3: That's when you should do pajama parties.
[13:15:27] workmad3: waseem_: *pyjama
[13:15:28] waseem_: muhammadn: Yes it is. I'm an Indian though.
[13:16:10] waseem_: workmad3: That'd be in Urdu I guess.
[13:16:34] workmad3: muhammadn: re: rails 4... I'd say it's fine (has been for a while IMO), turbolinks can be a bit annoying if you hit a case where it breaks stuff but in general it tends to just work, and you can turn it off really easily
[13:16:37] waseem_: I miss omarquereshi.
[13:16:45] workmad3: where is he nowadays?
[13:16:46] muhammadn: waseem_: doesn't matter. my mum side came from packir in india but i am malay. :P
[13:16:49] workmad3: did he ragequit?
[13:17:31] waseem_: workmad3: I'm not sure. He seems quite busy with Buddyapp.
[13:17:40] waseem_: muhammadn: Where is packir?
[13:17:40] workmad3: ah, could be just work then
[13:17:48] workmad3: I know I vanish at times when things get too busy
[13:18:18] muhammadn: waseem_: southern india.
[13:18:30] waseem_: muhammadn: Which state I mean.
[13:18:43] workmad3: heh, 'southern india'... nice to localise to a place larger than a lot of countries
[13:19:11] muhammadn: waseem_: not really sure but sometimes people call it "packer"
[13:19:36] waseem_: muhammadn: This is the first time I've heard of such place. But then I don't know much about southern India.
[13:20:56] muhammadn: waseem_: in any case, the best muruku (raisins, cashews and salty - 3 in 1) is still from india. i cannot find anything that tastes like it in Singapore or Malaysia. :(
[13:22:13] Macaveli: Anyone have experience with creating a custom dashboard in rails admin?
[13:25:46] fakingfantastic: Where do you put tests for your delayed jobs?
[13:27:30] waseem_: fakingfantastic: Under tests/workers?
[13:28:28] fakingfantastic: waseem_: ok, so you make a custom folder. How do I add a custom folder so it runs when I do rake tests
[13:31:14] waseem_: fakingfantastic: You override the Rake::TestTask.
[13:31:40] waseem_: fakingfantastic: Something like this http://stackoverflow.com/a/23295137/100466
[13:32:43] waseem_: fakingfantastic: Check out original question as well and accepted answer it should get you started.
[13:33:07] waseem_: fakingfantastic: Otherwise you can simply put it under your model test directory and it will run it.
[13:34:15] Juanchito: i'm trying to create a csv file with iso-8859-1 from my bdd with utf-8 but i'm getting this error "U+2022 from UTF-8 to ISO-8859-1" trying to encode the bullet symbol from utf-8. How can i replace that symbol with an '?' symbol or whatever ?
[13:34:33] pyemkey: Hello, I need your help. I am planning to build kind of message system. One user can send to one ore more users a message. I prepared gist about my initial thoughts. https://gist.github.com/pyemkey/8b85cc2a3ada91e200ef
[13:35:23] alaing: how do i reinstall bundler with rbenv
[13:36:00] alaing: bundler and rails seems to be pointing to /usr/local/bin as well
[13:36:07] waseem_: alaing: You don't. You do gem uninstall bundler.
[13:37:30] alaing: ok, now I run gem install bundler rails, right
[13:37:54] waseem_: alaing: How did you install it?
[13:38:04] alaing: like that before
[13:38:14] waseem_: alaing: Yes, so that should work.
[13:38:23] alaing: i had installed rbenv and then ran that
[13:38:34] alaing: but bundler and rails dont seem to point to rbenv
[13:39:04] waseem_: alaing: You did not install it after selecting proper Ruby with rbenv it seems.
[13:39:43] fakingfantastic: waseem_: yeah, i have it under model right now, but feels a little dirty. Without the fear of sounding dumb in mind, what file is all the "namespace" code being put in?
[13:40:05] waseem_: fakingfantastic: You can put it in your Rakefile.
[13:40:06] alaing: ok I did rbenv install 2.1.2, then rbenv global 2.1.2 and then rbenv rehash. ruby -v reports
[13:40:16] alaing: ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-freebsd9.2]
[13:40:35] alaing: then i did gem install bundle rails
[13:40:41] fakingfantastic: waseem_: Figured, just checking x2. Thanks!
[13:40:52] waseem_: fakingfantastic: No problem.
[13:44:41] sonvu_ae: hello #rubyonrails
[13:46:23] alaing: isnt that the right order to install it?
[13:47:00] sonvu_ae: i'm creating an online shopping for learning purpose and while creating "Product" model i want to implement "Image" model which Product "has_many" Image, and I also implement paperclip with Image, the point is I want to make Product edit/new form can upload multiple Image, i try "field_for" for "image" but not it mot work, anybody know why?
[13:48:17] helpa: sonvu_ae: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[13:48:17] rvanlieshout: sonvu_ae: !gist what you've done and the errors that give
[13:48:32] rvanlieshout: sonvu_ae: also, check out the documentation on fields_for.. you might missed the accepts_nested_attributes_for part
[13:48:38] sonvu_ae: https://gist.github.com/SonVu/91b204c032f4fde53108
[13:48:44] rvanlieshout: sonvu_ae: last: make sure your form has the right enctype for subimtting files
[13:49:28] sonvu_ae: here is part of my code, i try put ":multipart => true" and i done "accepts_nested_attrributes" but still not work
[13:49:43] mikecmpbll: hmm, if i have a bunch of unpersisted model objects with associations to another unpersisted object, is there a way i can replace that object with something else so that everything else is then associated with the new object?
[13:49:51] mikecmpbll: not sure how much sense that made.
[13:49:54] rvanlieshout: sonvu_ae: that gist is incomplete. show us the complete form, and log that comes with the create request
[13:50:31] rvanlieshout: mikecmpbll: b.related = a.related; b.save?
[13:50:43] mikecmpbll: without knowing what's associated to it
[13:51:40] mikecmpbll: a = Foo.new; b = Bar.new; a.bars << b;
[13:51:51] sonvu_ae: https://gist.github.com/SonVu/dd17813f64da5345e7db here is the code
[13:51:53] mikecmpbll: i want to replace b, and also the association with a without touching a
[13:52:41] rvanlieshout: sonvu_ae: your product_params doesn't allow the product image attributes
[13:52:42] mikecmpbll: it may be ludicrous, my brain filtering is lagging behind what i'm typing somewhat.
[13:52:56] rvanlieshout: anyway.. heading home now
[13:53:14] sonvu_ae: oh, the tutorial dont show that part
[13:53:56] sonvu_ae: i has thought some thing maybe not right in the controller but dont know how to fix, can you show me please?
[13:55:10] sonvu_ae: but even the controller not allow parameter it must show upload field while browsing right?
[13:58:34] jSantana: Can someone tell me how do I put an id inside a label <%= f.label :remember_me, ("I accept #{link_to 'Terms & Conditions', '#'} of website.").html_safe %>
[14:01:41] pontiki: what do you want the HTML to actually look like?
[14:01:54] sonOfRa: https://gist.github.com/sonOfRa/72baa814d4ff45b654af <- why is @current_user nil in privileged_user? signed_in_user defines @current_user, so it should not be nil?
[14:02:25] sonOfRa: line 67, @current_user is nil
[14:04:01] jSantana: you talking to me pontiki ?
[14:04:07] pontiki: yes, jSantana
[14:04:37] jSantana: I just need it to have a specific id for my javascript
[14:04:40] pontiki: sonOfRa: where is signed_in_user define? i don't see it in your gist
[14:04:53] pontiki: yes, so, show me how you want it to look
[14:05:05] sonOfRa: pontiki: ApplicationHelper
[14:05:09] sonOfRa: one sec, let me paste that, too
[14:05:37] bjensen82: User has many projects. A project has a boolean: active. A user has 5 projects and some of them are inactive. I want to get a user and its active projects: user = User.includes(:projects).where("users.name = ? AND projects.active = ?", "john", true); However if I now to puts "#{user.projects.count}" # => 5. How do I get only the projects with the active = true boolean?
[14:06:17] hfp: Hey all, I am confused at this `@nearest` variable. It says it is an array but it seems to have keys? What is this `@data` "thing"? And why is it accessed with `@nearest[0].data` ? https://gist.github.com/anonymous/dcd719bad5225d7d610a
[14:06:30] sonOfRa: pontiki: f5
[14:06:45] jSantana: https://gist.github.com/anonymous/efea4f656f2888e62d57
[14:06:52] sonvu_ae: can anyone solve my problem?
[14:07:06] adac: wondering if open (open-uri) is not able to follow a redirect? Can thsi be set somehwere?
[14:08:41] pontiki: sonOfRa: the only way it looks like @current_user could get out of there as nil would be is you didn't find a session
[14:09:07] jSantana: pontiki, I think I found out how, you just put a id: 'your-id-here'
[14:09:38] pontiki: jSantana: yes, it just wasn't clear which element you wantd the id on
[14:10:51] sonOfRa: pontiki: but if I didn't find a session, shouldn't there be a redirect to signin_path (l 62 application_helper.rb)
[14:12:00] makerop: am i going to run into a problem if I name an engine service?
[14:12:05] pontiki: yes, i would expect so
[14:12:32] pontiki: but remember that redirect is not a terminal statement
[14:12:34] makerop: i dont see it inthe reserved words
[14:12:46] mikecmpbll: makerop: doubt it.
[14:12:52] sonOfRa: pontiki: oh.
[14:12:56] sonOfRa: that might be it
[14:13:05] greengriminal: Is there an explanation why maybe my hidden_field pdf_ticket_id is not being passed into the params hash?
[14:14:05] sonOfRa: I thought a redirect would redirect, and don't do anything else
[14:14:28] mikecmpbll: greengriminal: not without any code there isn't.
[14:14:43] workmad3: sonOfRa: code still executes after the 'redirect_to' call
[14:15:05] workmad3: sonOfRa: it's just a normal method call at the end of the day... so it behaves like one
[14:16:17] sonOfRa: thanks guys
[14:16:22] greengriminal: mikecmpbll: Snap i thought i pasted the gist :P
[14:16:57] greengriminal: mikecmpbll: https://gist.github.com/anonymous/f9f1824a9939b6a5a0db
[14:17:43] mikecmpbll: greengriminal: what's form_remote_tag?
[14:18:19] stef1a: can someone point me to a tutorial that explains how to create a form that allows for creating multiple models at once that belong to a single parent model?
[14:18:23] mikecmpbll: oh, that's a new one on me.
[14:18:37] mikecmpbll: greengriminal; what rails version you on?
[14:18:57] greengriminal: the app i'm working on has some old forms.
[14:18:59] mikecmpbll: as far as I can see form_remote_tag was deprecated in 2.3.8
[14:19:02] greengriminal: http://apidock.com/rails/ActionView/Helpers/PrototypeHelper/form_remote_tag
[14:19:29] greengriminal: Should be a <%= form_for @pdf ... %>
[14:19:33] pontiki: your code is inside your textarea
[14:19:42] Cork: in rake test i need to have a remote server connect back with data
[14:19:53] mikecmpbll: pontiki has the real reason anyway
[14:20:01] Cork: is there a way to have rake test listen on a port or start the full server or something like that?
[14:20:03] mikecmpbll: you're wrapping of the textarea element is fucked.
[14:20:21] greengriminal: pontiki: https://gist.github.com/anonymous/f9f1824a9939b6a5a0db#file-example-html-erb-L10 so your saying because it's inside the block thats the issue.
[14:20:28] sonvu_ae: Could anyone solve my problem: https://gist.github.com/SonVu/dd17813f64da5345e7db. Nested form doesnt show
[14:20:38] greengriminal: notice that the hidden_field is outside the textarea.
[14:20:47] pontiki: flip lines 6 & 7
[14:20:59] mikecmpbll: your closing tag is in the loop and your opening one isn't ...
[14:21:18] pontiki: maybe take a look at the HTML that it is generating
[14:21:35] pontiki: that's usually what i do when it isn't giving me something i expect
[14:21:37] greengriminal: pontiki: That too is also a good ponit +1
[14:22:08] coreycondardo: does anyone have a preferred WYSIWYG?
[14:22:44] pontiki: yes, coreycondardo: None.
[14:22:46] mikecmpbll: clientside markdown
[14:23:17] coreycondardo: mikecmpbll: this is for a non-tech savvy client, i doubt they???ll be able to handle markdown
[14:23:38] pontiki: but seriously, what is the application? are you asking about a client-side JS WYSIWYG editor?
[14:26:28] greengriminal: Would anyone object against doing this: https://gist.github.com/anonymous/eb7dd50b266b3e2855fd#file-example_version2-hmtl-erb-L10
[14:27:25] greengriminal: I mean i wanted to get the id, and so you may have notice i was doing https://gist.github.com/anonymous/f9f1824a9939b6a5a0db#file-example-html-erb-L10 which seemed to not work. So i just shoved the id in an array.
[14:28:02] mikecmpbll: 'pdf_ticket_ids[]'
[14:28:14] mikecmpbll: params[:pdf_ticket_ids] => [1,2,3,4] ..
[14:28:32] mikecmpbll: name your inputs properly and it'll work fine :)
[14:29:11] mikecmpbll: line 10 in your second link btw.
[14:32:19] Jon30: guys, for some reason, when I serialize a field in the model, it becomes unpermitted in the params. any ideas why and how to fix it?
[14:32:35] Jon30: serialize :division, Array
[14:33:50] mikecmpbll: Jon30: and your strong params look like what?
[14:34:26] Jon30: mikecmpbll: params.require(:biography).permit(......... , :division)
[14:34:39] mikecmpbll: and division parameter is an array?
[14:34:41] Jon30: i replaced the other fields with ........ to make it look simpler
[14:34:51] Jon30: mikecmpbll yes
[14:35:11] Jon30: mikecmpbll: in the console, it says unpermitted parameters: division when I am submitting the form
[14:35:16] mikecmpbll: Jon30: https://github.com/rails/strong_parameters#permitted-scalar-values
[14:35:30] Jon30: but if I remove serialize from the field, it saves fine as a string
[14:36:15] Jon30: so then ......, {division: []}
[14:36:18] Jon30: like that right? thanks!!
[14:37:46] stef1a: i'm trying to allow a user to create an evaluation and simultaneously multiple evaluation_answer records. but when i try to do so, none of the answers are created, and i'm told that evaluation_answer is an unpermitted parameter even though i'm including it in my permitted params: https://gist.github.com/smlance/6d89ff671314deef7600#file-evaluations_controller-rb-L59 help?
[14:44:40] Jon30: hmm strange... when i submit the form, it passes the department like this: "department"=>["", "Investment Committee", "Investment Teams", "Client Services"] but in the console, the SQL query looks like that: ["department", "--- []\n"]
[14:45:16] Jon30: https://gist.github.com/anonymous/87b0941601cd4f1f44b3
[14:47:25] centrx: Must be being serialized incorrectly
[14:47:50] coreycondardo: pontiki: im learning rails and making a standard website using it. i just need a editor for someone to change page content etc
[14:50:41] Jon30: centrx: any ideas how to make it serialize correctly?
[14:51:15] stef1a: i'm having trouble passing an array of hashes from my view to my controller: https://gist.github.com/smlance/6d89ff671314deef7600#file-development-log-L5 i want to have multiple evaluation_answers nested within the params hash. help?
[14:51:28] centrx: Jon30, need to see code
[14:51:47] Jon30: centrx: it's just a default update function from scaffold
[14:52:12] pontiki: coreycondardo: try tinymce-rails gem
[14:52:20] Jon30: centrx: = f.select :department, options_for_select(biography.department_list, biography.department), {}, { multiple: true, size: 4 }
[14:52:33] Jon30: biography.department_list and biography.department are arrays
[14:52:52] Jon30: when i select the options, the form passes it as such: "department"=>["", "Investment Committee", "Investment Teams", "Client Services"]
[14:53:05] workmad3: stef1a: .permit(:evaluation_answers) only allows simple types (strings, numbers, etc.) not arrays
[14:53:07] centrx: Jon30, The format parameters being sent to the controller look correct, except for the blank "" in the first one
[14:53:09] Jon30: inside the model I have: serialize :department, Array
[14:53:18] coreycondardo: pontiki: oh this is perfect, it???s what im using in other CMS (so im familiar with it). Thanks!
[14:53:24] workmad3: stef1a: if you want to permit an array, you need to do '.permit(:evaluation_answer => [])'
[14:53:40] Jon30: centrx: i am clearing those out using before_validation do |model| model.department.reject!(&:blank?) if model.department end
[14:53:53] workmad3: stef1a: and if you want to permit an array of hashes, you need to do '.permit(:evaluation_answer => [:response, ...])'
[14:54:04] workmad3: (the ... is any other keys in the hash)
[14:56:12] Jon30: bleh so weird]
[14:57:18] stef1a: workmad3: okay, but when i try that, i get "unknown attribute: evaluation_answer"
[14:57:55] Jon30: centrx: works fine if I do: update(department: ['1','2']) from rails console
[14:58:21] Jon30: update(department: ['', '1','2']) works too
[14:58:38] Jon30: it only saves ['1','2'] as expected
[14:59:03] workmad3: stef1a: what did you try?
[14:59:17] stef1a: workmad3: permit(:evaluation_answer => [:response])
[15:01:28] mikecmpbll: stef1a: evaluation_answers_attributes ....
[15:02:14] stef1a: mikecmpbll: ? just stick :evaluation_answers_attributes in my permitted params?
[15:02:30] mikecmpbll: are you using accepts_nested_attributes_for?
[15:02:46] Jon30: centrx: i messed up. it's not .permit({ department: [] }) instead it's .permit(department: [] )
[15:02:57] stef1a: mikecmpbll: yes
[15:03:10] helpa: stef1a: I believe you will find the answer to that question in the documentation, good Sir or Madam.
[15:03:10] mikecmpbll: stef1a: !rtfm
[15:03:38] mikecmpbll: stef1a: !g accepts_nested_attributes_for
[15:04:04] stef1a: mikecmpbll: hey! it works! thanks, manual!
[15:04:23] mikecmpbll: surprising, right
[15:04:50] stef1a: mikecmpbll: oh, it still doesn't work, actually. now i have no error, but my logs still say unpermitted attribute: evaluation_answer
[15:04:55] carlesso: Hi all! Tricky question. Suppose I have a model with two attributes, cost_1 and cost_2, both intenger. I would like to have, somehow, Active record to always return an instance which have cost_1, cost_2 and total_cost (as the sum of the two). But I would like to do this on my db, so something like having always my model to do Model.select('models.*, (models.cost_1 + models.cost_2) as total cost')
[15:05:06] mikecmpbll: stef1a: and why do you reckon that is?
[15:05:11] carlesso: like having a meta attribute
[15:05:34] carlesso: I can achievethis with a view in database, but I'm looking for something different
[15:05:49] stef1a: mikecmpbll: i'm not permitting it? when i try to permit it, though, i get the same error
[15:05:53] stef1a: er, same message
[15:06:01] mikecmpbll: no you're not.
[15:06:04] mikecmpbll: but why would you permit it?
[15:06:09] mikecmpbll: that's not the attribute you want.
[15:06:13] KaaK: I'm auditing repositories from an infrastructure mgmt view point -- should 'public/assets/*' be kept under revision control?
[15:06:33] magnetica: hello hello... need some help with nested simple_form please?
[15:06:45] stef1a: mikecmpbll: so are you saying i don't even need to worry about it not being a permitted param?
[15:06:48] workmad3: carlesso: default_scope {select("models.*, (models.cost_1 + models.cost_2) as total_cost")}
[15:07:18] mikecmpbll: stef1a: your model wants whatever_attributes. you've permitted whatever_attributes
[15:07:19] carlesso: workmad3: looks a very good solution
[15:07:24] mikecmpbll: but your submitting whatever from your form
[15:07:27] magnetica: The nested simple_fields doesn't show in the form, https://gist.github.com/anonymous/8469eb4251d1ffc54b60
[15:07:30] mikecmpbll: not whatever_attributes, now think how to solve that one.
[15:08:14] workmad3: carlesso: alternative 2 would be to create total_cost as an actual field on your db and pre-calculate the value there (either as part of assigning values to cost_1 and cost_2) or as a database trigger
[15:08:29] stef1a: mikecmpbll: i don't understand your explanation / the way you're posing the question
[15:08:57] mikecmpbll: stef1a: i think i explained it quite plainly, so if you don't understand I suggest you consult the documentation.
[15:08:57] carlesso: workmad3: yep, but I'm trying to aviod that too
[15:09:25] workmad3: carlesso: heh :) that's the solution I'd prefer in all honesty
[15:09:52] workmad3: carlesso: keeps the basic SQL queries simpler so less likely to have issues in the long-run
[15:09:57] carlesso: workmad3: really? less math more data then :)
[15:10:24] workmad3: carlesso: also makes it easier to do things like query for records with a total_cost > some value
[15:11:00] carlesso: workmad3: I think you have persuaded me
[15:11:41] workmad3: carlesso: my next persuasion was going to be pointing out all the wasted CPU-cycles recomputing total_count all the time in a read-heavy table ;)
[15:12:15] Macaveli: We have created a custom google analytics with the embed api. Now where do I need to place all these things to get it to work with rails? https://www.evernote.com/shard/s389/sh/6543c06e-c883-4c8f-b31e-bed5330f28f9/5afd3d57f0c23dd3e0241a43d0cbb289
[15:13:24] carlesso: workmad3: I was thinking at that too, ok, you got me on your side
[15:13:26] magnetica: Anyone know about nested forms here, need a little help with a hack, please
[15:13:39] magnetica: The nested simple_fields doesn't show in the form, https://gist.github.com/anonymous/8469eb4251d1ffc54b60
[15:14:23] mikecmpbll: magnetica: are there any @service.photos?
[15:14:32] carlesso: workmad3: in your opinion, before_save can be a good place to do this?
[15:15:05] magnetica: mikecmpbll: No, i want to create service and photos in the same form
[15:15:17] mikecmpbll: then build a photo before rendering the form
[15:15:37] mikecmpbll: @service.photos.build ...
[15:16:24] workmad3: carlesso: I'd personally prefer to do it like this: https://gist.github.com/workmad3/9475c6f2cc940fac458c
[15:16:44] workmad3: carlesso: I'm not a fan of the activerecord lifecycle hooks
[15:19:19] carlesso: workmad3: hum, I guess that if I ask you why you're not a fan of activerecord lifecycle we can stay here and chat for generations...
[15:19:26] stef1a: mikecmpbll: i'm lost. are you suggesting that the evaluation_answers i'm passing in the params hash are not really attributes of evaluation, but separate models?
[15:19:41] stef1a: they are, but would that have anything to do with my problem?
[15:20:30] workmad3: carlesso: probably... if you're really interested, there's many a result on google about various things that have screwed up with AR lifecycle hooks
[15:20:32] magnetica: mikecmpbll: i built a photo in controller, @service.build but the photos don't get created... do you think is there something wrong with the file field tag <%= file_field_tag "images[]", type: :file, multiple: true %>
[15:20:44] workmad3: carlesso: they mostly revolve around making it much more painful to test and refactor code
[15:22:36] mikecmpbll: stef1a: no, i'm saying that the params are named incorrectly.
[15:23:08] stef1a: mikecmpbll: the only options are evaluation_answer and evaluation_answers_attributes
[15:23:24] mikecmpbll: form submits params to controller, controller checks whether it's allowed to be passed to the model or not, then passes to model
[15:23:29] carlesso: workmad3: I see, thanks for the hint anyway
[15:23:53] mikecmpbll: stef1a: what do you mean the only options?
[15:24:06] stef1a: mikecmpbll: the only possible params i could permit that are relevant to the problem
[15:24:18] mikecmpbll: no, i've told you what the params should be called
[15:24:24] mikecmpbll: the problem is the params AREN'T called that.
[15:24:55] stef1a: mikecmpbll: i made the params called that and i told you that i still got an unpermitted params error
[15:25:02] stef1a: not error, but log message
[15:25:08] mikecmpbll: what did you do to make the params called that?
[15:25:49] stef1a: mikecmpbll: permit(evaluation_answers_attributes: [:response])
[15:25:59] mikecmpbll: stef1a: that's not changing the paramters that the controller is receiving, that's just changing what params the controller PERMITS
[15:26:24] stef1a: but the controller is still forbidding evaluation_answer
[15:26:26] mikecmpbll: you're still receiving parameter called evaluation_answers
[15:26:32] mikecmpbll: ACTION facepalm
[15:26:45] mikecmpbll: it SHOULD be forbidding evaluation_answer
[15:26:51] workmad3: stef1a: ok... here's a suggestion... whenever you make a change and say 'it's still not working', update your gist to show *exactly* what code you're now running
[15:27:03] stef1a: workmad3: okay
[15:27:29] EminenceHC: I want to run the update method for all records of a certain model without actually changing any of the information. Is that possible with some variation of Model.update_all ?
[15:27:45] mikecmpbll: not quite sure what's getting lost in translation :p
[15:27:58] workmad3: EminenceHC: huh?
[15:27:59] stef1a: mikecmpbll: why?
[15:28:16] mikecmpbll: stef1a: because i don't know what you still don't understand :)
[15:28:32] stef1a: mikecmpbll: no, why should it forbid e_a?
[15:28:44] workmad3: ACTION is wondering where the updated gist is
[15:28:48] mikecmpbll: why do you want it to permit that?
[15:29:16] mikecmpbll: workmad3: i've not even seen any gist :p
[15:29:24] EminenceHC: workmad3: I want to update all records without actually changing information. So each record runs through the update method.
[15:29:34] stef1a: workmad3: mikecmpbll i posted it earlier: https://gist.github.com/smlance/6d89ff671314deef7600
[15:29:39] workmad3: EminenceHC: ok... but the update method without any info changes does nothing
[15:29:49] workmad3: EminenceHC: so I repeat... 'huh?'
[15:29:54] pontiki: maybe use .touch?
[15:29:57] EminenceHC: workmad3: So the only way to do it would be to change a param, and then change it back?
[15:30:24] pontiki: EminenceHC: i think the question really is *why* you wish to do this? what is the desired outcome?
[15:30:29] EminenceHC: workmad3: I have changed my update method and I want it to run its calculations for every record.
[15:30:50] workmad3: EminenceHC: does the calculation change data?
[15:30:54] mikecmpbll: stef1a: and the model
[15:30:56] stef1a: mikecmpbll: i must admit that i'm unsure. because it was telling me it wouldn't permit it, so i thought i had to permit it. i guess a more serious problem is that i'm only being passed one of the four evaluation_answers from the view. (this is apparent by the log and by the html that is produced: all the input names for the fields are identical, and i'm unsure whether this is good)
[15:31:12] EminenceHC: workmad3: Yes
[15:31:21] workmad3: EminenceHC: and by 'changed my update method' I assume you mean 'added a new before_save callback' or some-such?
[15:31:25] stef1a: mikecmpbll: just updated it with the model
[15:31:57] mikecmpbll: stef1a: no, the problem is that you've so far failed to understand that accepts_nested_attributes_for requires your params to be called evaluation_answers_attributes
[15:32:03] workmad3: EminenceHC: so you want a 'MyModel.all.each(&:save)'? ;)
[15:32:05] EminenceHC: workmad3: The update method takes some of the existing params does some math and dumps its output in a new column
[15:32:11] stef1a: mikecmpbll: they are
[15:32:18] EminenceHC: workmad3: I think that is exactly what I want. Ill go try it.
[15:32:18] mikecmpbll: no they're not
[15:32:46] stef1a: mikecmpbll: you mean i should drop the [:response]?
[15:33:12] workmad3: EminenceHC: that could be a memory hog if the table is large btw
[15:33:17] mikecmpbll: you are not understanding the distinction between your actual parameters and what you're permitting in the controller
[15:33:54] workmad3: stef1a: btw, the way your form is getting constructed says that you don't actually have 'accepts_nested_parameters_for :evaluation_answer' in your model
[15:34:06] mikecmpbll: workmad3: it's because he's used wrong pluralisation
[15:34:11] mikecmpbll: in the fields_for
[15:34:17] workmad3: mikecmpbll: unless it's a has_one
[15:34:42] workmad3: mikecmpbll: as if you f.fields_for on something that doesn't exist you get errors ;)
[15:34:47] stef1a: workmad3: i have :evaluation_answers
[15:34:50] magnetica: mikecmpbll: are you suggesting field_for
[15:35:04] mikecmpbll: i thought you could field_for on any symbol?
[15:35:14] workmad3: mikecmpbll: you can... but f.fields_for != fields_for
[15:35:37] workmad3: mikecmpbll: in pretty much the same way as f.text_field != text_field_tag
[15:35:47] workmad3: stef1a: ok... and what is your association called?
[15:35:50] mikecmpbll: but why isn't he getting an error then? :)
[15:35:55] mikecmpbll: his model is in the gist
[15:36:03] stef1a: workmad3: they are in the gist. i have a has_many through:
[15:36:42] workmad3: mikecmpbll: heh :) dunno
[15:36:52] workmad3: stef1a: still... fields_for should have the association name
[15:37:02] workmad3: stef1a: as mikecmpbll has been telling you
[15:37:13] workmad3: stef1a: a.k.a. :evaluation_answer != :evaluation_answers
[15:37:48] stef1a: workmad3: ok. when i do that, the html produced is blank. it just has the submit button.
[15:37:52] magnetica: mikecmpbll: i'm confused, are you discussing fields_for
[15:38:02] mikecmpbll: magnetica: i'm talking to workmad3 and stef1a.
[15:38:05] puppeh: does anybody knows why even though I defined only an erb template for my mailer, the text/plain part is also generated by rails 3.2?
[15:38:07] mikecmpbll: and yes, i am
[15:38:09] magnetica: mikecmpbll: i see
[15:38:44] helpa: magnetica: 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.
[15:38:44] mikecmpbll: magnetica: !code
[15:38:54] workmad3: stef1a: that's because at that point, the f.fields_for is looping over what's in the evaluation_answers association (which is empty) so doesn't find anything to render a field around
[15:39:38] workmad3: stef1a: all of which is mentioned here: http://guides.rubyonrails.org/form_helpers.html#nested-forms
[15:41:40] workmad3: stef1a: and http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-fields_for gives more detail and enough information for you to figure out how to solve your problem properly rather than just renaming shit and telling us 'it doesn't work'
[15:43:16] stef1a: workmad3 mikecmpbll: okay, thank you.
[15:45:42] magnetica: mikecmpbll: the image does get uploaded, here it is https://gist.github.com/Jaffery5/3bb5c68d5bc17f9e60f8
[15:48:20] EminenceHC: workmad3: If I manually change a record's value and then update it will pick up my new controller methods. However they are not picked up when calling MyModel.all.each(&:save)
[15:50:11] pontiki: question in using capybara/selenium driver: we're seeing intermittent failures because JS scripts fail to run (thus DOM elements go missing, etc). The time-out is set to 20 seconds nominally, and increased to 45 seconds; is there any reason we should be seeing these intermittent failures?
[15:51:17] mikecmpbll: pontiki: what kind of thing is failing?
[15:51:19] pontiki: or better, what are some of the reasons we'd be seeing these intermittents?
[15:52:07] pontiki: hum, a js script is adding some elements to the DOM, they are not found on the page
[15:53:48] pontiki: but only *sometimes*
[15:53:56] pontiki: like 1 out of 3 times it fails
[15:54:46] pontiki: if the wait time is set < 10 seconds, it will fail every time
[15:55:23] magnetica: mikecmpbll: it seems like the simple_fields_for doesn't trigger photos controller https://gist.github.com/Jaffery5/3bb5c68d5bc17f9e60f8
[15:56:01] mikecmpbll: pontiki: not sure :[ sorry. what's this wait time setting?
[15:56:30] mikecmpbll: ah default_wait_time
[15:57:16] mikecmpbll: 45 seconds :D
[15:59:29] EminenceHC: From the console save and update_all do not run the controller's update method. What is a console command that will allow me to do this?
[16:02:42] makerop: if I am mounting an engine, that is serving up views, how do i handle csrf tokens?
[16:02:57] makerop: I am getting invalid auth token when i submit a form from an engine view
[16:03:18] mikecmpbll: makerop: not sure what the done thing is, but i know that you can have your engine's controllers inherit from the app's application controller
[16:03:24] mikecmpbll: i've done that a few times.
[16:10:14] makerop: mikecmpbll, if this is my engines app controller
[16:10:15] makerop: https://gist.github.com/makerops/03141d338fd9814aa4cf
[16:10:28] makerop: it should inherit from my parent app correct?
[16:11:17] stef1a: workmad3: i fixed my previous problem by nesting the fields_for in another fields_for. but now only one answer is passed back in my params hash, even though there are four answer fields.
[16:12:42] |RicharD|: exists something like asset_path for controller ?
[16:13:01] |RicharD|: I want know what is the path of my asset ... in my controller
[16:13:39] twosevenzero: Is there a tool already out there that will show the results of rspec in a browser. A page where I can click, "Run Tests" and see the output?
[16:14:41] mikecmpbll: travis ci? :
[16:15:36] twosevenzero: Maybe thats the way to go. I was just wondering if there was a gem that handled it locally so I can have it all internal
[16:16:05] pontiki: maybe guard?
[16:17:37] stepfresh: given the following spec, could someone tell me the best way to ensure the item that was added was indeed the item intended? https://gist.github.com/danhunter/769cdf696786cdfcabc4
[16:18:36] brownbathrobe: hey folks, i'm getting the following error when running rspec:
[16:18:37] brownbathrobe: undefined method `feature' for main:Object
[16:18:53] brownbathrobe: seems like Capybara methods are missing?
[16:19:42] pontiki: stepfresh: why not just compare the line_items on cart to [:item] ?
[16:23:52] twosevenzero: thanks mikecmpbll & pontiki
[16:24:40] stepfresh: pontiki: thanks!
[16:41:38] jeebster: does anyone have experience moving devise users from one database to another? I'm setting the encrypted_password attribute, however persisting the model throws error: "password can't be blank". is there any way to workaround these validations other than to persist without validation?
[16:42:36] pontiki: you're saving the same encrypted string?
[16:42:46] jeebster: pontiki: yup
[16:42:51] pontiki: does that actually work?
[16:43:07] jeebster: I'm mapping the object attributes directly
[16:43:21] workmad3: jeebster: you can do '.save(validate: false)' to skip validations... however, if you don't transfer the same devise secret to the new setup, the new service won't be able to verify old passwords
[16:43:22] pontiki: i'd figure different systems would result in different bcrypt salts...
[16:43:27] jeebster: no it doesn't, that's why I'm asking if anyone has a workaround
[16:43:51] workmad3: pontiki: for password verification, the salt is part of the bcrypt hash
[16:43:53] jeebster: workmad3: yeah that was my only thought, just wondering if it's possible to perform without skipping validation. perhaps overriding devise validations
[16:44:10] workmad3: jeebster: no... devise validations aren't something special, they're just normal validations
[16:44:32] workmad3: jeebster: the other option would be to get a direct DB dump of the table and just pipe it in via command like SQL tools
[16:44:33] jeebster: workmad3: right, but they're expecting these virtual attributes: https://github.com/plataformatec/devise/blob/master/lib/devise/models/database_authenticatable.rb#L31
[16:45:00] workmad3: jeebster: a validation on a virtual attribute is no different from a validation on a persisted attribute
[16:45:22] workmad3: jeebster: however, I assume the user model has the same validations in both systems?
[16:45:22] jeebster: and skipping these callbacks is class level eh? dang
[16:45:30] Dave321: My application.js file has //=require jquery in it, when it's being served. As a result, jQuery isn't included in my project. What could cause this to not compile? I'm in RAILS_ENV=development
[16:45:45] jeebster: workmad3: not exactly. migrating from a database where the authors never set any validations :\
[16:46:17] workmad3: jeebster: you could remove the :validatable strategy from the devise user while migrating data then
[16:46:36] jeebster: workmad3: how can I accomplish this?
[16:46:46] workmad3: jeebster: in the user model, there's the 'devise' line
[16:46:48] jeebster: you mean remove the declaration in the model temporarily?
[16:47:17] Lloyd: is there a reason you want to import this data through the models, rather than just SQL?
[16:47:19] workmad3: the ':validatable' symbol passed to the devise call is what adds the validations, not the :database_authenticatable strategy ;)
[16:47:33] jeebster: ah ok, thanks for the heads up
[16:48:02] jeebster: Lloyd I'm working on a script someone else authored. I might just end up rewriting to a SQL import
[16:48:11] jeebster: background-processing was one reason
[16:48:21] jeebster: zero downtime
[16:48:29] jeebster: thanks for the input everyone!
[16:58:24] trooney: With models Foo::Person, Foo::Address and an address resource nested in person /foo/person/{:id}/address my forms are failing with an undefined route "foo_person_foo_address"
[16:59:08] jrhorn424: Radar does ransack do any optimizations on large data sets? we've got an issue with a double left outer join producing duplicate results, but only on large data sets.
[16:59:11] trooney: The resources have setup foo_person_address -- how can I use this without doing form_for url: 'whatever'
[17:04:50] brownbathrobe: hey folks, having trouble with what I assume are missing Capybara methods (`visit`, `click_link` etc) when running rspec tests
[17:05:19] brownbathrobe: anyone encountered that before?
[17:08:26] nahtnam: Hey! How can I match every route to a single controller/action?
[17:09:36] nahtnam: Something like `get '/*' => 'assets#index'`?
[17:23:10] jrhorn424: Radar disregard my last message. :)
[17:26:46] nahtnam: pontiki: ?
[17:27:33] pontiki: try it and see
[17:27:52] nahtnam: pontiki: No, it does not work
[17:38:26] bricker`work: nahtnam: get '*path' => 'assets#index'
[17:38:57] nahtnam: bricker`work: Oh, thanks!
[17:39:05] bricker`work: nahtnam: this is explained in the routing guide: http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
[18:02:34] startupality: does .hamlc file format support link_to helper?
[18:07:21] tubbo: startupality: theoretically, it should.
[18:07:37] tubbo: well actually...you're not *really* in actionview when you're in sprockets
[18:07:43] tubbo: so i wouldn't bet on it
[18:15:51] ericwood: yo anyone in portland hiring?
[18:16:18] ericwood: I can assure you I am really good at stuff
[18:16:31] tbuehlmann: we need stuff, want to come to germany?
[18:16:52] ericwood: my german is awful
[18:17:01] ericwood: I am quite good at english tho
[18:20:16] ericwood: I think I might just resort to moving out there and taking on client work until I can network my way into a job
[18:20:35] ericwood: gonna be sitting on a street corner with a "will code for food" sign
[18:23:27] tbuehlmann: sounds like a plan
[18:23:29] karamazov: ericwood: Have you tried searching Portaland + rails and e-mailing companies?
[18:24:00] ericwood: yeahhhhh, it's kinda tough to find smaller companies though
[18:24:01] centrx: Porta Potty Land
[18:24:24] karamazov: It's not unheard of - it's how i've landed a job
[18:25:22] stef1a: how can i change this params hash so it looks more like "evaluation_answers"=>{"0"=>{...}, "1"=>{...}, ...}? https://gist.github.com/smlance/6d89ff671314deef7600#file-development-log-L3
[18:26:01] ericwood: stef1a: doesn't it already look like that?
[18:26:19] stef1a: ericwood: nope. there's an extra layer that i want to get rid of.
[18:26:54] stef1a: i suppose it's not necessary, but it feels wrong to be passing it in like that.
[18:26:55] ericwood: params[:evaluation_answers] = params[:evaluation_answers]['evaluation_answers']
[18:27:16] ericwood: I feel like you should change whatever is submitting that request instead, though
[18:27:17] sandelius: How can I create a validation that makes sure that atleast 1 association exists in has_many through? A task can have many users (taskships) and MUST have one asssigned
[18:27:26] stef1a: that would feel hacky. i'm thinking there's something a bit wrong with my form.
[18:27:39] ericwood: stef1a: yep, I'd check the form
[18:27:42] stef1a: like i said, just leaving it like this and accessing the values another level deeper feels wrong
[18:28:49] workmad3: stef1a: would be good if you'd updated the form to the latest version too...
[18:28:50] stef1a: it seems like it's merging the inner hashes into one big inner hash with all four responses at line 8 here: https://gist.github.com/smlance/6d89ff671314deef7600#file-new-html-erb-L5. i'm unsure how to deal with that.
[18:28:56] stef1a: workmad3: i did
[18:29:03] workmad3: stef1a: ah, I meant the rendered html
[18:29:11] stef1a: workmad3: you got it.
[18:29:12] workmad3: stef1a: or removed that as useless :P
[18:29:49] workmad3: not that I can really help atm... not got the time to focus
[18:30:04] stef1a: workmad3: all right, thanks for the tip, though
[18:31:09] stef1a: i want each of the names here to just be evaluation_answers[n][response], i think: https://gist.github.com/smlance/6d89ff671314deef7600#file-new-html-L5
[18:38:26] joy4u: how to implement a feature like an user can edit article and then the change needs to approved by the admin in the meantime the original version of the article will be shown
[18:38:51] centrx: joy4u, Have a set of "drafts"
[18:39:00] centrx: joy4u, Either a different table, or a flag in the main table
[18:40:19] centrx: joy4u, or "changeset" is another way to think about it
[18:41:36] joy4u: what is chageset?
[18:45:39] tubbo: yeah, basically have every "edit" actually create a new article_change record or something, and whenever that gets approved then actually do the edit
[18:46:07] tubbo: don't store deltas, store full text representations of each version. at least, for now :)
[19:21:39] Dave321: My application.js file has //=require jquery in it, when it's being served. As a result, jQuery isn't included in my project. What could cause this to not compile? I'm in RAILS_ENV=development
[19:30:18] momomomomo: Dave321: http://guides.rubyonrails.org/asset_pipeline.html
[19:31:06] alaing: finally got my ror site up and running
[19:31:19] alaing: does anyone have a good unicorn tutorial
[19:32:02] ldnunes: alaing, I think the GitHub guys have a blog post about it. Google for it!
[19:32:41] benlieb: is there a way to access the :locals hash from inside a partial instead of the local variables with the same name?
[19:34:26] stevednd: Hey all, some help needed with oauth if possible. We're attempting to add oauth2 provider support to allow users to access their data through third parties. The problem is that we don't have one central API. Currently the interfaces the client would interact with are spread across 4 apps(we're consolidating, it's just going to be a while). We want to provide the user one interface to authorize access to their information
[19:34:26] stevednd: amongst all of the applications. What would be the best way to go about this? Is there a way to unauthenticated/unauthorized requests to each API to one central auth server?
[19:34:43] ldnunes: benlieb, render 'partial', :locals => {:locals_hash => hash}
[19:35:13] benlieb: I'm talking about from INSIDE the partial
[19:35:14] ldnunes: benlieb, then on the partial you just access it with "locals_hash"
[19:35:49] benlieb: ldnunes: you're not understanding the question right
[19:36:03] benlieb: I want to access the actual hash :locals
[19:37:18] dcope: is there any service or application that plays nicely with ruby to dump a lot of data then go back and mine it later?
[19:37:20] ldnunes: benlieb, can't you just change the :locals hash to contain the hash you want on a key-pair? It's much simpler.
[19:37:26] dcope: for analtyic type things
[19:37:28] ldnunes: *key-value pair
[19:37:47] benlieb: ldnunes: that's what I'm doing now, but it's become tedius
[19:38:07] benlieb: :locals => { :opts => {:myvar => @myvar}}
[19:38:24] ldnunes: benlieb, ok, hang on, I'll look in the source.
[19:38:35] benlieb: then inside the partial I do opts.reverse_merge!(defaults)
[19:39:15] workmad3: dcope: hmm... could you dump it out into time-stamped records in a JSON field in postgres and then get a processor to walk over it and extract useful stuff?
[19:40:02] dcope: yeah, that is an option. i was just wondering if there was something already built for this so i wouldn't have to roll my own
[19:40:15] workmad3: dcope: as I suspect you'd want your first-stage to be into something local... dealing with sending large, frequent packets to a service in the request thread sounds like it would be a bottleneck way too quickly :)
[19:41:09] dcope: workmad3: indeed.. i didn't know if there was some tool i could install on my RoR server and talk to
[19:42:22] workmad3: dcope: tbh, I can't think of anything that would be better than a stupidly-simple rack app (not even full rails) that maintained a pg database connection and simply dumped out a JSON string into the database
[19:42:44] workmad3: dcope: hell, you could probably roll that out as a gem for people to use :)
[19:43:49] workmad3: dcope: well, I guess you could also consider pushing the data straight into a message queue of some form... rabbitmq, apachemq, zeromq...
[19:44:08] workmad3: dcope: rather than send it to a db for later processing, just have a processing pipeline that you push the data into ASAP
[19:44:15] benlieb: ldnunes: any luck?
[19:44:48] workmad3: dcope: I'm not aware of any standard apps for that though
[19:45:22] ldnunes: benlieb, not yet... ActionView is somewhat messy to look at...
[19:46:00] dcope: workmad3: intersting... seems like it would be very practical for some standard program to do this
[19:46:16] dcope: a lot of web apps show popular items for the day, past 7 days, past 30 days, etc.
[19:47:06] workmad3: dcope: well, in the java world, I think it's either out-the-box or dirt-simple to set up an endpoint like that in apache camel
[19:47:29] makerop: https://gist.github.com/makerops/7b87c109af704b20332f
[19:47:44] makerop: why would /sign_in give me a No route matches [GET] "/sign_in"
[19:49:41] ldnunes: benlieb, sorry... It's beyond what I can do... :/
[19:50:00] benlieb: ldnunes: np, i didn't even bother to try.
[19:50:06] benlieb: seems like a bad idea anyway.
[19:50:39] benlieb: if you stumble on a solution later, you could always post to this: http://stackoverflow.com/questions/25391753/how-can-i-access-the-locals-hash-from-inside-a-partial-instead-of-the-local-var
[19:51:09] ldnunes: benlieb, ok. If you want to try, the answer is probably around actionpack/lib/action_view/renderer/partial_renderer.rb
[19:56:12] h4pless: so i'm posting some post data to a post API and the logs show that rails is getting the entire content in the request, and then it completes the post/put request with status 200, but then on read from the api or console, it shows that only part of the content has been saved. There are no maximum length filters or before_save/create events touching the content in the model, there are no added rules to be enforced by the database and the log shows the ap
[19:56:12] h4pless: p is recieving and thinks it's saving the entire set of post data in the request. What could cause this? i am unable to reproduce the problem in development as the code does not seem produce errors outside of the mysql + apache environment.
[20:04:39] kedric: I am using guard and listen with os x host and ubuntu guest using vagrant. I can telnet from ubuntu to os x and receive file change notifications but guard does not catch them. Any ideas?
[20:13:58] nixter1029: Alright, don't know if anyone here knows how to fix this, but here it goes.
[20:14:22] nixter1029: I am trying to bundle install, but keep getting issues with rdiscount
[20:15:10] dllama: i'm submitting a form with nested attributes, its just a series of dates and payment amounts. trying to update them via accepts_nested_attributes, but am getting pertaining to dates, because they're submitted via form as mm/dd/YYYY. what can i do to clean it up?
[20:15:39] centrx: dllama, What are "pertaining to dates"?
[20:16:16] imton: guys, CanCan/CanCanCommunity gem alternative?
[20:16:27] dllama: sorry, errors*
[20:16:33] dllama: im getting errors pertaining to dates.
[20:17:08] dllama: ArgumentError: argument out of range
[20:17:27] stepfresh: imton: cancancan
[20:17:42] stepfresh: oh, thats the community one
[20:17:44] stepfresh: nevermind me
[20:19:09] centrx: dllama, You should post the full error message with backtrace and the code it pertains to
[20:19:44] dllama: centrx: that was the full error
[20:20:25] dllama: got binding.pry on update method, all i did was @loan.update_attributes(loan_params)
[20:20:36] dllama: and got argument out of range error
[20:20:54] dllama: i'm thinking that i'd have to just iterate over loan_params and create a new hash with parsed out dates,
[20:21:07] dllama: or rather datetime objects rather than string
[20:21:08] benlieb: ldnunes: turns out it's local_assings
[20:21:13] stepfresh: dllama: if you can???t clean up the params before they hit the update_attributes.. you could override the date= method
[20:21:40] centrx: dllama, Ruby error messages reference files and line numbers and methods and so forth
[20:22:17] ldnunes: benlieb, Oh! Just that? Sweet!
[20:35:32] banas: I'm a newbie. Trying to use colorbox-rails
[20:36:06] banas: I tried to search, but couldn't find a nice resource to apply the dark background colorbox offers with the gem
[20:36:11] banas: anyone have any leads, please?
[20:39:33] rhizome: what do you mean?
[20:44:41] banas: rhizome: I wanted to be able to do something like the one in http://www.jacklmoore.com/colorbox/example1/
[20:44:58] banas: specifically, something like the one under "No Transition + fixed width and height (75% of screen size)"
[20:45:57] banas: so far, I've been able to achieve this: http://glittery-banas.rhcloud.com/sarupb/helloworld/
[20:46:19] banas: if you clicked on the photos, you can see the slideshow, but it is without a background.
[20:48:53] banas: now.. I'm not exactly sure if that's a colorbox issue or a rails one.
[20:56:48] rikkipitt: hey guys, i'm trying to create a Rails engine that will be used to provide the parent Rails app User model with some extra fields - say with an extend/inherit
[20:57:01] rikkipitt: should this be --mountable or not?
[20:58:03] rikkipitt: also, if the parent app has a user model, how will the engine just update what's there?
[20:58:18] rikkipitt: or should it be namespaced as with --mountable?
[20:59:11] skyjumper: rikkipitt: i did the same thing recently but made it mountable, can't remember why
[20:59:12] rhizome: banas: i think there's just some config stuff you haven't included
[20:59:30] rikkipitt: skyjumper: awesome!
[20:59:40] skyjumper: might have been route-related though
[20:59:42] rikkipitt: did it all work out okay?
[20:59:52] skyjumper: i used a little hack, again can't remember why
[21:00:10] rikkipitt: ah right yeah, i'm not really after any routes I dont think yet
[21:00:25] rikkipitt: just extended features on the user model (namely fields)
[21:01:08] skyjumper: might be more rails-ey to define a class method on ActiveRecord::Base and call it in your User model
[21:01:20] rossbarclay: Does the current Missing Route return a true 404 or is it a soft 404. Basically, is the return code 200 or 404? I would like to try and return a true 404 if possible. I am not sure if it already does. thank you
[21:01:25] tubbo: rikkipitt: mountable engines are really for code that you want included in the app regardless of whether the dev wants it or not
[21:01:47] tubbo: rikkipitt: such as the Devise::RegistrationsController...but in your case, if you are just shipping mixins that are going to be `include`d into User, you don't need to make it mountable
[21:02:06] rikkipitt: cool, thanks tubbo
[21:02:20] tubbo: the gem's existence in the app Gemfile will require the main module in
[21:02:33] rikkipitt: within my unmountable engine then, should I rails g model User?
[21:03:14] rossbarclay: sorry wrong room. thanks
[21:04:04] tubbo: rikkipitt: that depends. are you intending to just phave your gem provide the User model? or do you want the dev using your gem to actually have control over the User class in their app?
[21:04:18] tubbo: s/phave/have
[21:04:52] rikkipitt: tubbo: the User model will exist already but will build on from the engine if that makes sense?
[21:05:18] tubbo: rikkipitt: so you want the dev to generate the User model then...meaning you probably shouldn't generate a User in your engine
[21:05:55] tubbo: rikkipitt: pretend i'm a user of your gem. you want my User class to look like this, sorta, right? https://gist.github.com/tubbo/6c783071f74c5537889e
[21:05:56] rikkipitt: thought so tubbo because the first migration from the engine will be a create_table
[21:06:30] tubbo: rikkipitt: you probably don't want to do that. but i really don't know what you're making so i don't know. but if you want the dev to have a User already, then they should be doing the create_table in their own app's migration
[21:06:32] rikkipitt: ooh, potentially yes tubbo
[21:06:34] tubbo: your gem doesn't need to do that
[21:07:18] tubbo: rikkipitt: typically, gems that change the db schema ship with a generator that generates the migrations it needs
[21:07:34] rikkipitt: tubbo, I was thinking something more like - Class User < Core::User
[21:07:41] tubbo: ah, is ee
[21:08:05] tubbo: i'm not entirely sure what that will do, actually
[21:08:06] rikkipitt: ah yeah, so something like rails g core_user:install
[21:08:14] tubbo: but there's really no need to subclass
[21:08:24] rikkipitt: cool, thanks for that
[21:08:28] tubbo: you can simply do `class User < AR::Base; include Core::User`
[21:08:43] rikkipitt: sounds better, thanks tubbo
[21:09:15] tubbo: my rule of thumb, that has no basis in reality i don't think, is that unless i'm overriding initialize() (e.g., the way the class is constructed), i will use mixin modules. but if i need to control that level of the object, i'll subclass.
[21:09:21] rikkipitt: so you reckon a generator will be better theb
[21:09:30] tubbo: i would say so
[21:10:05] rikkipitt: thanks for the advice tubbo, really appreciated
[21:10:08] makerop: any chance ryan bigg hangs out in here?
[21:10:22] tubbo: makerop: he doesn't hang out anywhere iirc
[21:10:24] rikkipitt: i thought i was talking crazy
[21:10:40] tubbo: makerop: oh wait i thought you meant the railscasts guy :D
[21:10:49] makerop: different ryan
[21:11:53] EminenceHC: makerop: Seriously? He hangs out in here more than most.
[21:12:53] makerop: EminenceHC, do you happen to know his nic?
[21:13:07] makerop: i bought his book on multitenancy and am having some trouble
[21:14:00] EminenceHC: makerop: Radar.. he is the channel moderator. He lives in new zeland I think so he doesnt usually come on for a couple more hours from now.
[21:14:12] makerop: ah cool ty
[21:14:13] EminenceHC: or australia
[21:15:00] blackmesa: hi all. are these equal for checking if a param exist? params.has_key?(:id) vs params[:id].present?
[21:21:54] NBarnes: Let us assume that I have a page with a tabbed pane. Two tabs, two divs being shown and hidden via jqery, but both sets of content in the DOM for speed of switching.
[21:22:12] NBarnes: I want URL-A to go to the page with Tab A open and URL-B to go to the page with Tab B open.
[21:22:17] NBarnes: What is the correct technique for this?
[21:23:49] NBarnes: Based on half-remembered things I've read, I'm reading about JS replaceState()
[21:23:59] NBarnes: But the light of understand has not yet dawned.
[21:34:55] rhizome: blackmesa: present? requires the key to be there
[21:35:48] rhizome: start irb; params = {}; params[:foo].present?
[21:37:26] blackmesa: rhizome: thx
[21:42:48] HenriettaSalt: I'm using actionmailer to send an email to new users when a new user is created. When I try to test it, though, (in cucumber), I'm seeing that UserMailer.deliveries is empty. Anyone have any ideas?
[21:48:32] rhizome: i tend to use ActionMailer::Base.deliveries
[22:01:34] HenriettaSalt: rhizome: Using that still comes up empty :(
[22:05:54] Radar: EminenceHC: I live in Australia.
[22:06:07] Radar: makerops: Hi.
[22:06:20] Radar: makerops: Emailing me is the best way to get in contact :)
[22:13:16] EminenceHC: Radar: Yes I corrected myself. Honeymoon in New Zealand.. I forgot :P.
[22:34:47] banisterfiend: anyone here know much about oauth2?
[22:35:20] phat4life: use yoauth *trolls
[23:04:28] Matadoer: how does one set rails up with a mysql cluster
[23:13:10] bricker`work: Matadoer: Octopus is okay
[23:13:27] bricker`work: doesn't deal with replication lag, which is an annoying problem
[23:13:48] bricker`work: Matadoer: you could also use a load balancer for your cluster and just point your rails app at it like normal
[23:14:01] bricker`work: Matadoer: that'd only work with Master-Master setup, of course
[23:16:15] greenride: When using the Ruby debugger in a Rails app, is there a way to make backtrace skip all functions located outside the Rails application?
[23:24:02] sdwrage: Hey all. This doesn't seem to be the correct format for this type of query... there is no OR... am I at least close?
[23:24:03] sdwrage: scope :bbw, -> {where(height: 58...62).where(weight: 140...169).or.where(height:63...67).where(weight:160...189).or.where(height: 68...71).where(weight: 190...219).or.where(height:72...76).where(weight:250...269)}
[23:24:37] Fire-Dragon-DoL: yep, no OR (we still miss such a feature!!) you have two options
[23:24:47] Fire-Dragon-DoL: either use string
[23:25:36] Fire-Dragon-DoL: where("pluralized_model_name.height IN ? OR pluralized_model_name.weight IN ?)
[23:25:39] aarmenaa: I spent an entire day once searching for the solution to the missing OR problem, because I couldn???t believe that something so basic was missing from AR.
[23:25:40] Fire-Dragon-DoL: OR you can use arel
[23:26:09] sdwrage: I see what you did there fire :P
[23:26:13] Fire-Dragon-DoL: (which is integrated in AR), first, grab the hook to arel, it's easy (obtained from model class)
[23:26:42] Fire-Dragon-DoL: users = User.arel_table
[23:26:51] Fire-Dragon-DoL: then you can do something like the following
[23:27:09] sdwrage: You would think someone may have written a plugin that added the or operator
[23:27:30] sdwrage: I guess I am stuck with the string version
[23:27:31] Fire-Dragon-DoL: where(users[:height].in(58..62).or(users[:weight].in(blah))
[23:27:45] Fire-Dragon-DoL: no, the maybe-official version is using arel
[23:28:06] Fire-Dragon-DoL: sdwrage: http://rubydoc.info/github/rails/arel/master/Arel/Predications <-- arel docs
[23:28:17] Fire-Dragon-DoL: yea, shitdocs but I discovered everything from there
[23:28:25] sdwrage: Thanks... guess I will need to hold off my meeting with the client then... yay x.x
[23:30:04] greenride: When using ruby debugger with a rails application, is there a way to get backtrace to skip all functions referenced in files outside the rails application?
[23:40:39] moogumbo: Is there a way to prevent Sprockets from generating *.gz versions of assets?
[23:43:42] moogumbo: Also, isn't the topic out of date? Rails 4.0.x is up to 4.0.9
[23:48:19] lilia: if i have a json field on my model, can i create an association based on one of the k,v inside the json hash?
[23:55:13] beneggett: lilia: sure you could, just like a normal self referencing association, but finding the k,v value.
[23:58:08] beneggett: lilia: show some code of what your json looks like, and i'll give you an example based off it
[23:58:22] beneggett: lilia: or what you have in mind
[23:58:48] lilia: I have a class Foo with some json properties that reference a Bar #<Foo id: 1, properties: {"bar_id"=>28}>
[23:59:10] lilia: I want to add a belongs_to :bar in Foo