« Back to channel list

#RubyOnRails - 27 August 2014

« Back 1 day Forward 1 day »
[00:00:12] crankharder: yea. what bricker said.
[00:00:23] crankharder: my job is done here
[00:07:46] mwlang: is anyone else experiencing long delays with fonts.googleapis.com today?
[00:09:12] mwlang: hmmm???that???s actually not my current issue???something???s taking an exceedingly long time to download, but I can???t pinpoint it.
[00:09:34] mwlang: I???m looking at the Net tab to try to determine what???but browser just sits at ???Read local???
[00:09:41] mwlang: oops??????Read localhost"
[00:11:01] mwlang: but I am noticing long waits on fonts.googleapi.com and fonts.gstatic.com (whcih I assume is also related to fonts.googleapi.com since that???s the only font-face reference I have in my project)
[00:21:44] mwmnj: Hi, I am having trouble loading fixtures using minitest
[00:22:14] mwmnj: Is there something I need to add in the setup or something to make them load, I have fixtures :all in my test helper
[00:32:44] nahtnam: 1994 Barbados vs Grenada
[00:39:42] mwmnj: Anyone have any advice on debugging fixtures?
[00:40:00] mwmnj: I am trying to load them in tests ran from a rails engine with no success
[00:44:26] zlx_star: mwmnj: more detail? the spec_helper or test_helper and fixtures files
[00:44:51] zlx_star: mwmnj: how do you run test?
[00:45:07] mwmnj: zlx_star: the test_helper
[00:45:18] mwmnj: I run the test from the engine root directory with "rake test"
[00:45:58] mwmnj: zlx_star: my test_helper.rb file looks like: http://pastebin.com/raw.php?i=65FjNHxL
[00:46:33] mwmnj: And I assume this line should put the fixtures on the path correctly: ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
[00:46:40] mwmnj: Its then my understanding that they will just load
[00:46:54] mwmnj: when running the test in a transaction
[00:47:59] zlx_star: mwmnj: ActiveSupport::TestCase.method_defined?(:fixture_path=) is return true?
[00:48:11] zlx_star: you can test in console
[00:50:56] mwmnj: zlx_star: oh actually it isnt loading them
[00:51:18] mwmnj: zlx_start: setting the path rather, that returns false
[00:51:55] zlx_star: mwmnj: looks your fixtures is out of test dir, if the File.expand_path("../fixtures", __FILE__) is right
[00:56:07] mwmnj: zlx_star: this is my exact issue only I am not sure of the suggested solution
[00:56:11] mwmnj: http://stackoverflow.com/questions/18760101/how-to-load-the-fixtures-from-an-engine
[00:56:24] mwmnj: self.fixture_path is supposed to go in my testcase?
[00:56:39] mwmnj: (the class inheriting from < Minitest::Test)
[00:56:41] Spami: When running this nohup rails runner -e development 'Model.Method', I understand that it's booting rails, loading all the conf/gems/..., is there anyway to speed up the process ?
[00:57:15] sevenseacat: Spami: use a more modern version of ruby/rails/get a faster PC/etc?
[00:57:39] Spami: sevenseacat, ok, no special tuning ?
[00:57:52] sevenseacat: dont require the gems that dont need to be required, etc.
[01:00:05] zlx_star: mwmnj: Does the first answer resolve your question?
[01:01:00] zlx_star: Spami: use spring after rails 4
[01:01:00] mwmnj: zlx_star: no
[01:01:10] mwmnj: Here is a similar SO thread
[01:01:25] mwmnj: he recommends removing the dummy app but I thought that was generated for a reason?
[01:01:44] mwmnj: I don't want to just do things without knowing whats going on
[01:01:46] Oog: how can i get a list of asset preprocessors taht are available? it seems JST and EJS is supported and i wonder where it came from
[01:02:19] zlx_star: mwmnj: do you try load it into database only with rake db:fixtures:load RAILS_ENV=test
[01:03:26] mwmnj: zlx_star: it works when loading with that command
[01:03:45] mwmnj: and it looks at the fixtures in /dummy/test/fixtures
[01:04:22] zlx_star: so I think something clear it for you, try comment database_cleaner
[01:05:35] mwmnj: zlx_star: yea, i've tried that already database_cleaner isnt clearing them
[01:05:59] mwmnj: is there something I can run in the test case to see if an attempt at loading them is made??
[01:06:48] zlx_star: mwmnj: are you try run single test with ruby -Itest /dir/to/your/test.rb
[01:07:06] mwmnj: zlx_star: no I am running with 'rake test'
[01:07:14] mwmnj: from my engine root dir
[01:07:32] mwmnj: (i've put all models in my engine and thats what I am trying to test)
[01:08:45] zlx_star: mwmnj: show me your whole dirctory
[01:15:31] mwmnj: zlx_star: ok
[01:17:00] mwmnj: zlx_star: http://pastebin.com/raw.php?i=XzjvZyJ0
[01:21:36] helpa: Pastebin sucks! Use Gist (http://gist.github.com) instead, please!
[01:21:47] Radar: although raw is ok
[01:22:24] mwmnj: Radar: haha, any insights into using fixtures in an engine?
[01:22:30] Radar: nope, sorry
[01:24:23] marahin: Guys. If I have a large JSON object, what's the best way to store it in the database?
[01:24:59] marahin: Like, how would I store http://eu.battle.net/api/wow/guild/Argent%20Dawn/The%20Aspects?fields=news
[01:30:00] nahtnam: Hey! I get some json like this: @data = self.class.get("/stats/1") which returns this JSON: https://gist.github.com/nahtnam/0081b8684bd5f675b032 I am trying to access the "active" part. I tried doing <%= @data.stat.active %> but that doesnt seem to work.
[01:31:03] sevenseacat: how do you access stuff in hashes?
[01:43:14] mozzarella: how do I??stop paperclip from appending a timestamp to my urls?
[01:43:47] sevenseacat: why do you want to do that
[01:45:13] mozzarella: people will want to share the links and it's just ugly, also you won't be able to chaneg them anyway
[01:45:47] mozzarella: I'm assuming paperclip uses that to invalidate people's cache when the picture changes?
[01:45:50] sevenseacat: do you know what they're for? :/
[01:46:02] sevenseacat: its nothing to do with paperclip caching, its for browser caching
[01:46:07] sevenseacat: or lack thereof
[01:46:12] sarkis: hey all - with rails 4, should i only be seeing fingerprinted assets when i precompile?
[01:46:16] mozzarella: that's what I'm saying
[01:47:01] mozzarella: I just want them to rely on the http header
[01:47:03] sarkis: previously, i had both the asset + asset-fingerprinted which made it easier to access the fingerprinted asset using the Rails.assets.find_asset helper
[01:47:14] sarkis: did that change?
[02:10:38] mozzarella: how do I??stop paperclip from appending a timestamp to my urls?
[02:15:19] krz: so without native support for observers. what pattern are devs using these days? theres a gem, service objects? or other?
[02:16:18] sevenseacat: what do you mean, without native support?
[02:17:52] krz: sevenseacat: it was taken out of rails 4 and into a plugin
[02:18:06] sevenseacat: i think you just answered your ownquestion then
[02:22:20] sarkis: should i expect to see both asset + asset-fingerprint or has it changed/
[02:27:56] sarkis: so for some reason we are not seeing the actual files any longer when we do assets:precompile, we just see asset-fingerprint.ext
[02:28:07] sarkis: i think this was something new in rails 4?
[02:28:17] sevenseacat: what do you mean, you dont see the actual files
[02:28:23] sarkis: previously we would for example have both foo.png and foo-34223563289562388562.png
[02:28:35] sevenseacat: you wont get the former anymore
[02:29:36] sarkis: well that sucks, seeing that the helper method doesn't work, how can you get the fingerprinted path?
[02:29:54] sarkis: do we need to get the MD5 digest and add it ourselves? :)
[02:29:55] sevenseacat: what helper method?
[02:30:07] sarkis: Rails.assets.find_asset
[02:30:26] sevenseacat: what behaviour are you seeing?
[02:30:29] sarkis: Rails.assets.find_asset('foo.png') - Nil
[02:31:12] sevenseacat: and where is that file?
[02:31:32] sevenseacat: seriously, this is like pulling teeth
[02:32:06] sevenseacat: and where are you calling this? and how? and why?
[02:33:02] mozzarella: how can I access string.parameterize in rails console?
[02:33:11] Radar: mozzarella: "string".parameterize
[02:33:22] mozzarella: Radar: doesn't work
[02:33:29] Radar: mozzarella: pics or ban
[02:33:34] helpa: mozzarella: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[02:33:34] sevenseacat: mozzarella: !didntwork
[02:33:50] mozzarella: NoMethodError: undefined method `parameterize' for "test test":String
[02:33:57] Radar: mozzarella: in irb or rails console?
[02:34:12] mozzarella: rails console uses pry
[02:34:39] Radar: that makes 0 sense
[02:34:51] sevenseacat: that doesnt answer the question
[02:35:32] mozzarella: in rails console but I??use pry-rails
[02:35:40] Radar: Still doesn't make any sense
[02:35:50] Radar: parameterize is defined by AS which is loaded when rails console starts
[02:35:51] sevenseacat: https://gist.github.com/karpah/d8b7496422fffbf9ab08
[02:36:20] mozzarella: anyway, I restarted it and now it works (????;____;)
[02:39:38] Radar: praise be to the almighty "I restarted it and it worked" gods
[02:39:54] sevenseacat: praise be to yevon.
[02:40:39] mozzarella: why is there a beheaded goat on the floor?
[02:40:47] mozzarella: who did this?
[02:41:00] sevenseacat: ACTION points at Radar
[02:41:35] mozzarella: Radar have you lost your mind (?????????????????????)
[02:47:50] mozzarella: does paperclip move the file *before* saving the model or *after*?
[02:48:35] wethu: apidock dead in the water?
[02:49:21] wethu: mozzarella, thanks, that sucks lol
[02:49:36] mozzarella: apidock could very well be the goat on the floor
[02:54:13] jabbott: Why is rails giving me "Unknown Format" https://gist.github.com/comdexxsolutionsllc/8ce1925c6607a9c6ffed
[02:54:34] pontiki: no, man, i still need apidock for this ridiculous old rails app i'm wrangling with
[02:54:59] amh345: I'm trying to do some inline error messages on my form using using the error messages from @customer.errors only .errors only returns the attribute name, and not the model. tho prevents me from looping through the json response and pairing the error with the form field. is there a way to have .errors return a format that includes the models so it can pair with the form fields?
[02:55:15] helpa: jabbott: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[02:55:15] sevenseacat: jabbott: !debug
[02:55:27] rhizome: pontiki: rake rails:doc?
[02:55:52] pontiki: hmm, does that work with jruby?
[02:55:57] pontiki: ACTION goes to try
[02:56:01] sarkis: sevenseacat: hey bud calm down
[02:56:04] rhizome: doc:app i mean. dunno about jrubyu
[02:56:17] sarkis: sevenseacat: all i asked is if precompile should have the asset and asset-hash
[02:56:32] sevenseacat: huh? i'm calm
[02:56:32] rhizome: but, yknow, ruby and rails comes with docs for its own stuff
[02:56:46] sevenseacat: oh, you havent seen me grumpy
[02:57:04] pontiki: yes, i do know, but i don't want to keep a pile of documentation on my tiny 128G drive, either
[02:57:32] rhizome: move it to a thumb drive!
[02:57:57] rhizome: or create your own doc server. nothing special about apidock or the others. find a format you like and click away
[02:58:39] sevenseacat: `gem server`? :)
[02:59:37] jabbott: sevenseacat: https://gist.github.com/comdexxsolutionsllc/8ce1925c6607a9c6ffed there you go.
[02:59:54] alex8022: so I'm moving part of a rails app to an engine, and I'm trying to get tests running. I had some errors with fixtures, and I might have fixed them with ActiveSupport::TestCase.set_fixture_class, but now i'm getting a new error:
[02:59:56] rhizome: yes, gem server is available if you like your docs to be ugly as shit
[03:00:29] alex8022: method_missing: undefined method 'attr_accessible' for #<Class> (NoMethodError)
[03:00:37] sevenseacat: jabbott: i dont know if you can have two respond_to blocks like that, and expect them to be run sequentially
[03:00:42] pontiki: seems not for jruby
[03:00:57] sevenseacat: alex8022: dont write code for rails 3 in a rails 4 app?
[03:02:26] alex8022: is attr_accessible deprecated? Tests were running fine before moving to an engine. It did start as a rails3 app and migrated to rails4...
[03:03:47] sevenseacat: its not in rails 4 unless you're using the protected_attributes gem, which idont recommend
[03:05:19] alex8022: ... tests pass, thanks a bunch. weird that I've never gotten that error until moving to an engine.
[03:06:35] sevenseacat: jabbott: if you move the admin conditional into the first respond_to block it might work
[03:13:50] mozzarella: I'd like the id of my model to be in the filename, using paperclip, not sure how to do that (????;____;)
[03:14:08] sevenseacat: check the paperclip docs
[03:14:19] jabbott: sevenseacat: hmm.. that doesn't work either. dammit.
[03:14:27] sevenseacat: jabbott: code?
[03:17:11] jabbott: at the bottom https://gist.github.com/comdexxsolutionsllc/8ce1925c6607a9c6ffed
[03:17:58] sevenseacat: yeah i already said that having two respond_to blocks likely wouldnt work
[03:18:20] sevenseacat: (11:06:34) sevenseacat: jabbott: if you move the admin conditional into the first respond_to block it might work
[03:19:43] sarkis: so in rails 4 how do you access an asset in the model?
[03:20:29] jabbott: Now I'm getting ActionController::UnknownFormat
[03:20:44] jabbott: at the .html line
[03:20:54] sevenseacat: jabbott: code?
[03:21:00] sevenseacat: sarkis: you don't
[03:21:47] jake_g: Has anyone worked with dropzone.js before?
[03:21:51] sarkis: i see now
[03:21:57] sarkis: Unmanaged asset paths and urls fallback to linking to public/. This should make it easier to work with both compiled assets and simple static assets. As a side effect, there will never be any "asset not precompiled errors" when linking to missing assets. They will just link to a public file which may or may not exist.
[03:22:28] jabbott: sevenseacat: last gist on that page.
[03:23:19] sevenseacat: there no cooooode theeeeeere
[03:24:21] sevenseacat: ACTION starting to wonder if #rubyonrails made a secret pact to troll me
[03:26:21] sarkis: easy fix /exit
[03:26:29] sarkis: yw, next.
[03:27:00] sevenseacat: sarkis: but then who will actually devote all their time to helping people? you?
[03:27:24] sarkis: if i do, i wouldn't have to tell everyone about it
[03:27:47] sarkis: since noone really cares :>
[03:28:19] sarkis: you want to waste your time in here, power to you, just stfu with the side commentary.. let people actually help others
[03:28:20] sevenseacat: i'll remember that.
[03:29:14] Scient: "easy fix" lol
[03:29:19] Scient: doing it wrong is not an "easy fix"
[03:31:18] jake_g: I guess maybe my question is more basic. What determines the format of a POST request? Is it the accept parameter in the request headers?
[03:34:17] bricker`LA: Has anybody else seen bundler hang on ruby 2.x in Yosemite?
[03:34:21] bricker`LA: `bundle install`, that is
[03:35:32] nahtnam: sevenseacat: Got it! @data["stat"]["active"]
[03:35:59] sevenseacat: nahtnam: :) now will your json always have the `stat` key in it?
[03:36:09] nahtnam: sevenseacat: Yes.
[03:36:57] nahtnam: sevenseacat: Its fetched from somewhere outside
[03:52:09] jitendravyas: Is there any rails gems which convert all .js files into .coffee files in pre-compilation process?
[03:52:42] scott0101: Hi, I???m wondering if its possible to use a splat and a optional parameter in a method signature? I seem to be able to do one or the other but not both
[03:52:51] coreycondardo: if I have a model (post) which has a member (votes) what is the magic that make self.votes.where(vote: true).size work? Specifically, I want to grab a single instance of a vote in the model, but I can only seem to grab all the votes on the post via self.votes.
[03:54:23] heath: i created this for a company last week: https://github.com/heath/rails_challenge
[03:54:29] heath: it has one model, an event
[03:55:25] heath: the thing i'm really wanting to do is get vroom working in vim, so i figure this is a good little thing to play with
[03:55:38] sevenseacat: coreycondardo: you might have to clarify what youre actually trying to do
[03:55:43] sevenseacat: your Vote model has a vote property?
[03:55:43] heath: however, i'm running into this https://i.imgur.com/zSFDTsd.png
[03:56:59] sevenseacat: heath: theres no problem there
[03:57:01] coreycondardo: sevenseacat: correct, which returns a boolean. im making a simple reddit clone. i want to mark an up arrow red if the user has alreayd voted. to do that i need to say somethign like ???if the user has alreayd voted on this, mark it as red??? but i cant seem to figure out how to get the specific instance of that vote in order to comapre whether the current user has voted on it or not
[03:57:07] sevenseacat: save will never raise an exception under normal behaviour
[03:57:26] heath: oh i suppose i should mention, i added validates :name, presence: true
[03:57:31] heath: into the events model
[03:57:41] heath: sevenseacat: it should raise an error though
[03:57:45] sevenseacat: no it shouldnt
[03:57:58] mozzarella: heath: I think you're looking for save!
[03:57:59] heath: it doesn't a name
[03:58:05] sevenseacat: it just returns false, as your console showed
[03:58:19] sevenseacat: save! will raise an exception if it fails
[03:59:36] sevenseacat: coreycondardo: ok, so your Vote model has a vote attribute
[03:59:48] coreycondardo: sevenseacat: thats right.
[03:59:56] sevenseacat: @post.votes.where(vote: true) will get you all votes that have vote: true
[03:59:59] coreycondardo: and its polymorphic
[04:00:03] sevenseacat: whats your problem?
[04:00:50] mozzarella: heath: what's the name of that font, btw?
[04:00:54] coreycondardo: sevenseacat: that works fine, however that gives me them all. i want to do is simply display true or false on the front-end if that user has voted already
[04:01:16] sevenseacat: coreycondardo: so you also want to query votes on the user_id associated with the vote, not just the vote value?
[04:01:22] coreycondardo: sevenseacat: http://coreycodes-postit.herokuapp.com/ you can see there are arrows, i just want to make the arrow different if there is alreayd an upvote
[04:01:29] coreycondardo: well you???d have to login :(
[04:01:34] sevenseacat: to see if the current user has voted?
[04:01:35] coreycondardo: which u can do but i dont wana take all ur time :)
[04:01:43] heath: mozzarella: either sauce code or monaco
[04:02:02] coreycondardo: sevenseacat: yes. i need to grab the vote itself, the compare the user_id that created it with the logged in user
[04:02:03] sevenseacat: looks like monaco to my untrained eye
[04:02:18] coreycondardo: and i have the method to determine the current user
[04:02:22] sevenseacat: coreycondardo: so the result of your where clause is an array of votes
[04:02:30] coreycondardo: that???s right
[04:02:30] sevenseacat: all of the upvotes, i presume
[04:02:32] w32stuxnet: If I have a controller called FlightWizard, with an attached flight_wizard.js.erb and an action called create, with associated create.html.erb
[04:02:43] sevenseacat: so... whats stopping you adding the user_id query
[04:02:54] heath: ah, silly me, you're right, thanks sevenseacat
[04:03:03] w32stuxnet: can I dynamically create the flight_wizard.js file and access the required instance variables?
[04:03:06] heath: mozzarella: thanks for pointing out save! as well
[04:03:23] Inside: theoretically speaking, if I wanted to create mulitple lists of multiple items then the best way to do that would be to have a List model and then a ListItem model?
[04:03:28] sevenseacat: w32stuxnet: 'dynamically create'?
[04:03:34] coreycondardo: sevenseacat: so if i do that, i???ll get an array of all the votes that belong to that user right?
[04:03:42] sevenseacat: for that post
[04:04:00] w32stuxnet: well.. I don???t want to respond to JS, I want to respond to HTML??? But have the controller???s JS asset also be constructed with <%= %> tags
[04:04:15] sevenseacat: eg. `@post.votes.where(vote: true, user_id: current_user)`
[04:04:19] w32stuxnet: or do I have to migrate all the JS to the html.erb file?
[04:04:31] sevenseacat: w32stuxnet: controllers don't typically have their own js assets.
[04:04:48] w32stuxnet: each one appears to have its own js.coffee file generated automatically by the scaffolder
[04:04:59] w32stuxnet: so that???s where my misunderstanding appears to be coming from
[04:05:02] sevenseacat: fuck the scaffolder
[04:05:59] coreycondardo: sevenseacat: i???m running some rails console / testing
[04:06:04] coreycondardo: sevenseacat: hang tight - really appreicate your help :)
[04:06:36] coreycondardo: sevenseacat: okay so if i put all that togther and dump it out onto my post partial
[04:06:47] coreycondardo: i get back a post object, correct?
[04:06:53] sevenseacat: no, you'll get back a relation of them
[04:07:00] coreycondardo: oh yes, i see that
[04:07:03] coreycondardo: #<ActiveRecord::Relation::ActiveRecord_Relation_Vote:0x007f9e5e37f628>
[04:07:04] sevenseacat: all of the votes where vote: true, user_id: blah, post_id: blah
[04:07:17] sevenseacat: which in theory should only be one, but you never know
[04:07:28] coreycondardo: right, in my case it???s one I believe.
[04:07:43] coreycondardo: so now that i have that, should i do a .size on that or somethign to figure out if it exists or not?
[04:07:45] sevenseacat: you might allow multiple votes, in which case there might be more than one >_>
[04:07:51] sevenseacat: coreycondardo: try .any?
[04:08:32] sevenseacat: http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-any-3F
[04:08:36] coreycondardo: i need to process this lol
[04:08:49] siwica: what is the different of "name:string" and "name:string:index"?
[04:09:04] sevenseacat: look at all the cool stuff you can do with an AR::Relation
[04:09:09] sevenseacat: siwica: the latter adds an index on the field
[04:09:27] sevenseacat: create migrations with both and see the difference :)
[04:09:53] siwica: sevenseacat: but what is an index on a field?
[04:10:01] coreycondardo: so say i want to make that a helper. since that is a data based thing, it can go into the post model correct?
[04:10:09] sevenseacat: siwica: http://en.wikipedia.org/wiki/Database_index
[04:10:34] sevenseacat: coreycondardo: yes, you could create a nice method in your model eg. @post.upvoted_by?(current_user)
[04:11:11] coreycondardo: okay that makes a lot of sense.
[04:11:21] coreycondardo: so my last question is, what thing have i done so that post.votes works
[04:11:22] siwica: sevenseacat: ok, thanks! That makes sense :)
[04:11:35] coreycondardo: is that part of the polymorphic relationship i setup?
[04:11:40] sevenseacat: coreycondardo: added an association in your Post model to the votes
[04:11:44] coreycondardo: or rather the has_many votes
[04:11:47] sevenseacat: eg. Post has_many :votes
[04:11:52] coreycondardo: has_many :votes, as: :voteable
[04:12:08] coreycondardo: so inherently, anything that has many, can always do .whatevers
[04:12:13] coreycondardo: parent.children
[04:12:13] sevenseacat: the polymorphic as part means you could also go @vote.voteable and get the post back
[04:12:42] sevenseacat: http://guides.rubyonrails.org/association_basics.html#has-many-association-reference look at what you get by declaring the association
[04:12:43] coreycondardo: okay that helps a lot. now i understand i can run those chains together
[04:13:47] coreycondardo: so collection.empty? translates to post.votes.empty?
[04:14:08] coreycondardo: this was enormously helpful. thanks a lot!
[04:14:10] sevenseacat: there are examples of each method a bit further down the page
[04:14:41] coreycondardo: yea this makes a lot of sense in context :)
[04:15:29] coreycondardo: have a great night :) / day depending where you are
[04:15:37] sevenseacat: thanks, you too :)
[04:17:58] coreycondardo: hmm??? so i can???t grab the current_user method from my application_controller.rb inside of my posts.rb
[04:18:18] coreycondardo: which makes sense
[04:18:35] coreycondardo: even though its a helper method
[04:18:42] sevenseacat: the model has no access to your controller methods ,no
[04:19:41] sevenseacat: which is why i suggested passing the user in, eg. @post.upvoted_by?(current_user) - that also makes the method reusable, eg. you could see down the track which of your friends has also upvoted a post
[04:20:29] sevenseacat: or if a friend has also upvoted for a post, rather
[04:20:35] sevenseacat: given it returns a boolean
[04:21:38] coreycondardo: so i define the current_user at the view level using application helpers, and pass that into the method, which is triggered in the post model
[04:22:02] sevenseacat: current_user is typically defined as a helper method at the controller level
[04:22:58] coreycondardo: right, which it is. in my vierw though i have this: <%= post.has_voted?(current_user) %><br>
[04:23:19] coreycondardo: which works, now i can use that to change things around on the front-end :)
[04:23:30] sevenseacat: you're calling a method on your model, and passing it the result of calling the helper method as an argument
[04:23:52] coreycondardo: how come we put help methods like tha tin the applicaiton controller?
[04:23:56] coreycondardo: and not in like a user model or something
[04:24:06] sevenseacat: so it's accessible to your controllers and views
[04:24:24] coreycondardo: otherwise it???s only accessible on the instance of the object itself
[04:24:29] sevenseacat: your model doesnt understand the concept of a current user - if only makes sense in terms of the controller interface
[04:24:31] coreycondardo: which isn???t particularly useful
[04:24:49] coreycondardo: great this is awesome
[04:24:54] coreycondardo: im really leaving this time :)
[04:32:33] sevenseacat: fffffffff partials that use instance variables
[04:32:42] sevenseacat: ACTION glares daggers at the spree people
[05:11:04] Radar: sevenseacat: dealwithit.gif
[05:11:27] sevenseacat: ACTION glares daggers at Radar
[05:11:35] Radar: sevenseacat: which partial?
[05:12:39] sevenseacat: https://github.com/spree/spree/blob/master/frontend/app/views/spree/products/_thumbnails.html.erb
[05:13:02] sevenseacat: though its not alone, its just the first ive wanted to modify
[05:22:57] Radar: yay I didn't write that
[05:34:43] Spami: Any idea how I could write a system to have email preview from email template with real DB data ?
[05:35:00] Spami: kinda hard to explain.
[05:35:26] rvanlieshout: if you can't explain what you need you're really not going to be able to build it
[05:38:27] sevenseacat: ACTION uses deface to change what gets rendered in the partial
[05:42:12] TheTopBloke: I've got a question regarding the rails tutorial. I'm doing the article tutorial, and now getting an error, no method 'title'. But I've check rake routes, the show.html.erb, and the .rb file, and everything looks as it should. Everything prior to this point in the tutorial has worked just fine.
[05:42:32] sevenseacat: and the error, logs, etc?
[05:43:14] TheTopBloke: undefined method `title' for nil:NilClass
[05:43:35] TheTopBloke: but title isnt a method. its just a variable, a string. entered into a db.
[05:43:48] TheTopBloke: the show.html.erb is supposed to display the newly created blog article.
[05:44:00] sevenseacat: we kinda need to see your code.
[05:44:25] TheTopBloke: class ArticlesController < ApplicationController
[05:44:25] TheTopBloke: @article = Article.new(article_params)
[05:44:26] TheTopBloke: @article.save
[05:44:27] TheTopBloke: redirect_to @article
[05:44:33] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[05:44:49] TheTopBloke: indeed. ok one sec I get it up to github
[05:46:28] TheTopBloke: https://gist.github.com/anonymous/36f8ca57a73d8a2afbb9
[05:47:00] sevenseacat: TheTopBloke: your show action is private. it shouldnt be.
[05:47:11] sevenseacat: move it above the `private` line.
[05:47:20] TheTopBloke: Ah... of course!
[05:48:34] TheTopBloke: Yep, that did it. Thanks!
[05:48:58] sevenseacat: now do you know why that fixed it?
[05:57:47] TheTopBloke: Yeah... it the order in which it is listed down the script. Which I hadn't considered simply because of all the 'end' comments.
[05:58:02] TheTopBloke: I guess I figured it didnt matter.
[05:58:11] TheTopBloke: But obviously it does.
[05:58:49] sevenseacat: rails has a nice feature in that if you have a view for an action, you dont actually need to define the action itself
[05:59:05] sevenseacat: because your show action was private, rails couldnt see it
[05:59:19] sevenseacat: but the view was there, so it filled in the gaps and rendered the view
[06:02:23] TheTopBloke: Oh I think I see what you mean now.
[06:03:05] TheTopBloke: So you could technically list private def's at the top of the .rb file. So, how would you close out the private section of the .rb file if you chose to do it that way?
[06:03:45] TheTopBloke: And I'm assuming everything is public by default because it is not defined as private or public.
[06:03:51] EasyCo: Just redeclare your next scope
[06:03:53] TheTopBloke: I mean everything else
[06:04:02] EasyCo: private public private protected public
[06:04:20] TheTopBloke: Ok, so I put private up top, and define some stuff, and then I'd just have to say public and then define some more stuff and that would be public
[06:04:44] TheTopBloke: so whats best practice then? just listing everything public at the top, or actually declaring it?
[06:04:56] EasyCo: it's public by default
[06:05:00] sevenseacat: put private methods below the private keyword
[06:05:04] sevenseacat: put public methods above it
[06:07:58] Radar: TheTopBloke: I've not seen a legitimate use of the public keyword in Ruby... ever.
[06:08:08] Radar: and I've been doing Ruby for about 9 years :)
[06:08:30] EasyCo: You should just round it up to 10, it sounds better :)
[06:12:01] tagrudev: validate: false is not working for rails 4 ?
[06:12:46] helpa: tagrudev: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[06:12:46] Radar: tagrudev: !e
[06:18:54] tagrudev: Radar, nah trying to update an email from the console in an old project save! returns true but the email isn't saved
[06:19:05] tagrudev: same goes for .save validate: false
[06:20:08] sevenseacat: you're doing something wrong
[06:22:16] tagrudev: yeah I figured that out
[06:22:36] tagrudev: the project uses devise
[06:23:08] EasyCo: When you ActiveRecord::Persistence#save a record using nested attributes, is there a best practice approach for performing additional tasks on the nested record after the save operation?
[06:32:45] tagrudev: @user.skip_reconfirmation!
[06:32:48] tagrudev: that's what I needed
[06:42:17] Macaveli: How do you guys make an unvailable or a maintenance page? I have the page but how do you set all your routes to that page?
[06:48:33] Spami: I'm getting: wrong number of arguments (0 for 4) on a line like this <%= form_for Template.new do |f| %>, i'm not sure when I'm doing wrong
[06:48:59] rvanlieshout: passing in the wrong number of arguments
[06:49:08] rvanlieshout: and not on that line
[06:49:10] sevenseacat: you need 4, and are passing in 0
[06:49:16] sevenseacat: full error+logs plz
[06:49:44] codecodecode123: can somebody explain why devise raises a NoMethodError whenever i run any rails command? this happens when i have a devise model in my application. (the errors: http://pastie.org/9506146, my User class: http://pastie.org/9506155)
[06:50:12] codecodecode123: if anything else needed, ill give it to you
[06:50:16] Spami: sevenseacat, https://gist.github.com/anonymous/a496e44906ca29c578e1
[06:51:13] rvanlieshout: codecodecode123: because devise isn't defined
[06:51:39] codecodecode123: doesnt the gem define it?
[06:52:19] rvanlieshout: is it loaded?
[06:52:19] codecodecode123: the devise model generator generated that model. the only thing i did was add "has_many :tweets"
[06:53:14] codecodecode123: its in my gemfile, and i ran "bundle install" too
[06:53:34] rvanlieshout: so it works without that line?
[06:54:26] codecodecode123: because if it wasnt in gemfile of course it wouldnt work
[06:55:13] codecodecode123: *sigh* devise is my definition of HELL
[06:55:22] rvanlieshout: never had issues with it
[06:55:29] rvanlieshout: so a rails console won't work?
[06:55:52] sevenseacat: i have, but not like this
[06:56:11] codecodecode123: oh, rails c worked
[06:58:20] Spami: sevenseacat, any idea ?
[06:58:26] helpa: Do not beg / plead with people to help you. This includes asking questions like "Any ideas?" after posting your original question.
[06:58:51] sevenseacat: Spami: so does Template.new require 4 arguments, or does manage_admin_templates_path?
[06:58:55] Radar: Template there is probably ActionView::Template, and not the Template class that you're expecting.
[06:59:01] Radar: Spami: Reference it as ::Template
[06:59:19] sevenseacat: good spotting
[06:59:36] Spami: Oh, Template is a reserved word
[07:05:27] codecodecode123: OH STUPID STUPID ME!
[07:06:04] codecodecode123: class User inheits from activerecord::base!
[07:06:15] codecodecode123: but its devise!
[07:06:44] sevenseacat: User should be an activerecord class
[07:06:55] codecodecode123: its devised tho
[07:07:27] codecodecode123: shouldnt it inherit from devise classes
[07:07:52] codecodecode123: oh wait that was Sessions contoller
[07:08:14] codecodecode123: OH STUPID STUPID STUPID ME!
[07:08:46] _tpavel: hey guys, anyone familiar with the Doorkeeper gem?
[07:11:16] helpa: _tpavel: 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.
[07:11:16] Radar: _tpavel: !used
[07:13:42] _tpavel: ok, right. I'm creating an API that will be consumed by native mobile apps. I'm using OAuth2 for authentication with Doorkeeper and Devise for login/register.
[07:15:26] _tpavel: I want to expose the devise registration to an action in the API and that of course needs to be accessed without an access token. However, I still want to check the APP_ID and SECRET and restrict access based on those. I wasn't able to find out Doorkeeper does that check when requesting an access token
[07:17:03] _tpavel: it's a matter of checking the DB for matching APP_ID and SECRET, but I was wondering if there is a simple hook from Doorkeeper
[07:22:52] Nameo0: Hello, I was wondering what an index does in database migrations?
[07:23:53] sevenseacat: Nameo0: : http://en.wikipedia.org/wiki/Database_index
[07:24:00] Nameo0: thank you. =)
[07:24:01] sevenseacat: second time ive used that link today
[07:24:10] sevenseacat: just the first part is probably meaningful for now
[07:25:25] arup_r: I am not getting the tiny diff between :path and :url in paperclip gem
[07:25:54] sevenseacat: probably the same as the difference between a path and a url in a rails route
[07:27:45] arup_r: http://rubydoc.info/gems/paperclip/Paperclip/ClassMethods
[07:28:00] arup_r: I am reading this,,, but :path is not mentioned here
[07:28:47] sevenseacat: then where is path mentioned?
[07:30:18] arup_r: https://github.com/thoughtbot/paperclip#understanding-storage
[07:31:48] sevenseacat: so path is the path on the server, eg /var/vhosts/whatever/blah blah blah
[07:32:03] sevenseacat: url is the url from your server, either a fully qualified URL or not
[07:32:43] rrawlins: Nameo0: Unless you have a specific issue with slow-running queries on your DB I wouldn't worry too much about the indexes. No use spending time optimising for something which might never happen.
[07:33:33] sevenseacat: rrawlins: it's still good to know what they are and the basics of when to use them.
[07:33:57] arup_r: Ohh! I see
[07:34:46] rrawlins: sevenseacat: agreed, but the risk is that you feel tempted into playing with them and end up creating more problems than you solve.
[07:34:59] codecodecode123: sevenseacat: i didnt run "rails g devise:install" didnt i
[07:35:10] sevenseacat: oh yeah they can cause horrible problems if you just go applying them blindly
[07:35:18] sevenseacat: codecodecode123: whoops :P
[07:36:58] codecodecode123: sevenseacat: de??vi??s??e i??s ??m??y?????? H??E????L????????L??????,
[07:37:06] sevenseacat: ACTION blinks
[07:48:00] Giorgio: Hello how to allow params that contain hash with arrays
[07:49:04] Giorgio: {"utf8"=>"???", "budget"=>[{"account_id"=>"10", "wunit"=>"", "budget_date"=>"2014-08-27", "ammount"=>"", "text"=>""}, {"account_id"=>"12", "wunit"=>"", "budget_date"=>"2014-08-27", "ammount"=>"", "text"=>""}, {"account_id"=>"7", "wunit"=>"", "budget_date"=>"2014-08-27", "ammount"=>"", "text"=>""}, {"account_id"=>"18", "wunit"=>"", "budget_date"=>"2014-08-27", "ammount"=>"", "text"=>""}, {"account_id"=>"", "wunit"=>"", "budget_date"=>"2014-08-27", "am
[07:49:04] Giorgio: mount"=>"", "text"=>""}], "commit"=>"POST"}
[07:52:41] universa1: the docs for strong parms should cover that.
[07:52:58] sevenseacat: if you have a question after reading the docs, please try again.
[08:02:29] Giorgio: ive readed and tryed params.permit(budget: [])
[08:02:37] Giorgio: but still didnt work :(
[08:03:59] MickeySoFine: I've been given a project with a app/themes folder in it, I've not see that used so far, anyone know what gem uses that, or if its part of rails?
[08:04:05] sevenseacat: didnt work isnt something we can help with, sorry
[08:04:41] rvanlieshout: MickeySoFine: it's not part of rails
[08:05:07] MickeySoFine: didnt think it was, any ideas what it is part of?
[08:06:00] MickeySoFine: aha! themes_on_rails! lol
[08:12:38] mikecmpbll_: can't connect to freenode through textual client atm :/
[08:13:03] mikecmpbll: oah, yes i can
[08:41:02] codecodecode123: how can i use cancan for mutiple devise models?
[08:45:17] leex: Is there a way to customize ransacks search parameters so that the get request isn't so ugly: http://ransack-demo.herokuapp.com/users?utf8=%E2%9C%93&q%5Bfirst_name_or_last_name_cont%5D=block&q%5Bemail_cont%5D=&q%5Bposts_title_cont%5D=&commit=Search is just awful... I would like to get rid of the utf8 thing and then all the q[]s and just send .../users?name=block
[08:51:23] muhammadn: can i redirect_to from my controller to the page's DOM class (for example, bootstrap's class="active") from the controller?
[08:53:00] sevenseacat: you could redirect to an anchor on the target page.
[08:54:14] muhammadn: sevenseacat: for example, i am using this: http://getbootstrap.com/components/#nav-tabs
[08:54:23] sevenseacat: see how they redirect to an anchor :P
[08:55:14] kies: leex, does it need to be a get? i would prob just change it to a post instead
[08:59:06] leex: kies: well, for SEO and sharing of link reasons yes...
[09:01:22] leex: kies: is there a way to customize the parameters and drop the utf8=????
[09:01:51] sevenseacat: not that i know of
[09:01:58] sevenseacat: i liked it bewtter when it was the snowman
[09:02:43] kies: utf8 is for ie isnt it?
[09:03:08] leex: rvanlieshout: because I want my users to be able to share search links with each other
[09:03:44] leex: rvanlieshout: well, therefore I need to use GET and not POST
[09:03:59] rvanlieshout: and how is this related to that utf thing?
[09:04:50] leex: rvanlieshout: I don't care so much about the utf8 thing, what I realy care about is shorter more readable search params
[09:05:15] rvanlieshout: i prefer that it would work over short
[09:05:19] rvanlieshout: there are services for short
[09:05:33] leex: rvanlieshout: so that it isnt q[w/e]=...
[09:05:33] rvanlieshout: and they are most likely going to copy paste that
[09:06:10] kies: leex, edit your form field names to be shorter or use a link shortener
[09:06:49] leex: kies: and then map them interally to the correct ransack parameters?
[09:07:45] rvanlieshout: and you expect the users to type in there q=foobar&w=1&e=x
[09:07:46] leex: kies: ok, I will do that, just thought there might already be a handy way in ransack
[09:07:49] rvanlieshout: over copy pasting the url?
[09:08:10] leex: rvanlieshout: no, I think you misunderstood me
[09:08:22] rvanlieshout: yeah.. so it seems
[09:08:27] rvanlieshout: why the need for the shorter url?
[09:08:31] yottanami: How can I access the Rails application url namespace from my engine ?
[09:08:44] leex: rvanlieshout: I don't want my URLs to look like this: http://ransack-demo.herokuapp.com/users?utf8=%E2%9C%93&q%5Bfirst_name_or_last_name_cont%5D=block&q%5Bemail_cont%5D=&q%5Bposts_title_cont%5D=&commit=Search where it would just need to be http://ransack-demo.herokuapp.com/users?name=block
[09:09:10] rvanlieshout: that utf8 part is there for a good reason.. i would keep it there
[09:09:34] rvanlieshout: you're free the name the other params whatever you want
[09:09:44] rvanlieshout: but nobody is going to type in the url.. so why does it matter?
[09:09:47] leex: rvanlieshout: ok
[09:10:50] leex: rvanlieshout: because I will have quite some search params and I dislike long urls ;)
[09:11:00] kies: url shortener would prob be nicer, prob a gem that can do it for you
[09:11:07] rvanlieshout: i dislike extra code to prevent shorter urls when it doesn't really matter
[09:15:00] leex: rvanlieshout and kies thanks for the help
[09:17:51] sonOfRa: I'm writing an LDAP management tool, and I'm having some problems creating URLs for mail aliases. They sometimes contain periods in their IDs, such as givenname.surname. Now, when I try to access /aliases/givenname.surname, rails interpretes "surname" as a format specifier, and "givenname" as an ID. What's the right way to prevent this from happening?
[09:18:07] sonOfRa: There are no numeric IDs by which aliases could be identified
[09:20:39] advorak: I am using backburner and am having trouble understanding why only the first option is passed to the make_person method: https://gist.github.com/advorak/8bb60de5071d9756e167
[09:21:00] universa1: sonOfRa: a custom format definition on the route might help.
[09:21:04] advorak: the guid: '12345' hash is not passed as a second argument for make_person when I use async ..
[09:22:15] universa1: advorak: your guid is not passed in your first example either: "test" vs "12345"
[09:23:33] advorak: universal: sorry I pasted the wrong thing into my code. I updated the example and the problem still stands: https://gist.github.com/advorak/8bb60de5071d9756e167
[09:24:15] universa1: advorak: o0. manually editing...
[09:24:24] universa1: smells like you're not showing the full code.
[09:25:13] advorak: universa1, In my database I'd done make_person with 'test' as the guid ... I pasted that one in error ..
[09:25:41] advorak: universa1, this is the code I created in a barebones rails app to demonstrate a problem I am not understanding with some larger code ..
[09:25:44] universa1: advorak: your line 6 is not the result of your line 5.
[09:26:14] universa1: in your gist, it might be, but it might also not be.
[09:27:06] advorak: universa1, I updated the gist to satisfy your concerns.
[09:27:32] advorak: universa1, so it most definitely is ;-)
[09:29:05] vedu: Hello. Is there a place for rails or bootstrap views/partials? For common things like Sign In/Sign up?
[09:29:36] universa1: advorak: :-)
[09:30:10] universa1: advorak: haven't used backburner, maybe it can't use hash arguments ;)
[09:30:42] universa1: advorak: or well: try: make_person("Someone", {guid: "fancy"})
[09:30:43] greengriminal: Guys so check this out i was having an issue whereby a member was having their mobile_prefix set to +44. Mind you the codebase I am working on is VERY large and also contains some legacy stuff. So i came across a migration that is as followed: add_column :members, :mobile_prefix, :string, :limit=>4, :default=>get_phone_locale
[09:31:19] advorak: universa1, I have done that, too. I will update my gist to provide the evidence ;-)
[09:31:23] greengriminal: how on earth can you set :default => get_phone_locale
[09:31:39] mikecmpbll: is get_phone_local a method defined in the migration?
[09:31:42] greengriminal: what I'm trying to say is i NEVER knew you could call a method on default!
[09:31:50] mikecmpbll: greengriminal: you can't.
[09:31:56] greengriminal: Evidently you can.
[09:32:02] mikecmpbll: evidently you can't.
[09:32:06] vedu: Hello. Is there a place for rails or bootstrap views/partials? For common things like Sign In/Sign up?
[09:32:14] greengriminal: mikecmpbll: I will look back into this.
[09:32:16] universa1: vedu: app/views.
[09:32:18] mikecmpbll: yeah, do so.
[09:32:48] universa1: greengriminal: the get_phone_locale method is just called there, and returns some value, which is then used as the default value....
[09:32:49] vedu: universa1: I meant predefined themes that could copy and use in my app
[09:32:55] universa1: vedu: google ;)
[09:32:55] helpa: vedu: Don't repeat yourself. Asking the same question repeatedly will not give you more answers.
[09:33:07] universa1: vedu: wrapbootstrap for example.
[09:33:08] greengriminal: universa1: Yes it calls a method and sets a value
[09:33:22] advorak: I'm certain it's something about how backburner works that I don't understand: Work job Person with [nil, "make_person", "Andy", {"guid"=>"test"}]
[09:33:22] vedu: helpa: I thought it didn't get posted. sorry for spamming
[09:33:35] greengriminal: mikecmpbll: That's what I meant to say sorry. It calls a method and sets a value.
[09:33:44] mikecmpbll: greengriminal: well, yeah. that's ruby.
[09:33:45] advorak: so the information is being sent to and received by backburner, but it's not calling the method with my options :-P
[09:33:48] greengriminal: Thank you universa1. Still slightly mind blowing!
[09:33:51] mikecmpbll: methods, calling methods. etc
[09:33:58] mikecmpbll: nowt special.
[09:34:00] greengriminal: Because i was a fraction to ripping my hair out
[09:34:15] greengriminal: not that i have any :P
[09:35:18] vedu: mikecmpbll: I couldn't figure what exactly to google. For example "rails partial view for login" got me no results :(
[09:35:32] mikecmpbll: vedu: i've no clue what you're trying to understand tbh
[09:35:57] advorak: Looks like backburner isn't liking my hash and can handle single arguments ...
[09:36:08] mikecmpbll: you put partials in subdirectories of app/views, based on what part of the app they belong to
[09:36:12] advorak: er even multiple arguments, but no hash ..
[09:36:54] rrawlins: Anyone got any best-practice guides/advice on namespacing of models?
[09:36:54] mikecmpbll: vedu: if it's sign in or sign up, and you have a sessions controller to handle those actions, then the partials will go in app/views/sessions/
[09:37:17] vedu: I am using devise
[09:37:19] mikecmpbll: rrawlins: don't do it for no reason.
[09:37:59] rrawlins: mikecmpbll: :-) what's the definition of 'no' reason.
[09:38:35] mikecmpbll: rrawlins: not sure how i can elaborate on that :p
[09:39:08] mikecmpbll: why don't you tell us why you want to namespace stuff?
[09:39:52] Radar: +1 mikecmpbll
[09:40:17] Radar: Namespacing can make sense of logical groupings of models, but it's rarely useful
[09:40:24] rrawlins: haha fair enough :-) Basicly I have models which only relate to a single parent model...
[09:40:28] yottanami: I am in my engine and I used a route path in my view and I got error undefined method `categories_path'
[09:40:55] yottanami: How can I access url name space from my engine
[09:41:16] mikecmpbll: i've found you don't really gain a great deal by namespacing models in to logical groups. unless there's a programmatical reason i tend to avoid.
[09:41:22] rrawlins: i.e. I have a model called Brand, which has a Logo - nothing else in the app has a logo. Should this model be called 'Logo' of 'BrandLogo' or 'Brand::Logo'?
[09:42:04] mikecmpbll: or BrandLogo, i guess, neither here nor there.
[09:42:47] rrawlins: My desire to do so is just organisational. as the number of models grow I'd like to group them in logical sub-directories.
[09:42:59] mikecmpbll: we have about 60 models and they aint namespaced. never bothered me greatly.
[09:43:12] rrawlins: mikecmpbll: that's good to know.
[10:10:21] MickeySoFine: I'm trying to parse a text file with space delimited text in columns, is there a robust way of detecting columns?
[10:10:49] codecodecode123: how can i use cancan for mutiple devise models?
[10:14:09] frank_o: Hi! I'm using Kaminari's `link_to_next_page` with some jQuery to do some kickass infinite scrolling - but it seems every now and then there are some duplicated items: https://gist.github.com/frankie-loves-jesus/d64c9ec7838ccd1cfae9 -- might anyone be able to spot the problem?
[10:16:19] mikecmpbll: frank_o: would be good if you narrowed it down a bit at least. is the same page being requested multiple times, is the server returning duplicated data? etc
[10:18:33] frank_o: mikecmpbll: will do thanks
[10:37:20] cesarediaz: hi people, how can I save in a :text MySql field a hash value directly from params? and lately read it as a hash too?
[10:38:05] mikecmpbll: cesarediaz: http://apidock.com/rails/ActiveRecord/AttributeMethods/Serialization/ClassMethods/serialize
[10:39:01] cesarediaz: mikecmpbll: many thanks man!
[10:45:14] frank_o: mikecmpbll: negative on both those accounts. when paginating manually without the JS there is no duplicated data
[10:45:23] frank_o: mikecmpbll: #jquery then?
[10:45:46] mikecmpbll: so it's being requested multiple times then?
[10:45:56] mikecmpbll: look in your browsers requests, or in your server logs
[10:46:08] mikecmpbll: other alternative is it's being rendered multiple times.
[10:47:01] frank_o: mikecmpbll: I doubt its being requested multiple times as that would cause all the items on the various pages to become duplicated
[10:47:19] frank_o: Right now per page or per two pages it's only 1 or 2 duplicated items. will check my browser reqs
[10:47:37] mikecmpbll: it really can't be that hard to narrow down the area of the cause.
[10:47:53] mikecmpbll: you can inspect the data that is being returned, see if it's duplicated there
[10:48:11] mikecmpbll: if no, then you know it's not a server side problem and you've just at least halved your problem scope.
[10:58:19] frank_o: mikecmpbll: Turns out i need a check in the JS to make sure it doesnt try to load items while existing items are already being loaded
[11:08:41] tagrudev: almost Friday
[11:09:11] frank_o: Say one is running Radar's Forem (https://github.com/radar/forem) -- would upgrading to the Rails 4.2.0 beta with Adequate Record be likely to speed things up?
[11:15:08] matcouto: Guys, what'd be the best approach to populate a list after creating an object via ajax? I'm not redirecting to any page after saving, but re-rendering the partial that contains the list iterating? Should I considerer callbacks(i.e:after_create :reload_list) ?
[11:16:39] mikecmpbll: matcouto: return the data from the controller and add it to your list.
[11:21:08] Radar: frank_o: It might :)
[11:21:18] Radar: frank_o: I've not heard of anyone using Rails 4.2.0.beta with Forem yet
[11:21:27] Radar: But it's not like I get emails every time someone upgrades it,
[11:22:29] matcouto: mikecmpbll What if I render :index after successfully saving, create an index.js.erb that renders the partial and sends the list via locals:
[11:23:08] mikecmpbll: yep you can do that
[11:23:26] mikecmpbll: some developers prefer to do that stuff in "assetted" javascript
[11:23:35] mikecmpbll: rather than sending javascript in the response, but i'm not too fussy.
[11:24:29] matcouto: mikecmpbll cool. thanks.
[11:24:44] frank_o: Radar: Super cool, thanks man
[11:25:15] matcouto: but anyway, would you have any example of yours?
[11:30:40] awestroke: is capistrano still the way to go for deploying?
[11:31:39] Radar: frank_o: looks like Devise is not happy
[11:32:01] Radar: Attempting to gist before arriving at train station...
[11:32:09] Radar: https://gist.github.com/radar/023a8842305d833f5b38
[11:35:45] frank_o: Radar: Ouch, not goodie good
[11:36:05] frank_o: My livelihood depends on devise so
[11:36:18] frank_o: later Radar
[11:37:21] frank_o: Radar: btw should something like http://runnable.com/U9Qwd84r1EkCqrKA/basic-forem-demo be added to the README?
[11:37:26] frank_o: Radar: sleep on it, tata!
[11:45:42] jokke: i'm still working on my rails engine
[11:46:00] jokke: and i'm getting an error undefined method devise_controller?
[11:46:15] jokke: it might be a namespace issue
[11:47:17] jokke: https://gist.github.com/jreinert/66762feeb9fb09b1b85f
[11:47:52] shlomo: Does anyone know how prevent multiple emails sent to the same address from appearing in the same thread (second emails shown as response to first one) or can point me to a resource about email threading? I'm sending emails through SendGrid to a gmail account
[11:48:31] yottanami: I used acts-as-taggable-on in my project and my code is @advertises = Advertise.tagged_with(params[:tag]) but there is duplicate in output, how can I debug it ?
[11:53:02] jokke: i was missing a : in front of devise_controller?
[11:58:39] krz: shlomo: doesnt that depend on the email client?
[11:59:46] gavit: .build used populate the caller with a new instance. Did this change? I seem to be getting nil for my delivery_line after clicking on submit. See-> https://gist.github.com/gavit/fa0996e0aef7b5eb5762#file-material_received_reports_controller-rb-L46 Somehow when I go to the edit page the order_line is not nil ( i get values for f.object.order_line.item.product_number), but when I submit, I get an error that the order_line is 'nil'. What am I missing?
[12:00:55] shlomo: krz: probably, but I am wondering if there is some SMTP header or something that determines if an email is a response to another one
[12:03:38] krz: shlomo: tell your clients to use mutt
[12:03:47] krz: that will always ensure a new thread
[12:06:25] shlomo: krz if I don't find a better solution
[12:06:56] jokke: another thing though: devise is always redirecting me to the sign in page
[12:07:04] jokke: even after just signing in
[12:12:07] jokke: ah fixed it
[12:17:18] cesarediaz: people, is possible to put an string multiline using haml? how can I do that?
[12:21:09] tagrudev: :D :D :D http://9gag.com/gag/aEG12Ko?ref=fb.s
[12:29:09] zelrik: People still use the imperial system?
[12:39:55] awestroke: People still use gasoline cars?
[12:45:00] zelrik: more like people still use cars?
[13:38:21] ryannielson: I have a Organization model that has many users. In my view I have a list of organization users sorted by name, and another list of organization users sorted by joined date. Should I do the order_by in my controller and have a variable for each list of sorted users, or should I just do the order_by in the view off of the @organization variable to keep my controller simpler. Is ther
[13:38:21] ryannielson: e a standard for this kind of stuff?
[13:38:47] hallucynogenyc: Hey guys I've been loosing my head on this https://stackoverflow.com/questions/25526690/rails-multiple-tables-constraint-within-a-one-to-many-relationship
[13:40:45] yawn: is it possible to include/exclude in the rails 4 asset pipeline depending on env?
[13:43:52] lupine: pain and hate, loathing and fear
[13:44:45] banisterfiend: is there a way of rewriting this using the fancy first_or_* methods in rails 4? https://gist.github.com/75bcfef7510e395355ea
[13:47:14] mrbubbles: Quick newb question... I'm using Rails in conjunction with MYSQL in order to serve data via a web api. The data is actually inserted into the DB using an import script which runs via CRON. Should I do anything else to tell Rails not to screw up the data that has been imported, or will just not running db:empty, db:create etc be enough?
[13:47:32] walidvb: ryannielson: imho you should add a scope in your model
[13:47:50] mrbubbles: I guess my data is effectively production data, whereas usually the DB is cleared quite often during the dev process (from what I can gather)
[13:47:53] hallucynogenyc: walidvb any ideas on this? https://stackoverflow.com/questions/25526690/rails-multiple-tables-constraint-within-a-one-to-many-relationship
[13:47:58] ryannielson: walidvb: Hmm, Do the organization model or the user model itself?
[13:48:08] walidvb: hallucynogenyc: haha why me? i just opened the link
[13:48:14] walidvb: ryannielson: the organisation model
[13:48:17] jokke: if i try to run rake my_engine:install:migrations i get this error:
[13:48:24] hallucynogenyc: walidvb seems like the only guy answering any questions around haha :p
[13:48:30] walidvb: hallucynogenyc: haha
[13:48:33] walidvb: i'm noob, though :D
[13:48:45] jokke: on't know how to build task 'app:railties:install:migrations'
[13:48:47] jokke: /home/jokke/.gem/ruby/2.1.2/gems/railties-4.1.5/lib/rails/engine.rb:633:in `block (4 levels) in <class:Engine>'
[13:49:13] hallucynogenyc: its rake your_engine:migrate not install:migrations
[13:49:17] hallucynogenyc: as far as I know
[13:49:20] walidvb: hallucynogenyc: but you can add custom validations, not sure where the issue is?
[13:49:41] jokke: hallucynogenyc: sure? rake -T shows it as my_engine:install:migrate
[13:49:47] walidvb: hallucynogenyc: http://www.rails-dev.com/custom-validators-in-ruby-on-rails-4
[13:49:54] ryannielson: walidvb: Cool I'll look into that, thanks.
[13:49:54] hallucynogenyc: walidvb how do I make one model save things on multiple tables
[13:50:03] hallucynogenyc: that's the real issue here
[13:50:17] jokke: hallucynogenyc: nah that's not it
[13:50:36] walidvb: hallucynogenyc: after_save filter?
[13:50:57] hallucynogenyc: I can't do it after_save, these extra records onthe other table need to exist before I can save
[13:51:28] walidvb: then before_save?
[13:51:59] walidvb: if i get it correctly, on save of A, you need to save 10 Bs, and validate that A does indeed have 10 Bs, correct?
[13:52:20] hallucynogenyc: essentially I have events, those events have people assigned to it, but the ammount of people that is assigned to each event depends on the event, so each event has a number_of_asignees attribute
[13:52:44] hallucynogenyc: I need to have a form that creates the event and it's 10 assigned people at the same time
[13:52:58] hallucynogenyc: the event can't exist without it's 10 assigned people
[13:53:05] hallucynogenyc: but this number varies from event to event
[13:53:30] mikecmpbll: before_save seems fine to me.
[13:53:46] hallucynogenyc: so what would you do on before_save
[13:53:59] mikecmpbll: just add a number_of_b attribute to A and submit that with your form, if it's a use defined number
[13:54:10] walidvb: hallucynogenyc: check the required_number of the Event instance
[13:54:11] mikecmpbll: then in the before_filter create `number_of_a` Bs
[13:54:24] hallucynogenyc: ok, what if it fails
[13:54:30] hallucynogenyc: I need the whole thing as a transaction
[13:54:37] hallucynogenyc: oh wait you can interrupt the A save from before_save
[13:55:11] hallucynogenyc: uhm what about the B attributes
[13:55:16] mikecmpbll: what about them.
[13:55:21] hallucynogenyc: I mean, that form contains the information both for A and for all the Bs
[13:56:13] mikecmpbll: oh, then ignore all that. you want to use accepts_nested_attributes_for
[13:58:16] hallucynogenyc: what's this sorcery lol, this method does all I need
[14:00:04] hallucynogenyc: It's always the same with Rails, whenever I'm utterly stuck with some super complex weird problem there's an equally weirdly named method that does all I need somewhere haha
[14:00:14] hallucynogenyc: awesome, thanks a ton mikecmpbll :p
[14:21:46] rocknrollmarc: Hey guys anyone have any experience in using page objects?
[14:26:14] helpa: rocknrollmarc: we all like to think we're experts; just ask your question
[14:26:14] mikecmpbll: rocknrollmarc: !expert
[14:29:07] rocknrollmarc: LoL great man thats exectly what Im looking for ;)
[14:29:28] rocknrollmarc: Well I cant really decide on what PageObject gem to use thats my problem
[14:29:51] rocknrollmarc: Ill tell you my setup: capybara, selenium-webdriver, poltergeist, cucumber
[14:30:05] rocknrollmarc: and its not a rails app
[14:35:53] rocknrollmarc: for a choice I hace capybara-page-oject, site_prism, and just plain Page-object
[15:18:05] Sou|cutter: I chose site_prism over page-object because I couldn't use watir or selenium-webdriver
[15:18:06] Sou|cutter: it worked well *shrug*
[15:18:06] Sou|cutter: I don't know about capybara-page-object
[15:18:06] dcope: is there a way to join ensuring non-nils?
[15:18:15] dcope: @comments = @book.root_comments.includes(:user).where("users.banned = ?", false).paginate(:page => comment_page, :per_page => 10).order("comments.created_at DESC") <- seems to be pulling in nil users
[15:18:16] dcope: i'm assuming this is just part of how includes works
[15:18:21] Sou|cutter: dcope: .joins(:user)
[15:18:21] dcope: thanks, i will check into that method and try it
[15:24:46] glundgren: hey guys help help help :)
[15:25:28] glundgren: i have a mailing list
[15:26:02] glundgren: and want to send email to this list, but the user can add an email that doesnt seems like an email
[15:26:28] glundgren: theres any method in rails to verify if an email address is written correctly?
[15:26:38] glundgren: and to trim the whitespaces
[15:26:41] glundgren: things like that?
[15:28:18] TeckniX: glundgren: you can add validation in your model
[15:28:46] glundgren: yes, im planning to do it, but i need to validate the already inserted emails
[15:28:49] glundgren: before send :/
[15:28:56] TeckniX: glundgren: validates :email ?
[15:29:10] TeckniX: or you mean on the page itself before the user clicks the button?
[15:29:19] gavit: when one does a my_model.'build'("param1"="foo"), do you still need to pass that in the form?
[15:29:25] glundgren: i mean before i send the email using the mailer
[15:29:38] glundgren: while im sending, i want to clean up and verify
[15:29:42] kaawee: Hello! I have a model A, which has_many: cs, through: bs. I have some complicated scope which filters the B rows, and another complicated scope which filters the C rows. How can I make the "has_many: cs, through: bs" association use the scope to yield only the C rows for which a B rows exists which satisfies the B scope?
[15:29:44] glundgren: if the email seems correct
[15:29:55] TeckniX: glundgren: then validation should kick out an error if the email isn???t correct
[15:30:01] TeckniX: aka validates :email in your model
[15:30:21] TeckniX: glundgren: probably easier to do it on the actual form page: http://jqueryvalidation.org/email-method/
[15:34:56] glundgren: how do i check a regex
[15:34:59] glundgren: if its true or false
[15:35:05] glundgren: i got an regex for email
[15:35:14] glundgren: but how i test it in an if condition?
[15:35:24] glundgren: it doesnt seem to return true or false
[15:37:22] groot_: it should return an index or nil
[15:37:27] groot_: http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-i-3D-3D-3D
[15:41:46] tdelam: Anyone know if or how to suppress rspec deprecation warnings? This is getting downright annoying.
[15:42:22] hardy12: I want to skip redis connection while running any rake. Any quick solution?
[15:49:46] viiralvx: Is Radar here?
[15:50:33] groot_: If I want an 'enum' field in a postgres table, what type should I use?
[15:51:13] ptrrr: I???d say integer
[15:51:32] Sou|cutter: tdelam: config.deprecation_stream = File.open(File::NULL, "w")
[15:52:06] lsone: groot_: The Rails 4.1 enum is an int
[15:52:32] groot_: lsone: I'm using Rails 3, sadly.
[15:53:01] ptrrr: enums are simple to implement on your own in the model anyway
[15:53:05] lsone: groot_: Then personally I would still go Integer. That is how I store them in all of my Rails 3 projects
[15:53:42] Sou|cutter: I use strings because they tend to be more obvious to a human without a lookup table
[15:54:27] lsone: I agree with Sou|cutter on that one. They are not obvious if you are manipulating data directly inside the database.
[15:54:54] ptrrr: yes, but if you want to rename the enum you???ll have to rename previous usage
[15:55:01] ptrrr: and/or provide backwards compatibility
[15:55:08] lsone: But if you are working at a model level, then you should have them pretty available to you.
[15:56:04] groot_: thanks. I think I'll use string for readability. I shouldn't have too many anyway.
[15:56:10] groot_: thanks guys.
[15:56:22] lsone: Keep in mind what ptrrr said if you are going with a string.
[15:56:33] lsone: Be very careful when renaming.
[15:58:17] alex88: hi guys, strange thing, I've a service that gets an input file and uploads it on s3, to disable parsing (I was getting encoding/parsing errors) I wrote this middleware https://gist.github.com/alex88/2422b119123d5f30505e and put it before ActionDispatch::ParamsParser
[15:59:20] alex88: the endpoint that uploads the file uses http digest auth using authenticate_or_request_with_http_digest
[15:59:34] alex88: so first request always returns 401 and then the real request goes on
[16:00:16] alex88: app is deployed on heroku, problem is, locally everything works, without uploading a file everything works, uploading a file heroku gives that the connection has been interrupted before sending a response
[16:01:25] banisterfiend: say i have this: Foo.includes(:bar).where("bar.start_date >= ?", Date.current) do i need a joins() in there too?
[16:03:18] helpa: banisterfiend: Why don't you try it and find out for yourself?
[16:03:18] crankharder: banisterfiend: !try
[16:04:32] banisterfiend: crankharder i'm actually more interested in the theory behind it
[16:04:36] banisterfiend: crankharder cos afaik `includes` can either decide to preload via two queries or by one query (using a left join) - so my guess would be that it would work sometimes, but othertimes, not (depending on the eager loading strategy includes() uses)
[16:04:51] greengriminal: would anyone say this is a shabby way of doing a check: https://gist.github.com/anonymous/fbfc3708efd2edd9c577
[16:05:39] sdegutis: How does Rails combine your JavaScript files into app.js for you? Does it just concatenate them, or does it offer some kind of namespacing?
[16:10:49] sarink: how do i output a content_tag? <%= job.complete ? content_tag(:span, class: 'complete') : '' %>
[16:17:33] gavit: .build used populate the caller with a new instance. Did this change? I seem to be getting nil for my delivery_line after clicking on submit. See-> https://gist.github.com/gavit/fa0996e0aef7b5eb5762#file-material_received_reports_controller-rb-L46 Somehow when I go to the edit page the order_line is not nil ( i get values for f.object.order_line.item.product_number), but when I submit, I get an error that the order_line is 'nil'. What am I missing?
[16:19:51] dcope: sdegutis: http://guides.rubyonrails.org/asset_pipeline.html#main-features
[16:21:04] sdegutis: dcope: That doesn't quite explain how it concatenates them. It implies that it's plain concatenation though.
[16:21:27] dcope: sdegutis: make two simple js files, include in application.js, and view the output?
[16:21:38] sdegutis: I don't have a Rails app yet.
[16:21:40] sdegutis: I guess I can make one.
[16:24:17] sdegutis: Rails just uses Sprockets, and Sprockets is apparently the one doing the concatenation.
[16:25:48] mattchi: it also minifies by use of the uglifier gem, if present
[16:29:56] sdegutis: Right. I was only wondering about how it concatenates.
[16:30:13] beanHolez: I recently had a coworker leave to take another job. My employer has said that he would like me to step in and take over the work that the ex-coworker was doing. Said employer has offered to pay for training if I can find an advanced rails course. None of the bootcamp stuff seems to be right, as those all teach the basics to get you up and running with rails. I've been working with rails for a couple years now, but I'm looking to becom
[16:30:13] beanHolez: e an expert now. Does anyone have any recommendations?
[16:31:10] kedric: beanHolez: What are you lacking in specifically?
[16:36:06] stepfresh: hey all, im tinkering with this hash translation problem.. any one care to take a stab at it? https://gist.github.com/danhunter/4eafcddcfa4497829ec8
[16:36:24] beanHolez: kedric: I think that's a problem in and of itself, I'm not sure exactly where I am lacking. I suppose more advanced techniques in the realm of security, performance, database interaction, etc
[16:38:26] sdegutis: What do you use to deploy a simple Rails app to EC2?
[16:38:30] walidvb: i ran a bundle update, and it broke my oauth. weirdly, i get a 'wrong number of arguments" on this:
[16:38:44] walidvb: auth.slice(:provider)
[16:39:03] walidvb: even though auth[:provider] exists (not that it'd make a difference)
[16:39:26] dcope: sdegutis: passenger is probably the easiest to setup and get going
[16:39:56] walidvb: i can't really figure the error out. code was working before, too..
[16:40:25] bricker`work: walidvb: gist error and code
[16:41:47] kedric: beanHolez: I am not sure there is a class for something like that. What would be your new responsibilities? Do you have to manage deployment or other tools around it?
[16:41:50] beanHolez: kedric: I don't know in-depth about the underlying bits of Rails (and related techs): ActiveRecord, ActiveSupport, Caching, more advanced architecting stuff, Rack, etc. These may be things that I have to track down and learn individually, but I was wondering if there's something comprehensive that covers many of these things in-depth
[16:42:24] kedric: beanHolez: start poking, break things and fix it has always worked best for me
[16:42:46] walidvb: bricker`work: on it. i just restored an older Gemfile.lock, and that works. will go again with the bundle update
[16:45:54] walidvb: bricker`work: hm. seems like running bundle update again
[16:46:13] sdegutis: Thanks dcope.
[17:06:36] greengriminal: So a company can have many members_and_contacts. In saying this I decided to do the following AR query: Company.where(id: 38418).joins(:members_and_contacts).where("members_and_contacts.first_name IS NULL").count
[17:07:33] greengriminal: Trying to find out how many members first_name is null that belongs to that company.
[17:12:57] mattchi: Company.find(38418).members_and_contacts.where(first_name: nil).count
[17:15:35] epochwolf: mattchi: 942539
[17:16:21] mattchi: that was your count? seems high...
[17:16:35] epochwolf: oh, I missed the context, I was being snarky. :)
[17:22:39] walidvb: is there a way to expose rails path_helpers to angular?
[17:31:00] cmosguy: hi can someone help me, I am trying to compile compass but ruby/rails gives me this error in my file when i try to @import "compass" https://gist.github.com/cmosguy/b760d157abf3bda4b1e1
[17:31:42] sarink: cmosguy: what's your config.rb look like
[17:31:54] sarink: are you using the compass-rails gem?
[17:32:31] cmosguy: sarink, https://gist.github.com/cmosguy/7c44d359ffcc5b478b3e
[17:32:50] cmosguy: sarink, i am not sure, I did a gem compass install based on the docs
[17:35:48] cmosguy: sarink, am i supposed t install that compass-rails gem?
[17:36:17] sarink: cmosguy: you can run it standalone, but i'd recommend using the gem. just follow their instructions, they're simple
[17:36:58] cmosguy: sarink, i don't understand why i am dependent on compass-rails, i want to run compass standalone for my project
[17:37:37] cmosguy: sarink, i used the rails installer to help me get all my dependencies for windows setup so I could simply use ruby,
[17:37:49] sarink: because it'll integrate it with the assets pipeline and set up a watcher for you? the same things you should do manually if you don't use the gem?
[17:38:35] sarink: idk why you would not use it.
[17:41:15] cmosguy: i am using ember-cli to do the asset pipeline, i am running compass manually to debug something
[17:47:07] cmosguy: sarink, do you understand the ]\[
[17:47:59] cmosguy: now compass watch just hangs after installing those gems
[17:52:04] cmosguy: sarink, if you look at my original link what causes that error do you know?
[17:55:03] wldcordeiro: Is there a way to setup the logger to create a new file every day?
[17:55:14] wldcordeiro: My production.log file is getting absolutely massive.
[17:57:21] amh345: is there a way to do a dynamic root route? depending on the host i would like to load a different controller#action as a root.
[17:57:36] shlant: anyone use bcms_s3?
[17:57:36] mattchi: create a rotation file in /etc/logrotate.d to move your log daily
[17:58:23] mattchi: https://gist.github.com/matthucke/dc350f0799b1bf3398b8
[18:03:11] sdegutis: I have a strong urge to rewrite our website in pure Rails, using all the Rails idioms, including ActiveRecord.
[18:06:00] Console: I need some help editing my routes file with regex. I currently have ???constraints subdomain: /^tap(\.|$)/ do??? to route everything from tap.mydomain.com - however I want to edit it to include www.tap.mydomain.com. Would anyone be able to assist with this by any chance? Thank you all
[18:11:11] TeckniX: Console: just use rubular and check the routes
[18:11:36] Console: ACTION googles rubular
[18:12:02] Console: Oh shit, http://rubular.com/
[18:12:23] Console: Thanks TeckniX, I???ll play around and see what works
[18:13:35] kerygmata: looks interesting TechniX
[18:15:02] TeckniX: yea it???s a pretty easy way to test out your regex and see what works
[18:15:14] kerygmata: cool, thanks
[18:19:07] root3d: anyone having prior experience with ibm bluemix hosting .? i have sample app running on heroku but not on bluemix
[18:19:08] bricker`work: rubular is the shit
[18:19:40] root3d: i have a error log : no idea what is going on https://gist.github.com/igauravsehrawat/02935d430e07441f2138
[18:19:54] root3d: bricker`work, why ? good for regex practice
[18:20:35] alaing: hi, I'm new at rubym what would the relative path be for url in css that references images
[18:20:49] alaing: i tried ../images/my_pic.jpeg
[18:20:58] alaing: but it cant find it
[18:24:00] root3d: bricker`work, what part is shit ?
[18:25:12] root3d: alaing, it will be relative to the app folder .
[18:25:52] alaing: root3d: oh i see.
[18:25:56] alaing: thanks :-)
[18:26:22] root3d: alaing, let me know if it's working
[18:27:11] alaing: root3d: I'just replaced with '/assets/my_pic.jpeg'
[18:27:15] alaing: and its working
[18:27:38] root3d: yep. that's relative to app.
[18:28:25] root3d: anyone having idea with this error log : https://gist.github.com/igauravsehrawat/02935d430e07441f2138
[18:28:30] amh345: how can i can the host in a my routes?
[18:29:46] Spami: So, I have a this in my DB: "This is a link to your profile; please update the services so we can send you better leads :) http://magicleads.com/user/#{#user.alias}" but whenever I'm trying to get this record active record(I presume) add a backslash before the #
[18:29:52] Spami: Anyway to avoid this
[18:30:28] foucist: do you guys have fork checks in config, to re-establish new connections with memcache in an aggressive spawning setup?
[18:38:42] rhizome: Spami: .html_safe i think should handle that silly business
[18:39:48] Spami: rhizome, nope :)
[18:40:26] rhizome: well then i don't know how you're outputting the URL
[18:42:30] root3d: Spami, you can skip # .that is generally for url monitoring.
[18:42:59] Spami: root3d, well the idea is to store erb view in the DB
[18:43:28] root3d: Spami, i guess you are going bit wrong
[18:43:52] root3d: erb goes in view .
[18:44:21] Spami: root3d, yeah but I need the view to be editable on demand by the sales people
[18:44:48] rhizome: and they're editing erb?
[18:45:16] root3d: Spami, yeah ..the specific field you want ..like textbox , or othereditablebox ?
[18:45:46] root3d: ok . let's call the code . to clear this up .
[18:45:57] Spami: root3d, it's only for email/sms template
[18:46:15] root3d: Spami, basically filling out the form .. right ?
[18:47:33] Spami: root3d, So, they need to run AB testing on email and ams we send. Right now each time the went to do some change they have to ask us, ... it's time costing. So I want to let them edit the email template directly
[18:47:53] Spami: there is no form nothing in the template
[18:47:55] rhizome: but...just the text, right?
[18:48:19] Spami: just pure text and the key like "Hey #{@user.firstname},"
[18:48:49] rhizome: you're a/b'ing on what form of the name is used in the salutation?
[18:49:10] Spami: on the content yes
[18:49:45] Spami: the first name is just a simple example.
[18:50:01] rhizome: what do you mean, "on the content?" my question refers to the difference between user.firstname and user.email and user.first_and_last and so on
[18:50:04] mozzarella: GUYS GUYS GUYS
[18:50:29] Spami: rhizome, yeah that's part of the AB testing
[18:51:01] Spami: whether we should use first name or company name, whether we should add their address in the email, ... things like that
[18:51:48] root3d: rhizome, confusion right ?
[18:52:14] root3d: mozzarella, what ?
[18:52:27] Batesism: Hey guys, I'm building a Backbone app on RoR, but when I hit the server it's not giving me back a session cookie unless it's right when I log in. Any ideas on what I may be missing?
[18:53:14] root3d: Batesism, *unless i login ?
[18:53:41] Batesism: When I submit the login form, it gives me back a cookie
[18:55:37] Batesism: Actually, it shouldn't be giving me a cookie when I am just making async calls to the server for data, right?
[18:55:54] Batesism: I'll just get a cookie when I initially load the app... correct?
[18:56:57] mozzarella: I??changed the paperclip url on one of my attachments, and of course it has invalidated the previous links, is there an easy way to fix that
[18:57:10] mozzarella: or must I??write my own script?
[18:57:22] mozzarella: basically the filenames stayed the same but the location is different
[18:57:22] rhizome: Batesism: sounds like you're really wanting appkey type requests rather than logins?
[18:57:30] root3d: Batesism, it will give you cookie when you create a cookie .. so be it after submitting a login form or so ! make sense ?
[18:57:51] rhizome: mozzarella: you can reprocess
[18:58:11] rhizome: not sure if there's a solo url updater. probably can be hacked if not.
[18:58:11] mozzarella: rhizome: how?
[18:58:27] Batesism: Kind of.... I've been trying to figure how this works for about 6 straight hours... making very slow progress but starting to understand.
[18:58:32] root3d: rhizome, what's appkey type requests ?
[18:58:53] sdegutis: Do you use Haml, Slim, ERB, or something else?
[18:59:18] rhizome: root3d: https://developers.google.com/+/api/oauth et al
[19:00:04] Batesism: I am trying to understand how in Backbone, when the app first starts, how do I match that session cookie and ID the user
[19:00:23] Batesism: Either I'm looking in the wrong places, or there is barely anything written about it online
[19:00:24] root3d: ohh you meant .. apikey
[19:00:53] rhizome: mozzarella: actually i'm not sure what your situation is
[19:01:09] rhizome: apikey, application key, i'm still waking up.
[19:01:46] root3d: Batesism, so you want to authenticate basically . right?
[19:02:17] Batesism: Yes... easy enough in straight rails, but haven't completely wrapped my head around it now that I'm using Backbone
[19:02:31] Batesism: root3d, Yes. ^
[19:03:47] Batesism: I'm using sorcery, and when that sends me back the user after login, I was storing that in App.currentUser, and that was the closest to being a logged in user I got to...
[19:04:24] alaing: i'm using devise and in my application.html.erb i would like to conditionally show some content based on if the user is on the devise login page or something else on others
[19:04:49] sdegutis: ERB, Haml, or Slim?
[19:08:00] chintanparikh: alaing: You can generate the devise login views and modify them
[19:08:16] root3d: Batesism, you gone through this http://blog.42floors.com/user-authentication-with-rails-and-backbone-js/
[19:09:05] root3d: chintanparikh, mhacks this year ?
[19:09:25] alaing: chintanparikh: I have the views etc. in my application.html.erb I have a header whihc has a "sign in" button on it. obviously no point showing that on the login page
[19:09:49] chintanparikh: root3d: Unfortunately not. Taking a break from hackathons. Who is this btw?
[19:10:07] chintanparikh: alaing: Oh, in that case just use current_user
[19:10:28] chintanparikh: <%= link_to login_page, "Login" unless current_user %>
[19:10:30] chintanparikh: Something like that
[19:11:06] alaing: chintanparikh: thanks, that button will become a signout button if the user is logged in
[19:11:31] alaing: which is why I thought maybe have an if/else
[19:11:40] chintanparikh: alaing: I usually just do two seperate links, and use an if else
[19:11:45] chintanparikh: alaing: Haha yeah, exactly
[19:11:48] rhizome: <%= current_user? ? logout_button : login_button # helpers %>
[19:12:10] chintanparikh: Is it worth having those helpers?
[19:12:16] chintanparikh: Just seems like overkill to me
[19:12:20] chintanparikh: But it is a one liner
[19:12:47] rhizome: actions(current_user)
[19:12:52] Batesism: root3d, looked at this a while back, but might be just what I need today... thx
[19:12:53] alaing: but wondered if there was a why to say if the url ie route is /users/sign_in then to not display any button
[19:13:39] chintanparikh: alaing: Usually in my application controller, I give my body classes for the controller and action, and control things like that with js
[19:13:47] chintanparikh: But in this case, you definitely should just use current_user
[19:14:21] chintanparikh: But yeah, you could do it per route by checking the controller and action names
[19:15:06] alaing: ah the js way.....tempted to use that way but seeing as i'm new to ror i thought i would test it and my knowledge
[19:15:23] alaing: how would i test the controller?
[19:15:41] chintanparikh: alaing: What do you mean test the controller? Like write tests for the controller method?
[19:15:55] chintanparikh: alaing: I think what you want are integration tests, take a look at capybara
[19:16:29] alaing: chintanparikh: yeah I should really write those tests first. TDD
[19:16:40] alaing: but in this case I'm not referring to that
[19:17:56] Sou|cutter: you can write controller tests without capybara
[19:18:56] alaing: in pseudo code: in the application.html.erb i want to say if the user is not logged in and GET "/users/sign_in" is false, show the sign in button. ELSEIF the user is logged in show the sign out button else so no button
[19:18:59] chintanparikh: Sou|cutter: Yeah you can, but for testing the views capybara is probably easiest
[19:19:30] alaing: else show no button
[19:20:19] alaing: in my condition i want to test if it was GET "/users/sign_in"
[19:20:23] Sou|cutter: chintanparikh: aye
[19:20:32] chintanparikh: Don't check for the route
[19:20:36] chintanparikh: Check for the controller and action
[19:20:50] chintanparikh: because the route can always change, but it's less likely you'll change the controller and action
[19:21:01] chintanparikh: I'm pretty sure you want sessions#new
[19:21:12] alaing: or check a path
[19:21:19] chintanparikh: And I think in the view it's controller_name and action_name (though I could be wrong, I'm a little rusty)
[19:23:01] chintanparikh: Okay yeah, I just checked. Here's your if statement: if !current_user and controller_name == "sessions" and action_name == "new"
[19:23:32] alaing: atm my button is this <%= link_to new_user_session_path, class: "btn btn-info" do %>
[19:23:33] alaing: <i class="icon-user icon-white"></i> Sign In
[19:23:35] alaing: <% end %>
[19:23:48] alaing: Ah sorrying its my terminology i'm using
[19:24:37] alaing: I need to have a condition on the controller name and action name
[19:25:32] alaing: thansk chintanparikh thats exactly what I was looking for :-)
[19:25:52] alaing: its controller_name and action_name that pointed me in the right direction
[19:26:44] alaing: just did <%= controller_name %> and it outputted exactly that :-)
[19:27:05] alaing: I'm off to work out the syntax for if statements
[19:27:14] alaing: I've done a few tutorials
[19:27:34] alaing: but I think its better to just get your hands dirty and just build
[19:27:55] alaing: you soon find where your weaknesses are and test you understanding
[19:28:37] alaing: so an action is a request sent to the controller?
[19:29:33] alaing: I know in traditional html/php and action attribute in a form would request that webpage and pass the various fields back to the server to process
[19:29:50] chintanparikh: alaing: The action is the method name in the controller
[19:30:10] chintanparikh: So in "sessions#new" means SessionsController and the method new
[19:30:40] alaing: is there a helper to get a controller and action combined?
[19:31:28] alaing: so insstead of testing just controller_name and action_name is there something that would just return/test "sessions#new"?
[19:32:13] alaing: hmmm i dont see a controller in app/controllers for devise
[19:32:57] alaing: I can see the /app/views/devise with the various views
[19:53:16] dopie: ubuntu have anything like this software a GUI for showing HTTP http://ditchnet.org/httpclient/
[19:54:53] makerop: dopie, i dont know all the features, that ditchnet offers, but chrome has a plugin called postaman
[19:54:53] sdegutis: In production mode, does Rails still read .erb files off disk and evaluate them this way?
[19:56:22] dopie: makerop, thans
[19:56:24] stef1a: when using form_for @object, how does Rails know which fields to prepopulate with the data just passed in if the form data is invalid and we re-render the page?
[19:56:35] Batesism: So Sorcery gives me access to the current_user helper in erb, but is there a way that I can access that in Backbone if building a SPA?
[19:57:03] Batesism: Do you normally do a refresh when authenticating users in SPA's built on rails?
[20:02:47] vedu: is there a separate channel for the cancan gem or this is it?
[20:09:38] Altonymous: Assuming I have an array of arrays.. and I want to return a string with this format??? (1, 'A', 'X'), (2, 'B', 'Y'),(3, 'C', 'Z') How would I go about doing that effeciently?
[20:10:26] bricker`work: what is in the array?
[20:11:13] Altonymous: [[1, 'A', 'X'], [2, 'B', 'Y'], [3, 'C', 'Z']]
[20:11:23] Altonymous: an array of arrays
[20:12:01] bricker`work: Altonymous: array.inspect.tr("[]", "()").gsub(/^\[]$/, "")
[20:12:03] bricker`work: something like that
[20:12:45] bricker`work: oh the gsub would be gsubbing parenthases at that point
[20:12:47] bricker`work: you get the idea though
[20:13:39] Altonymous: not sure I like the idea of inspect it then doing string replacements..
[20:13:51] Altonymous: not sure that's going to be effecient for very large arrays
[20:14:20] Altonymous: would it be more efficient then using map or something and building the string?
[20:14:51] bricker`work: Altonymous: you'd have to map for each array, if it's big then probably not
[20:15:00] bricker`work: Altonymous: Benchmark it
[20:15:23] Altonymous: also using inspect adds a bunch of backslashes that I'd have to strip..
[20:15:35] bricker`work: Altonymous: no it doesn't
[20:17:20] Altonymous: so that's just irb adding them then?
[20:17:23] dopie: makerop,is it POSTMAN???
[20:18:19] bricker`work: Altonymous: yes
[20:20:03] alaing: hi, i've made a change to a db migration script, I've saved it and ran rake db:migrate, it doesn't output anything saying like add columns etc and when i check schema.rb i do not see the extra columns i added
[20:22:02] rhizome: was it a change to a migration that was already run?
[20:22:17] Altonymous: bricker`work: figuring out the regex to replace the first and last parens is a pita??? haha
[20:22:19] alaing: I added three new columns
[20:22:55] Altonymous: figured it out as two separate gsubs.. but not as a single
[20:23:08] hfp: Hey all, I have a view cache issue. I'm caching fragments on my views and I have 3 rails servers using the same code for the controllers but separate views. The way Rails is able to tell is because I launch it with a different env var that will tell it which views dir to look into. I cache with `<% cache "feature_#{site_name}", { expires_in: 1.hour } %>`. `site_name` is different for every site, of course. However, e
[20:23:08] hfp: very site seem to be using the same cached fragment. I can't understand why. Any pointers?
[20:24:52] rhizome: alaing: migrations don't get rerun just because you edit them. either db:rollback or create a new migration for those changes.
[20:25:44] rhizome: hfp: hard to say
[20:26:04] hfp: rhizome: I kinda expected that :(
[20:26:34] alaing: rhizome: Oh didn't realise that a tutorial I had previous followed seemed to suggest you could
[20:26:44] awestroke: I can't get authlogic to work with rails 4.2 beta1
[20:26:49] awestroke: what should I use instead?
[20:26:59] alaing: rhizome: basically they editted the last migration file and then ran rake db:migrate
[20:27:32] rhizome: guessing they edited before running
[20:28:14] alaing: which is what i did
[20:29:23] sdegutis: Slim is sooooo coooooool.
[20:30:07] awestroke: sdegutis: it's kind of like haml right?
[20:30:15] sdegutis: Yes, but better.
[20:30:29] sdegutis: I've used haml for a while a few years ago, and I'm trying Slim out today, and it's even better than Hiccup!
[20:30:32] bricker`work: it's just another fucking templating system
[20:30:36] awestroke: sdegutis: better how?
[20:30:48] alaing: rhizome: coudl it be because the migration fiel i'm editting isn;t the last one i've run?
[20:30:51] sdegutis: Just nicer to read and write.
[20:30:57] sdegutis: And I hear it's faster too.
[20:31:11] alaing: rhizome: so def chnage will not work because i have to migrate down to run it
[20:31:29] alaing: and then back up to the latest one
[20:31:57] alaing: I'll just create another migration file
[20:35:09] sarink: routes.rb: resources :job_tasks, only: [:index] navigate to /job_tasks receive uninitialized constant JobTasksController
[20:39:28] kerygmata: If I am changing my models relationships from has_many to has_many :through -what is the best workflow? join table, migrations etc..
[20:43:41] yoshie902a: I???m using Carrier wave and trying to figure out what to name my model and my uploader. In most examples, I see, they use profile or painting as the model, as that works in those cases, and the uploader is usually called image. In my case, I have generic files, and not sure what to call the model and uploader. In the examples I???ve seen, it makes sense to say profile.img in my case, not so much. any
[20:43:41] yoshie902a: ideas if I just have a list of files within a folder?
[20:45:08] dcope: is it possible to have a has_many without a belongs to? for example, if an application has a Category model, would the has_many be on the Category model to Books per se?
[20:46:00] dcope: ok, and you'd just have to create a migration with a join table?
[20:46:09] dcope: that has id, category_id, book_id?
[20:46:14] dcope: and tell rails to bind on those?
[20:47:15] dcope: rails docs make it sound like a join table is only used for has_and_belongs_to_many
[20:47:39] yoshie902a: dcope: define your relationship.
[20:48:03] dcope: yoshie902a: a Category has many Book. so books can be grouped by category.
[20:48:17] kerygmata: A grower has a field through a farmer
[20:48:20] yoshie902a: dcope: and each book as one category?
[20:48:43] dcope: yoshie902a: no, it is optional. but a book could be in multiple categories.
[20:48:59] dcope: so a HABTM seems to make the most sense
[20:49:23] yoshie902a: dcope:then you want a has many/has many relationship. Don???t use HABTM. hold one
[20:50:07] dcope: yoshie902a: oh, a has many on both models? that still requires a join table, right?
[20:50:36] yoshie902a: dcope: use has many through . http://railscasts.com/episodes/47-two-many-to-many with a join table, yes
[20:50:59] dcope: yoshie902a: ok great, ill check this out
[20:51:06] dcope: btw, has anyone heard from ryan bates?
[20:51:13] yoshie902a: dcope: if you want to get fancy: http://railscasts.com/episodes/258-token-fields-revised
[20:51:36] LiquidInsect: Hey. I've got a weird issue bringing a stone-age Rails 2 app into the Rails 3 bronze (iron?) age... basically, I have a layout defined in a controller, but the action I'm hitting isn't rendering with that layout unless I explicitly do 'render layout: "my_layout"' at the end of the action. Has anyone seen anything like this?
[20:52:15] rhizome: LiquidInsect: did you run rake rails:update
[20:53:39] LiquidInsect: pretty sure the person who started this process did that already, we have new routes etc, app configs etc.
[20:53:42] yoshie902a: is file a reserved word? If I wanted to make a model named Document and a uploader method called file. would this be a bad idea?
[20:53:43] kerygmata: https://gorails.com/
[20:53:55] LiquidInsect: The action renders but only with the template itself
[21:01:52] isthisreallife: how to write AR query that gives me all users that dont have achievement.title="year"? this is what i got so far but it doesnt show users that dont have 0 achievements User.all.includes(:achievements).where.not("achievements.title = ?", "year").references(:achievements)
[21:03:30] jonathan_alban: Hi Could I ask a beginner question? I'm getting this error: undefined method `let' for #<Cucumber::Rails::World:0x007fd4a780acb8>
[21:04:27] jonathan_alban: I'm using Factory girl in cucumber tests and need to use let.
[21:05:16] jonathan_alban: I can add Rspec to my gemfile however I'm not sure how I make the let method available in my step_definitions
[21:05:19] centrx: isthisreallife, Achievement.where.not(title: "year").map(&:user)
[21:05:50] centrx: isthisreallife, There is a way to write a faster SQL query for it, but it involves a lot of SQL fragments
[21:06:15] centrx: isthisreallife, Actually, that might not be what you meant
[21:06:49] isthisreallife: wouldnt it be slow with a really big table?
[21:07:13] centrx: isthisreallife, Do add the #includes in I left out
[21:09:17] dcope: why do join tables have no id?
[21:09:19] mattchi: if I might offer a further refinement - that creates Achievement records, perhaps many thousands, only to discard them soon after.
[21:09:26] dcope: how are you supposed to delete the relationship if they have no id
[21:09:53] centrx: dcope, The two columns still form a unique key
[21:09:59] isthisreallife: centrx it doesnt work ;/
[21:10:01] mattchi: perhaps User.where(:id => Achievement.where.not(title:'year').pluck(:user_id)) might bet quicker, won't create Achievement objects
[21:10:58] centrx: mattchi, If you take out the pluck it will make it a subquery
[21:11:07] isthisreallife: it doenst show users that dont have any achievements
[21:13:04] mattchi: true, one query rather than two in your version.
[21:13:50] isthisreallife: but it doesnt give me users that have no achievements
[21:14:01] mozzarella: anyone familiar with paperclip?
[21:15:08] mozzarella: I'd like to only use the first letter of :style in my url, how do I do that?
[21:17:57] mattchi: mozzarella: the docs say you can use lambdas for some of the config options, though I haven't tried that.
[21:20:32] rhizome: mozzarella: futz with :url
[21:21:21] mozzarella: rhizome: ? what does that mean
[21:21:35] koriner: hey, just a simple one - but if i want to have a general class or something that just defines some constant values for a particular thing, where is the best place to create that?
[21:22:13] koriner: i.e. if i have a MessageStatus class that specifies possible values, but would be referenced by models and controllers etc
[21:24:29] koriner: or would the best way just be to create constants in the actual model class
[21:28:45] rhizome: mozzarella: it's an option to has_attached_file
[21:29:33] rhizome: koriner: you can do it in the class if that's the only place it's needed
[21:30:26] koriner: yeah i think i'll want to reference it from a few different places (other models and controllers)
[21:31:53] jonathan_alban: Hi all. Just a quick question. How do I require rspec for cucumber step_definitions
[21:35:11] sdegutis: What's a good OpenID (not OAuth) plugin for Rails?
[21:35:32] Scient: how the heck do i get the pure/raw headers of a request in rails?
[21:35:36] Scient: i dont want all the env crap etc
[21:35:38] Scient: just the headers
[21:35:41] Scient: like http stuff
[21:36:22] stepfresh: need a good name for an hstore column in a product table.. ???extra??? or ???meta??? or ???details??? or something?
[21:36:27] stepfresh: suggestions on a postcard
[21:36:29] mozzarella: rhizome: I know, I??can get :style but I don't know how to only get the first letter
[21:37:25] mattchi: koriner, I put constants in models all the time, like STATUS_whatever. You can use them like User::STATUS_APPROVED from anywhere.
[21:37:30] mozzarella: let me try something
[21:38:20] mattchi: koriner: but if the list gets huge, make a class. I have an order management system with about 30 order / item statuses, so I made a class. OrderStatus::REFUND_PENDING etc. Class can go in app/models or app/lib.
[21:39:09] koriner: mattchi: cool, thanks
[21:40:04] waseem_: Scient: Does it not help? http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-headers
[21:40:44] Scient: well that contains the whole world, right?
[21:40:46] Scient: like env and whatnot
[21:40:52] Scient: there is way way too much crap in there
[21:40:53] waseem_: Yes it does.
[21:41:04] Scient: what im after is basically the stuff you see in firebug - just relevant http header stuff
[21:41:23] waseem_: Scient: You might want to find out how @env is formed then.
[21:43:04] bricker`work: mozzarella: use a custom UrlGenerator
[21:43:33] bricker`work: there's an option for it, :url_generator
[21:54:22] rhizome: mozzarella: http://viget.com/extend/paperclip-custom-interpolation
[22:29:15] zeroNones: Having trouble attaching an image with the watir gem, anyone have experience with this?
[22:30:17] bricker`work: I'm having trouble with the Updog gem, can anyone help?
[22:30:30] bricker`work: ACTION leans in
[22:30:44] bricker`work: lolololololololololol
[22:30:49] bricker`work: ACTION gets back to work
[22:41:28] advorak: When running a query: User.first, how can I prevent rails from grabbing from the sql query cache for that query?
[22:41:54] mozzarella: undefined method `basename' for #<Paperclip::Attachment:0x007f4a17c3c680>
[22:42:21] mozzarella: damn where is my look of disapproval
[22:43:17] mozzarella: oh yeah it's there
[22:46:18] SloggerKhan: Are there any other authentication solutions worth looking at besides devise?
[22:46:56] chemic: Hello guys??? stuff.where(:created_at => start_time.beginning_of_day..Time.now.end_of_day) <- how one can add Time.zone.tzinfo.identifier into that query?
[22:48:11] chemic: I have a problem that time_zones are handleled by rails in application_controller but when doing some date specifc query in my postgres.. I get wrong stuff.. gotta specify time_zone for query???ng somehow :)
[22:53:42] zeroNones: SloggerKhan clearance is one
[22:53:58] zeroNones: https://github.com/thoughtbot/clearance
[22:54:52] mozzarella: why can't I call basename on teh paperclip attachment?
[22:57:18] SloggerKhan: zeroNones: thanks, that actually looks like a pretty interesting option.
[22:58:01] Lewix: advorak: it's only cached inside of the same action
[22:58:28] advorak: Lewix, I just figured it out .. yes, defeats the purpose of caching, but I needed .order(rand)
[22:58:56] nahtnam: Hey! I have some code which looks like this: https://gist.github.com/nahtnam/cb30460f51c0c957680c I am getting an error saying: https://gist.github.com/nahtnam/c73b613574a85dd847cd
[22:59:03] nahtnam: Not sure what its about
[23:00:08] Radar: nahtnam: Y U NO PUT INTO 1 GIST
[23:00:18] advorak: nahtnam, do you have an unmatched parenthesis there?
[23:00:33] Radar: nahtnam: Error happens on line 24 but first gist is only 5 lines long. Are you a wizard?
[23:00:33] advorak: nahtnam, do you have an unmatched parenthesis in the part of the code you're not showing us?
[23:00:39] nahtnam: advorak: Thats the ONLY erb code I have in my view
[23:00:43] zeroNones: anyone work with fileuploads and watir?
[23:00:49] helpa: zeroNones: 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.
[23:00:49] Radar: zeroNones: !used
[23:00:52] antivert: wow devise rocks, I just installed it and now I have a simple login system
[23:01:13] zeroNones: does anyone know how to upload files with watir?
[23:01:13] Radar: Tomorrow on the antivert show: "OMG DEVISE SUCKS. CAN'T CUSTOMIZE IT AT ALL :((((("
[23:01:19] nahtnam: Radar: Do you want me to include the html and css of my website? If you add all the divs, it will become line 24
[23:01:29] Radar: nahtnam: I want you to show us index.html.erb
[23:01:33] zeroNones: I did Radar
[23:01:39] Lewix: advorak: model.connection.clear_query_cache
[23:01:41] Radar: zeroNones: well then you're one step ahead of me
[23:01:48] zeroNones: I've gone through about 12 SE ...
[23:01:59] zeroNones: you never used watir?
[23:02:07] advorak: Lewix, and that just clears it for the current request, correct?
[23:02:14] Radar: zeroNones: no, I use selenium-webdriver instead.
[23:02:24] nahtnam: Radar: https://gist.github.com/nahtnam/1ce515ee9b2d6b74a491
[23:03:05] Radar: zeroNones: well, if it's the same thing then this could work: http://stackoverflow.com/questions/20382367/testing-html5-file-upload-with-capybara-selenium-webdriver-ruby
[23:03:10] Radar: nahtnam: A THIRD GIST? Are you fucking insane?
[23:03:16] Radar: nahtnam: 1 gist to rule them all plzkthx
[23:04:15] nahtnam: Radar: https://gist.github.com/nahtnam/4590a5313c2f447e8783 Compiled
[23:04:22] zeroNones: going to give it a try thanks Radar
[23:04:23] Radar: FOUR?! Madness.
[23:04:32] Lewix: Radar: do you hire? I'm in the market ^^
[23:04:36] Radar: Why is there an equals sign here? https://gist.github.com/nahtnam/4590a5313c2f447e8783#file-index-html-erb-L25
[23:05:04] Radar: Lewix: I am not sure that we're hiring *just* yet. Soon...
[23:06:32] nahtnam: Radar: lol?
[23:06:56] terrellt: Radar: Dibs.
[23:07:07] Radar: terrellt: on?
[23:07:23] terrellt: Radar: Future unspecified job opportunity.
[23:07:42] Radar: terrellt: ah :)
[23:07:52] Lewix: hey I found out that IRC is better than any jobboard
[23:07:57] Radar: You'll know about it when lifx is hiring :) We definitely need some people on the Cloud team
[23:08:09] Radar: Go/Ruby devs at least, and probably 1-2 more ops people
[23:08:16] terrellt: Lifx? YOU MOVED?
[23:08:23] terrellt: ACTION out of the loop
[23:08:30] Radar: http://ryanbigg.com/2014/07/ryan-bigg-is-now-a-git/
[23:08:31] Radar: A month ago
[23:08:41] Radar: Go and apply for Spree if you want :)
[23:09:14] pipework: If you enjoy, "I don't understand, you help me now?" emails flooding your inbox.
[23:09:30] mozzarella: guys I need a shorter way to do that (f is a paperclip attachment):
[23:09:32] mozzarella: f = Post.first.file; f.interpolator.basename(f, f.options[:default_style])
[23:09:44] Radar: Those are few and far between. It's usually devs who mostly know what they're doing and they're just stuck on something specific to Spree.
[23:09:49] Radar: And a lot of issues
[23:09:54] Radar: They just need someone to be a community manager again :D
[23:10:54] LBRapid: Hi Radar! Wrong channel for this maybe, but hope things are going well for you at Lifx
[23:10:55] terrellt: Radar: Lifx a remote work place?
[23:10:55] pipework: Clearly Radar just sends my emails to spam.
[23:11:13] Radar: LBRapid: Na this is fine :) Things are going very well. I'm enjoying getting to write Go code.
[23:11:19] Radar: LBRapid: I hope things are going well for you at Customink as well.
[23:11:49] Radar: terrellt: We have offices in Melbourne + SF, but I think we'd be open to more remote workers.
[23:12:09] terrellt: Well, send the word when it happens. I know some people who can do the ruby.
[23:12:10] LBRapid: Radar: Indeed they are. Lifx is up to some cool things :)
[23:12:27] Radar: terrellt: You'll see it on Twitter :D
[23:12:33] terrellt: Maybe if I followed you, psh
[23:13:49] isthisreallife: why i get "PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous" User.includes(:achievements).where("created_at > ? and achievements.title != ? or achievements.id is null", 1234.hours.ago, "year").references(:achievements)
[23:14:12] terrellt: isthisreallife: achievements also has a field called created_at.
[23:14:14] bricker`work: isthisreallife: you get it because both 'users' and 'achievements' have a 'created_at' column
[23:15:44] bricker`work: isthisreallife: you already know the solution
[23:15:59] kryptonradon: hi, how can I return plain text from rails controllers?
[23:16:06] Radar: isthisreallife: the column is ambiguous
[23:16:10] kryptonradon: I don't want any html
[23:16:11] Radar: kryptonradon: render text: 'text'
[23:16:28] kryptonradon: that doesn't work if it's an error
[23:16:31] terrellt: Still hate 1.9 syntax
[23:16:33] pipework: kryptonradon: respond_to
[23:16:39] Radar: kryptonradon: What do you mean "an error"?
[23:16:57] kryptonradon: an error message when rails raises an error
[23:17:10] Radar: kryptonradon: Show us.
[23:17:10] pipework: kryptonradon: My car is broken. I don't know how, it just is.
[23:17:11] kryptonradon: when I try to return it I get an html page
[23:17:18] Radar: kryptonradon: code?
[23:17:33] kryptonradon: render :text => _new_fish.new_fish(_female_fish_uuid, _male_fish_uuid)
[23:17:34] kryptonradon: logger.error "new_fish: error creating new fish: " + $!.to_s
[23:17:34] kryptonradon: render :text => "new_fish: error creating new fish " + $!.to_s + "\n"
[23:17:34] kryptonradon: # return "new_fish: error creating new fish " + $!.to_s + "\n"
[23:17:41] helpa: kryptonradon: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[23:17:41] Radar: kryptonradon: !gist
[23:18:01] Radar: kryptonradon: I don't see any HTML being returned there.
[23:18:30] kryptonradon: I will put it on github
[23:18:53] Radar: Except that raise at the end is going to return the "Something went wrong" page.
[23:19:00] Radar: it seems illogical to raise inside a resuce
[23:19:44] kryptonradon: that was before I understood the error would propagate back up the call chain
[23:19:50] pipework: Radar: Well, what if you can only conditionally handle an exception, or you want to send it to errbit?
[23:20:04] Radar: pipework: I don't understand the question.
[23:20:11] pipework: <Radar> it seems illogical to raise inside a resuce
[23:21:48] Radar: I still don't understnad.
[23:21:59] mozzarella: alright guys
[23:22:00] pipework: There are reasons to raise within a rescue.
[23:22:10] mozzarella: where's the best place to shorten the file names with paperclip?
[23:22:30] Radar: pipework: sure
[23:22:38] mozzarella: I want to shorten them before they're saved to the db
[23:22:44] Radar: pipework: If you want to re-raise another exception. That's not happening here.
[23:22:52] pipework: Radar: right
[23:22:54] Radar: mozzarella: probably as a callback on Paperclip somewhere.
[23:23:09] kryptonradon: oh I fixed it somehow
[23:23:32] kryptonradon: I think the raise I didn't need may have renders the html
[23:23:41] kryptonradon: thanks for pointing that out
[23:25:54] guest-5575: I'm trying to figure out a way to accept 10-20MB gzipped json POST request without decompressing or parsing it(i just want to write it to FS)...but am not having any luck after googling/tinkering for a few days...was hoping someone might be able to point me in the right direction..
[23:28:38] kryptonradon: my problem seems to be solved now I will test wit other controllers
[23:29:41] JoshuaPaling: Hi, I've got a non-rails-specific question about server admin for websites you build: I recently had an issue with a production database and had to restore from backup. We lost 4hrs of data. Had MySQL Bin Logs been enabled, we could have been able to restore right up to date. But we didn't enable it... nor did the client's IT company... nor did the company who the IT company outsourced to!
[23:30:09] JoshuaPaling: Who's really responsible in a siutatoin like that? SHould web dev's kind of have full responsibility for ongoing mainenance of the site?
[23:30:24] bricker`work: JoshuaPaling: who manages the database?
[23:30:50] bricker`work: JoshuaPaling: Day-to-day I mean
[23:30:55] JoshuaPaling: day to day, I do
[23:31:05] guest-5575: db backups seem a bit out of scope for a developer.
[23:31:15] JoshuaPaling: Although early on I had mentioned that they should talk to their IT company and get serious about database backups
[23:31:33] JoshuaPaling: They said they had arranged backups with IT company (whole server, once per day from what I recall)
[23:31:47] Radar: JoshuaPaling: imo it's your fault
[23:31:56] bricker`work: JoshuaPaling: Systems Administrator is responsible for that IMO
[23:32:00] Radar: You put the code on the server and setup the database.
[23:32:16] Radar: I would review the support ocntracts that you have. It might be that they only have daily backups.
[23:32:18] fschuindt: Guys, I have used Google Drive to share my project folder between my work and home computers. But when I came to home and typed 'git status' it says that somethings in my bin/ dir "modified". What that means?
[23:32:28] Radar: fschuindt: something's change.
[23:32:42] bricker`work: Also, enabling binlogging in MySQL take 3 seconds
[23:32:53] kjs3: Strong params question: Anyone know how to require multiple top-level params? I've tried params.require(:this, :that, :other), params.require([:this,:that,:other]), and multiple params.require() calls and none seem to work.
[23:32:55] JoshuaPaling: Radar OK - do devs typically have a support contract to be paid ongoing for things like regular tests of database backups?
[23:33:02] Radar: JoshuaPaling: Yes.
[23:33:53] mozzarella: where's the best place to shorten the file names with paperclip?
[23:34:03] bricker`work: kjs3: calling require multiple times is the correct way to do it
[23:34:08] JoshuaPaling: Any suggested way to find examples of what's typically offered and at what price? I'm finding it difficult to find info about this type of stuff through Google.
[23:34:09] helpa: mozzarella: Do not repeat your question every 5 minutes expecting somebody to answer it. If you do not get a reply after the first time perhaps posting your question on StackOverflow (http://stackoverflow.com) would help you. Linking to the question in the channel after you've posted it is OK.
[23:34:09] Radar: mozzarella: !rule11
[23:34:23] Radar: mozzarella: Seriously. Callback. Paperclip. Look it up. I'm confident that it can be done.
[23:34:28] Radar: JoshuaPaling: No, sorry.
[23:34:40] kjs3: bricker`work: hmm, let me try again then.
[23:34:41] kryptonradon: that unneeded raise was what cause my error message to be in html
[23:34:45] JoshuaPaling: OK no worries. I'll ask around next Ruby meetup.
[23:34:59] mozzarella: Radar: bro, I??did
[23:35:03] adiabatic: I'm trying to move from form_for to form_tag in Hartl's Rails tutorial <http://www.railstutorial.org/book/sign_in_out#sec-sign_in_out_exercises>. My changes *seem* OK, but I'm getting these errors from rspec: https://gist.github.com/adiabatic/abbebd17e1060b7eb782 . AFAICT I'm passing only one argument when it expects 2???4, but???why now? And is `visit` expecting 2???4 arguments, or what?
[23:35:07] pipework: mozzarella: Well, I'm curious why you want to use paperclip.
[23:35:23] Radar: mozzarella: and what did you find out?
[23:35:23] jonathan_alban: Hi is there anyone here who uses FactoryGirl with Cucumber?
[23:35:25] pipework: Rails handles uploads without any extra gems.
[23:35:42] Radar: adiabatic: show us what sessions/new looks like please.
[23:35:47] Radar: pipework: c'mon bro you know that's not true
[23:35:49] helpa: jonathan_alban: 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.
[23:35:49] Radar: jonathan_alban: !used
[23:35:55] EasyCo: If you had to create 10 identical records, is there a more efficient way then to do: 10.times { Post.create! } which effectively creates 10 queries instead of 1 with the data of 10. Other then writing the raw SQL query that is.
[23:36:03] koriner: probably a long shot, but has anyone used the 'mandrill_mailer' gem much?
[23:36:17] pipework: Radar: Everyone knows I'm trolling, but no one (including me) knows who is being trolled.
[23:36:26] helpa: koriner: 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.
[23:36:26] Radar: koriner: !used
[23:36:37] Radar: EasyCo: nope.
[23:36:51] adiabatic: Radar: SessionsController#new exists and is empty.
[23:36:57] adiabatic: Radar: Not that?
[23:37:03] jonathan_alban: Not sure how to FactoryGirl.create(:project) and check the project is now listed in the same test.
[23:37:12] Radar: adiabatic: The view. Not the action.
[23:37:17] Radar: # ./app/views/sessions/new.html.erb:7:in `block in _app_views_sessions_new_html_erb__1631810455194674073_70116644985140'
[23:37:19] Radar: This file ^
[23:37:24] EasyCo: Radar: Right. Good thing I'm not having to create thousands
[23:37:31] mozzarella: Radar: this is what I tried: http://fpaste.org/129152/14091826/
[23:37:38] mozzarella: didn't work as expected
[23:37:50] Radar: mozzarella: ...
[23:37:53] Radar: mozzarella: "didn't work"?
[23:38:08] kjs3: bricker`work: only the value of the last required param key gets returned from a method that has stacked (each on its own line) params.require() calls
[23:38:12] mozzarella: Radar: it doesn't modify file_file_name
[23:38:13] EasyCo: I guess I can always come back and do some performance refactoring to a singular SQL query if needed.
[23:38:18] adiabatic: new.html.erb: https://gist.github.com/adiabatic/cd0bdd0e0819805469ac
[23:38:30] mozzarella: I'm not even sure if that's how I??should do it
[23:38:31] Radar: mozzarella: Because you're not calling self.file_file_name
[23:38:35] Radar: mozzarella: You're setting a local variable there.
[23:38:52] bricker`work: kjs3: so what? What do you think the 'require' method does?
[23:39:08] Radar: adiabatic: I don't understand. This line? https://gist.github.com/adiabatic/cd0bdd0e0819805469ac#file-new-html-erb-L7
[23:39:25] Radar: adiabatic: Perhaps that should be label_tag and email_field_tag
[23:39:38] bricker`work: kjs3: If the params you pass into require() isn't present, an error is raised, otherwise nothing happens. That's it.
[23:39:44] mozzarella: Radar: holyshit that worked
[23:39:50] Radar: mozzarella: so magical
[23:40:00] Radar: bbl doing work and whatnot
[23:40:04] jake_g: I???m having a hard time getting a redirect to work after calling a create action through an AJAX request. Whats the best way to go about this? The browser is getting the 302 response but its not actually redirecting.
[23:40:27] mozzarella: the method is kind of ugly, though, can I??do better?
[23:40:30] bricker`work: jake_g: you're redirecting an AJAX request?
[23:40:32] kjs3: bricker`work: alright, I misunderstood it then. I intended the method to return a hash with all the required params. I get it now.
[23:40:54] adiabatic: Radar: weird, someone else on the Internet said it worked without the _tag. Thanks!
[23:41:03] Radar: adiabatic: those people are wrong ;)
[23:41:04] kjs3: bricker`work: I expected the built-up hash the way :permit works
[23:41:07] Radar: mozzarella: I don't know.
[23:41:57] bricker`work: kjs3: when in doubt, just look at the source : https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/strong_parameters.rb#L231
[23:42:16] matcouto: Hey Y'all, I wonder if it's worth it to create a PORO which would have a .save(request_type) method that would save and reload the object's list according to the request type passed in? Trying to avoid after_create callback on the controller. Basically, I want to create/reload this list of object only when it's a js request.
[23:42:25] jake_g: bricker`work: Yeah, maybe that doesn???t make sense. I???m using dropzone.js which uploads a file and runs through the create action but (I???m pretty sure) thats happening through an ajax request. So once that file upload is complete, I want to redirect to the show view
[23:42:38] kjs3: bricker`work: touch?? :)
[23:43:26] bricker`work: matcouto: use respond_to with format.js
[23:44:10] bricker`work: jake_g: if it's an AJAX request, then use a success callback to redirect from the client
[23:44:43] bricker`work: jake_g: server should just send back a success response, 201 created perhaps
[23:45:33] jake_g: bricker`work: Alright thanks! I???ll play around with that. I???m realizing that I???m not entirely sure how dropzone.js works so Ill read up on that and make sure I fully understand what type of a request it makes
[23:46:54] jonathan_alban: Having a tough time with cucumber and factory girl is anyone could give a hand
[23:47:38] matcouto: bricker`work that's the idea but i'm not redirecting to any page after creating the object, but re-rendering the partial that iterates this list. So, I'd need to reload this list, or create if it's nil, at some point.
[23:48:20] jonathan_alban: In my cucumber steps I've done 'project = FactoryGirl.create(:project)'
[23:48:56] jonathan_alban: and the step that follow cant find project.name or anything. Its like project wasnt created
[23:49:37] bricker`work: jonathan_alban: use @project
[23:49:48] bricker`work: jonathan_alban: local variables don't carry over between steps
[23:50:41] bricker`work: I really wish "rescue and retry x number of times" was built-in to ruby
[23:52:57] guest-5575: https://stackoverflow.com/questions/25538692/rails-4-x-bypass-decompression-and-or-parsing-of-gzip-json-post-request -_-
[23:54:55] mozzarella: pipework: does rails provide methods to generate thumbnails?
[23:55:19] pipework: mozzarella: No, but a background worker could do that pretty damn quick! There are gems for that.
[23:55:54] bricker`work: put a background worker on it
[23:56:04] mozzarella: >there are gems for that
[23:56:10] mozzarella: paperclip's a gem for that
[23:56:27] bricker`work: that's a really subtle portlandia reference
[23:56:28] pipework: Not quite. It's a nice gem for hooking into rails and blocking requests.
[23:56:34] bricker`work: REALLY subtle
[23:56:57] pipework: bricker`work: I don't watch the show, I get enough of them showing up at places I hang out with friends and making a mockery of the whole thing.
[23:57:15] pipework: I'm like, "Hey asshole, it's my job to make fun of this place."