« Back to channel list

#RubyOnRails - 03 January 2014

« Back 1 day Forward 1 day »
[00:00:06] dagen: i try to post the data from form and i wnat to data be posted in passports table
[00:00:08] shevy: and before anyone asks ... especially don't drop bananas
[00:00:17] dagen: now the data posted only to users table
[00:00:35] dagen: thomasfedb like this?
[00:00:48] thomasfedb: dagen, your #update method is empty. I consider this to be an issue, don't you?
[00:01:05] thomasfedb: dagen, especially given that the log says "Processing by UsersController#update".
[00:01:14] thomasfedb: dagen, and yes, that was better.
[00:01:15] dagen: thomasfedb no because a cant see in logs the logger.debug sring
[00:01:37] dagen: yes UsersController
[00:01:39] thomasfedb: dagen, so your real question is "how can I log stuff from the controller?"
[00:01:43] dagen: but i try to use nested forms
[00:02:07] PPH: Hi, I'm doing Rails 4 in action's tutorial, I get and error because I passed 2 arguments to update_attributes which only takes 1 hash like this "if @user.update_attributes(params[:user], :as => :admin)". I don't understand what the :as => :admin is for... should it be part of the passed hash?
[00:02:17] dagen: thomasfedb my question is how can I post data from one form to separate tables
[00:03:12] thomasfedb: dagen, please gist a larger log extract.
[00:04:17] thomasfedb: dagen, that form will use the UsersController, not the PassportsController.
[00:04:35] dagen: i understand
[00:04:50] dagen: but how i can post data to another table trought one controller?
[00:04:52] thomasfedb: dagen, you gave me the wrong controller, and obviously if your'e updating a User you won't see logger.debug from in the PassportsController.
[00:05:12] thomasfedb: dagen, it's handled in the model.
[00:05:25] thomasfedb: dagen, gist me your UsersController, User, Passport.
[00:05:30] dagen: i stacked finally
[00:05:38] thomasfedb: dagen, google 'accepts_nested_attributes'.
[00:05:42] thomasfedb: dagen, stacked?
[00:06:19] dagen: thomasfedb omp
[00:07:49] dagen: thomasfedb https://gist.github.com/anonymous/dedf610e3f0e50b2a1bd
[00:08:00] dagen: yes, know this is horror
[00:11:23] thomasfedb: dagen, where's the rest of User.
[00:11:35] thomasfedb: dagen, additionally, with a controller like that you have no hope.
[00:12:54] thomasfedb: dagen, what are you building? how many years of Rails experience do you have?
[00:14:02] dagen: thomasfedb two month of experience
[00:14:27] thomasfedb: dagen, and what is this application?
[00:14:40] thomasfedb: dagen, because you are doing things seriously wrong.
[00:14:42] dagen: thomasfedb i try to build some web site to collect and operate with personal data of users
[00:14:53] dagen: thomasfedb for example?
[00:15:17] dagen: I'm 14 years old and i only starting with coding on ruby
[00:15:41] thomasfedb: dagen, look. i understand being a kid and a programmer.
[00:15:50] thomasfedb: dagen, i've been programming since I was 10.
[00:16:01] thomasfedb: dagen, is this your first rails application?
[00:16:33] dagen: thomasfedb yes this is my first rapp
[00:16:41] thomasfedb: dagen, yeah, thought so.
[00:16:44] Ivanskie_: okay so i did a little bit of cleaning.
[00:16:52] Ivanskie_: and got pow restarted and what not
[00:16:54] thomasfedb: dagen, you're trying to build something MASSIVE as your first app.
[00:17:05] dagen: yes i think so
[00:17:11] Ivanskie_: synced the latest files with github
[00:17:13] thomasfedb: dagen, which is always fun. But is a terrible idea.
[00:17:15] dagen: but this is the interest task)
[00:17:17] Ivanskie_: and yah, can't load gem asstets
[00:17:22] thomasfedb: dagen, I know, I know.
[00:17:47] Ivanskie_: this is what it get https://gist.github.com/i5okie/8229978 my github: https://github.com/i5okie/redress
[00:17:51] thomasfedb: dagen, but what I see in here, 90% of the time, is people trying to run before they can walk, and it all comes tumblding down.
[00:18:12] bricker: people should not learn programming with Ruby. It teaches bad habits, imo. People should learn to program in a language that enforces things like return values and variable types. Then when you get to Ruby, the flexibility is awesome but you're trained well enough to know when and when not to use it.
[00:18:17] dagen: thomasfedb what is wrong with my code, what should I draw my attention?
[00:18:18] thomasfedb: dagen, build somethign small first, then get somebody to critique it, get advice, what did you do well, what did you do wrong?
[00:18:34] thomasfedb: dagen, go build a simple blog first.
[00:18:49] thomasfedb: dagen, as for what is wrong - it's hard to not just say "everything is wrong", but I'll try:
[00:18:55] thomasfedb: dagen, - you methods are too long
[00:19:08] thomasfedb: dagen, - your logic is in the controller, it should be in the model.
[00:19:21] bricker: too procedural
[00:19:30] thomasfedb: dagen, - massively too procedural
[00:19:57] dagen: "methods to long" do you mean the name of methods or code into?
[00:20:00] thomasfedb: dagen, that is quite honestly, the worst rails controller I've ever seen in my entire life, and I've seen a few,
[00:20:02] dagen: procedural?
[00:20:19] dagen: the worst?)))
[00:20:22] dagen: so sweet!
[00:20:31] dagen: but how i can do that better?
[00:21:12] terrellt: dagen: One controller per 'thing' pal.
[00:22:01] thomasfedb: Ivanskie_, see https://github.com/twbs/bootstrap-sass#usage
[00:22:08] dagen: what do you mean by 'thing'?
[00:22:14] thomasfedb: Ivanskie_, you should be using @import "bootstrap".
[00:22:28] thomasfedb: dagen, I mean the code.
[00:22:37] thomasfedb: dagen, methods over 10 lines is when I start breaking them down.
[00:22:37] Ivanskie_: thomasfedb: thanks, i've just googled that as well. getting it fixed :)
[00:23:07] thomasfedb: dagen, controller methods, are almost always 5 lines or less.
[00:23:15] dagen: thomasfedb WOW
[00:23:21] thomasfedb: dagen, especially if you're doing something as simple as updating a user.
[00:23:37] thomasfedb: dagen, you model should handle all the logic.
[00:23:38] zeknox: im using devise for authentication and looking for advice on how to change where devise redirects to when a restricted resources is accessed
[00:23:53] thomasfedb: zeknox, google it yet?
[00:23:54] dagen: thomasfedb but i don't know how it should be
[00:24:05] zeknox: thomasfedb: yeah, looking into overriding the redirect_url
[00:24:30] terrellt: dagen: That whole update statement should be something like @user = User.find(params[:id]); user.attributes = user_params; flash[:success] = "User Updated" if user.save; respond_with @user;
[00:24:37] thomasfedb: zeknox, sounds promising.
[00:25:05] zeknox: thomasfedb: you think im able to override right within the ApplicationController?
[00:25:15] terrellt: dagen: I know it's hard to take in, but you need to back up a few steps. Go check out some tutorials that use scaffolding, then slowly move up.
[00:25:38] thomasfedb: dagen, here's one of my controllers: https://gist.github.com/thomasfedb/8230113
[00:26:05] thomasfedb: dagen, yes. as terrellt says, you need to start small. otherwise you'll never get anywhere.
[00:26:20] dagen: ACTION *sigh*
[00:26:36] thomasfedb: dagen, we've all done it. no shortcuts.
[00:26:45] thomasfedb: dagen, good job starting young though.
[00:26:56] dagen: i understood
[00:27:05] terrellt: I remember my first apps...PHP monstrosities.
[00:27:20] dagen: i hate php
[00:27:34] dagen: i try it but it's nightmare
[00:28:11] thomasfedb: terrellt, haha. I have to maintain my first CakePHP site that went live.
[00:28:15] dagen: but with a ruby I could do so much more in a short time
[00:28:16] thomasfedb: terrellt, bloody nightmare.
[00:28:25] dagen: i allready have working web site)
[00:28:26] terrellt: thomasfedb: Hate CakePHP with the passion of a thousand fiery suns.
[00:28:27] thomasfedb: dagen, that's okay, we hate PHP too.
[00:28:32] dagen: but yes my code is horror
[00:28:37] thomasfedb: terrellt, same here.
[00:28:39] dagen: that's cool)
[00:28:53] thomasfedb: dagen, good you admit it :P
[00:29:50] dagen: thomasfedb can you advice me - how i must get out the code from my controller to model?
[00:29:55] dagen: for example?
[00:30:52] dagen: that I might bring my code in order by analogy with Example...
[00:31:47] PPH: anyone can tell me why I get this error "wrong number of arguments (2 for 1)" for this line of code "if @user.update_attributes(params[:user], :as => :admin)" ?
[00:31:51] thomasfedb: dagen, to be perfectly honest I read about a third of one method in your controller before I gave up.
[00:32:20] thomasfedb: dagen, it would be better for you to start something simple, and then ask how to add some feature you want in the correct way.
[00:32:29] thomasfedb: dagen, then we can give you advice.
[00:32:41] thomasfedb: dagen, here's an analogy:
[00:33:10] PPH: I know update_attributes is expecting 1 argument, but I tought (params[:user], :as => :admin) was compting for 1 hash
[00:33:13] thomasfedb: dagen, if you were learning to knit, and brought me a big knot of wool and asked me how it should look, i would have trouble.
[00:33:16] dagen: i can't start something simple) because i allready start this project for my school
[00:33:22] dagen: and there is no way back
[00:33:28] thomasfedb: dagen, but if you asked me how you should start, i could help.
[00:33:34] thomasfedb: dagen, right, school project?
[00:33:54] thomasfedb: terrellt, I am only trying to be helpful.
[00:34:11] dagen: thomasfedb this site is for my school project
[00:34:17] thomasfedb: dagen, what's the required scope for the project?
[00:34:23] dagen: and i can't drop them right now
[00:35:03] thomasfedb: dagen, yeah, requirements, etc
[00:35:13] dagen: do you mean subject area?
[00:35:22] thomasfedb: dagen, no, i mean scope.
[00:35:38] thomasfedb: dagen, what were you told to do?
[00:35:43] dagen: ummm i have some troubles with understand this words
[00:36:08] thomasfedb: dagen, what is the project?
[00:36:24] Eyeball26: Hey noob question.. when i run rspec I get this error.. .rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-rspec-4.2.0/lib/guard/rspec/formatter.rb:7: warning: already initialized constant Guard::RSpec::Formatter::TEMPORARY_FILE_PATH
[00:36:33] Eyeball26: Don't really understand the message
[00:36:36] dagen: i must code some web site to collect and store users data, wich can be modified in a some time by users and admins
[00:37:12] thomasfedb: dagen, and how long do you have to finish it?
[00:37:13] dagen: i need email_confirmation method wich allready codede and works fine
[00:37:30] thomasfedb: Eyeball26, that's just a warning, shouldn't stop RSpec from working. Have you googled it?
[00:37:32] dagen: one month
[00:37:39] PPH: anyone know if there is some source code for rails 4 in action I can find somewhere to compare my code with?
[00:38:07] thomasfedb: PPH, anything specific you want to compare? It's pretty similar to Rails 3.2 in many ways.
[00:38:08] PPH: I think there's an error in the book that's blocking me
[00:38:18] dagen: now all working fine but code is tarrible
[00:38:31] dagen: and some kind of functional is a little bit buggy
[00:38:35] thomasfedb: dagen, are you being marked on code?
[00:38:46] thomasfedb: dagen, have you considered tests at all?
[00:39:06] dagen: marked on code?
[00:39:09] dagen: what does it mean?
[00:39:22] Eyeball26: thomasfedb I've searched but not getting anyhwere.. The trace is a lot longer was trying to cut down on the amount of text
[00:39:23] dagen: tests yes i testing my code by hands
[00:39:25] thomasfedb: dagen, will you teacher look at your code?
[00:39:37] dagen: my teacher is don't understand ruby)
[00:40:01] dagen: but he looking at my code yes)))
[00:40:15] dagen: nods and grunts pointedly
[00:40:20] thomasfedb: dagen, right. don't you think he'll be a little concerned about you code?
[00:40:24] PPH: thomasfedb, in app/controllers/admin/users_controller.rb, the book say to input this line of code in the update method "if @user.update_attributes(params[:user], :as => :admin)", but I get an error about wrong number of arguments...
[00:40:57] thomasfedb: PPH, right. I wouldn't be using `attr_accessible` in Rails 4.
[00:41:08] thomasfedb: PPH, you can make it work with a gem (not included by default).
[00:41:11] dagen: important for him that the site worked, but as it is not important
[00:42:03] dagen: PPH maybe params[:user] is not correct?
[00:42:15] PPH: thomasfedb, I don't understand the :as => :admin part
[00:42:15] thomasfedb: PPH, rails 4 you should be using strong parameters, google it.
[00:42:24] PPH: dagen, nope it is
[00:42:36] thomasfedb: PPH, that's setting the role, and isn't used in Rails 4.
[00:42:54] PPH: thomasfedb, I know I been using that so far
[00:43:07] thomasfedb: PPH, remove the ":as => :admin".
[00:43:13] PPH: thomasfedb, ok
[00:43:13] thomasfedb: PPH, you don't need it.
[00:43:20] PPH: thomasfedb, ok thx
[00:44:02] thomasfedb: PPH, no worries.
[00:44:05] dagen: thomasfedb It seems that I was not destined to understand how to use the different tables to post the data into they
[00:44:42] thomasfedb: dagen, if you create a new application, then I can guide you how to build an example of building associated records though the same form.
[00:44:50] dagen: i tried to google it and read the examples, but...
[00:45:13] dagen: thomasfedb ok
[00:45:37] thomasfedb: dagen, create a new application with just a Person model and PersonsController.
[00:46:01] thomasfedb: dagen, use the `rails g scaffold`.
[00:46:11] dagen: scaffold?
[00:46:38] tylersmith: upgrading from rails 2 to 3. if a block helper calls 'yield', it returns the entire template up to where i called the helper. capture(&block) works as expected
[00:46:50] tylersmith: any resources about this behavior? can't find anything on google
[00:47:05] dagen: thomasfedb ok
[00:49:00] thomasfedb: tylersmith, http://railscasts.com/episodes/208-erb-blocks-in-rails-3?view=asciicast
[00:49:05] thomasfedb: dagen, done that?
[00:49:31] dagen: thomasfedb reading about scaffold
[00:50:14] thomasfedb: dagen, good. it's very helpful when you're beginning.
[00:51:00] dagen: thomasfedb i create new app named nested and now try to rails g scaffold person person:string
[00:51:42] thomasfedb: dagen, I would do name:string rather than person:string
[00:52:13] dagen: hmm... what?
[00:52:29] dagen: name of the user?
[00:52:35] thomasfedb: dagen, name of Person
[00:54:13] dagen: dev> rails> ~/nested$ rails g scaffold person name:string
[00:54:13] dagen: The program 'rails' is currently not installed. You can install it by typing:
[00:54:13] dagen: sudo apt-get install rails
[00:58:59] mwlang: does Rails 4 strong parameters require that you base off params.require(:some_model).permit(:x, :y, etc..) or can I allow/permit any hash's key/value pair?
[01:00:03] PPH: I don't understand the question
[01:00:23] PPH: mwlang*
[01:00:25] mwlang: in other words, if I created this hash: {:remote_ip: request.env["REMOTE_ADDR"], referrer: request.referer, user_agent: request.env["HTTP_USER_AGENT")}
[01:01:05] thomasfedb: dagen, i wouldn't isntall rails that way
[01:01:09] mwlang: basically, I don't need anything off the params for one of my controller actions, I just want to capture some info off the actual request object.
[01:01:33] dagen: ACTION sigh
[01:01:44] thomasfedb: mwlang, sure.
[01:02:00] thomasfedb: mwlang, if you're not passing to a model you don't even need .permit
[01:02:05] mwlang: ok, I just wasn't sure where the #permit and #require methods came from.
[01:02:18] thomasfedb: dagen, rails should always be installed with `gem install rails`
[01:02:18] mwlang: I'm passing to a model.
[01:02:28] dagen: thomasfedb thank you for your time and advices, but i can't understand how i can do this... sorry, too little exeperince yet
[01:02:28] thomasfedb: dagen, what ruby version do you have installed? `ruby -v`
[01:02:41] dagen: thomasfedb i use RVM
[01:02:48] thomasfedb: dagen, good.
[01:02:51] thomasfedb: that's excellent.
[01:02:59] thomasfedb: dagen, what's the problem?
[01:03:01] dagen: ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
[01:03:13] dagen: thomasfedb it's hard to understand how and what i must to do...(
[01:03:36] mwlang: actually, I'm just gonna try it and see what happens...
[01:03:45] thomasfedb: dagen, probably first create a gemset: `rvm use 1.3.3-p0@nested --create`
[01:03:56] thomasfedb: dagen, then install rails `gem install rails`
[01:04:18] thomasfedb: dagen, then create the rails application `rails new nested` and get into the directory `cd nested`
[01:04:36] dagen: i allready creates rails new nested
[01:04:49] thomasfedb: dagen, okay. what's the issue then?
[01:05:08] dagen: it's hurd to understand how and what
[01:05:11] dagen: really hard
[01:05:15] dagen: i'm so sorry
[01:05:50] thomasfedb: dagen, no worries.
[01:06:07] thomasfedb: dagen, in any case, there should always be somebody around here to try and help.
[01:06:23] dagen: continue ongoing work on the project
[01:06:30] dagen: thank you for all
[01:07:11] thomasfedb: dagen, all the best!
[01:07:54] mwlang: undefined method `permit' for #<Hash:0x007ffa3ee6e3b8>
[01:09:06] shevy: mwlang that means that the Hash class you have there does not know a method called #permit
[01:10:18] mwlang: yeah, looks like self-made Hashes don't require you to fiddle around with strong params at all -- the model actually saved with the values I constructed the hash with.
[01:10:26] mwlang: (without having to use #permit)
[01:10:36] lethjakman: mwlang: yes, strong params only work with params
[01:11:01] mwlang: so that answers my decidedly unclear question at the beginning
[01:11:34] thomasfedb: mwlang, .permit is only required when passing params or some part of params to a model.
[01:11:35] mwlang: I just didn't know where the strong params was coming from so I didn't know when to use/not use.
[01:12:15] thomasfedb: mwlang, if you do `params.class` you find it's actually a Parameters class behind that hash-like object.
[01:12:19] mwlang: thomasfedb: I think I'll dig into the strong_parameters gem's source and try to learn a bit more about it.
[01:12:25] thomasfedb: mwlang, I should know, I wrote part of it.
[01:12:40] lethjakman: hrm...so I have config.assets.js_compressor = Uglifier.new(:mangle => false) set but it still seems to be mangling my angular
[01:12:44] mwlang: thomasfedb: funny quip
[01:12:44] lethjakman: anyone had that happen?
[01:12:53] thomasfedb: mwlang, good idea, although it's actually intergrated directly into rails. the gem is only for compat. with older rails
[01:13:46] mwlang: thomasfedb: all in all, a huge improvement over the attr_accessible approach of Rails 3
[01:14:25] lethjakman: thomasfedb: do you do a lot of work on rails?
[01:15:32] thomasfedb: mwlang, https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/strong_parameters.rb
[01:15:44] thomasfedb: lethjakman, only little bits. I do little bits for a number of projects.
[01:15:52] thomasfedb: lethjakman, I tend to scratch my own itches.
[01:15:59] lethjakman: good way to go about it
[01:16:12] lethjakman: I keep wanting to do more of that as I'm learning more but I never seem to have the time
[01:17:50] mwlang: nice to see well-commented code -- this is actually more useful that guide's docs.
[01:23:28] thomasfedb: mwlang, it gets turned into the api.rubyonrails.org, which are the docs I used.
[01:23:45] thomasfedb: mwlang, although i do remember adding a mention of it into the docs.
[01:30:55] dagen: thomasfedb
[01:32:51] Radar: thomasfedb: help us
[01:32:56] Radar: thomasfedb: you're our only hope
[01:33:22] mwlang: uh-oh???.we're dooomed.
[01:33:23] dagen: thomasfedb oh sorry misst
[01:34:01] thomasfedb: Radar, oh hello. go does one go?
[01:34:17] Radar: thomasfedb: one goes good
[01:34:38] thomasfedb: Radar, one is most pleased to here of thou going
[01:34:40] mwlang: is it just me, or is Facebook nigh unresponsive at the moment?
[01:35:05] thomasfedb: mwlang, just you
[01:35:08] Radar: Works for me
[01:36:55] mwlang: heh???its main interface seems fine -- its the sharer.php stuff that ain't working (trying to get social icons working')
[01:37:24] thomasfedb: Radar, I released a gem: rspec-expect_it
[01:37:58] dagen: ACTION ...
[01:38:04] mwlang: sounds like something to improve upon shoulda?
[01:39:42] dagen: ACTION ...
[01:40:25] mwlang: hmmm..instead of expect_it_safe, how about expect_it_to_raise ??? :-)
[01:40:48] thomasfedb: mwlang, nope, not a shoulda replacement, although I'm working on one of those.
[01:41:18] droptone: anyone work with ckeditor before?
[01:43:11] droptone: thomasfedb: becuase of the question just posted
[01:43:55] thomasfedb: droptone, yes, before i saw said question.
[01:43:57] droptone: I'm scouring the web looking for answers, I did the default paperclip integration as outline in the github documentation, and built a blog with CKeditor as the WYSIWYG editor for the body field, it works fine
[01:43:59] mwlang: I guess I was unclear -- I wouldn't want to be squashing exceptions willy-nilly in specs, but would definitely be interested in testing that it actually does raise exception with a syntax like "expect_it.to_raise RuntimeError
[01:44:03] droptone: thomasfedb: no worries
[01:44:28] thomasfedb: droptone, http://4loc.wordpress.com/2011/06/29/uploading-images-with-ckeditor-and-paperclip/
[01:45:17] droptone: yes, I was just reading that blog post, is that content current?
[01:45:22] droptone: we're using rails 3.2.15
[01:45:22] thomasfedb: mwlang, you can do `expect_it.to raise_error(ExceptionClass)`
[01:45:38] bricker: Am I crazy or did github add some significant left padding on the diff views?
[01:45:40] thomasfedb: droptone, you should be able to adapt it.
[01:45:41] bricker: like, recently
[01:45:49] bricker: it makes it look like everything is indented 2 spaces
[01:45:52] droptone: ok, Ill give this a go, thanks thomasfedb
[01:46:12] thomasfedb: mwlang, the _safe syntax is so you can use block matcher to asset things have not occured. docs give an example.
[01:51:41] dagen: ACTION test
[01:56:20] mwlang: Does URI not allow you to set query to a hash and then give you back a fully encoded URL?
[01:56:35] mwlang: I could've sworn I did this in another project.
[02:00:14] mwlang: nvm, I forgot I used a gem, Addressable.
[02:39:23] sanjaykumarco: I'm a newbie to ror. I have given the command <%= yield(:title) %> in the title and also given the value using the provide command. But wen i run it, it is not showing in the browser. It instead shows Sample App which is the h1 tag. And it doesnt even show any errors...Please help...
[02:40:53] sanjaykumarco: ledestin, I'm a newbie to ror. I have given the command <%= yield(:title) %> in the title and also given the value using the provide command. But wen i run it, it is not showing in the browser. It instead shows Sample App which is the h1 tag. And it doesnt even show any errors...Please help...
[02:41:30] bricker`LA: sanjaykumarco: have you set `content_for(:title) { "Your Title" }` somewhere?
[02:44:25] dseitz: Have you provided in the title in the views?
[02:44:54] jalcine: sanjaykumarco: provide does't work the way you think it does
[02:46:26] dseitz: Just keep working through the book; make sure your tests are passing
[02:46:43] sanjaykumarco: bricker`away, i have given <% provide(:title, 'Home') %>
[02:47:05] sanjaykumarco: dseitz, yes. I have provided for the title
[02:48:05] sanjaykumarco: dseitz, yes im working through the book. But im stuck here... If it throws some error, i could solve it. But none
[02:48:13] HereForTheBoredo: tubbo: you still around?
[02:48:24] dseitz: What is the error?
[02:48:55] sanjaykumarco: dseitz, it doesnt throw any error...
[02:49:04] dseitz: Oh I misread
[02:49:20] sanjaykumarco: dseitz, the title just doesnt show
[02:49:29] dseitz: And your tests are passing?
[02:49:58] sanjaykumarco: dseitz, yes. it passed all..,. Ill paste my code of home.html.erb
[02:50:10] dseitz: okay; use gist if you know how
[02:50:13] sanjaykumarco: <% provide(:title, 'Home') %>
[02:50:13] sanjaykumarco: <!DOCTYPE html>
[02:50:13] sanjaykumarco: <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
[02:50:17] sanjaykumarco: <h1>Sample App</h1>
[02:50:21] sanjaykumarco: This is the home page for the
[02:50:23] sanjaykumarco: <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
[02:50:25] sanjaykumarco: sample application.
[02:50:51] dseitz: Probably get a warning in a moment; use gist in the future :)
[02:51:06] sanjaykumarco: dseitz, sorry :)
[02:51:46] dseitz: everything looks sane and from what you have provided I would assume that home.html.erb is sane as well - since your tests are passing
[02:52:06] dseitz: my inquiry would be, what do you expect <title></title> to do?
[02:52:59] sanjaykumarco: dseitz, it should print Ruby on Rails Tutorial Sample App | Home...But now its printing Sample App
[02:53:37] dseitz: okay, your code is working right; title typically is used on the tab/window frame
[02:53:47] dseitz: it won't actually be part of the web display
[02:53:50] dseitz: typically
[02:55:02] sanjaykumarco: dseitz, yes i know. but how is sample app popping up? I dont get it...is it some rails sensible defaults?
[02:56:06] dseitz: I guess I'd have to see it to get an idea :)
[02:57:08] dseitz: try http://snag.gy
[02:57:09] sanjaykumarco: dseitz, okey. thanks anyways
[03:03:04] bricker`LA: sanjaykumarco: You may be looking at the wrong template
[03:03:30] bricker`LA: sanjaykumarco: or otherwise your templates aren't reloading (are you in development mode?)
[03:04:33] sanjaykumarco: bricker`away, see the embedded ruby is working in h1 tags and p tags but not in title tags... i dont know y?
[03:06:44] bricker`LA: sanjaykumarco: Try emptying the whole template and reload the page just to test.
[03:11:45] sanjaykumarco: bricker`away, still the title is sample app
[03:12:07] dseitz: reload the server
[03:12:07] bricker`LA: sanjaykumarco: then you're looking at the wrong thing, I guess.
[03:12:39] sanjaykumarco: bricker`away, title is the content that appears on the browser tab right?
[03:12:46] bricker`LA: sanjaykumarco: that's correct
[03:14:24] HereForTheBoredo: hey guys, is there anything that I should look at on a new install of centos that would prevent me from being able to even ping https://rubygems.org with and without https
[03:14:57] HereForTheBoredo: I can ping fine from my workstation
[03:15:11] dseitz: server doesn't respond to ping
[03:15:50] HereForTheBoredo: I get a response
[03:16:42] HereForTheBoredo: after running a ping on my workstation I see this: PING https://rubygems.org/ ( 56 data bytes
[03:16:44] HereForTheBoredo: I then ping the ip from my vps and that works
[03:16:49] HereForTheBoredo: so some type of dns issue i suppose?
[03:18:58] bricker`LA: HereForTheBoredo: I think the default ipconfig for CentOS is to block all HTTP traffic (incoming and outgoing)
[03:19:14] bricker`LA: or any traffic, for that matter
[03:20:55] HereForTheBoredo: I'm not very knowledgable, but I can wget files
[03:21:00] HereForTheBoredo: and I've installed rvm and ruby
[03:21:59] jalcine: bricker`LA: that's. so. stupid
[03:22:07] jalcine: why would CentOS do that?
[03:22:18] jalcine: At least leave 80 and 443 open
[03:22:24] Criten: Can anyone else get to this documentation? http://rdoc.info/gems/twitter
[03:22:27] bricker`LA: jalcine: when it comes to security, off-by-default is always better.
[03:22:27] HereForTheBoredo: I'm talking about centos server if that makes a diff
[03:22:28] Criten: it's a redirect loop for me
[03:23:35] dseitz: http://rdoc.info/gems/twitter/frames
[03:23:53] Criten: dseitz, thanks :P
[03:24:38] dseitz: The link you did give though, was indeed an infinite loop
[03:24:52] dseitz: looks crazy in dev. tools
[03:25:18] dseitz: Where as http://rdoc.info/gems/twitter/ is valid
[03:27:28] Criten: they should probably update their links
[03:28:10] Criten: oh that is weird..
[03:28:14] Criten: whatever.
[03:29:42] pontiki: looks like the server is misconfigured
[04:49:14] Criten: I guess it's almost technically morning
[04:54:58] dseitz: It's BCS time :)
[04:55:06] bbhoss: anyone ever seen Chrome show a "422 (OK)" as an error code? Sending back an unprocessable_entity (422) on a POST.
[04:57:59] dseitz: is there a backtrace somewhere?
[05:09:46] bratsche: It's always morning somewhere.
[05:20:17] Eyeball26_: anyone care to give a noob a hand?
[05:26:23] FLeiXiuS: Anyone familiar with a spherical panorama api that will allow me to add notes/markers to it?
[05:26:51] FLeiXiuS: street view only allows me to add street level markers rather markers at x/y/z
[05:32:51] thomasfedb: FLeiXiuS, nope.
[05:33:44] FLeiXiuS: thomasfedb, mmmm any ideas?
[05:34:12] FLeiXiuS: I was thinking of modifying the images then saving them again with the notes ,etc.
[05:34:13] RubyRonin: does anyone have any experience using stripe with rails?
[05:34:39] thomasfedb: RubyRonin, I've read through the API, what's the problem?
[05:35:04] thomasfedb: FLeiXiuS, I bet you can do it with google maps and some fun js.
[05:35:36] FLeiXiuS: thomasfedb, I havent seen any way of doing altitude based points
[05:37:00] Criten: RubyRonin, I use it and it works fine
[05:38:01] RubyRonin: Criten: do I have to create the stripe.rb file after installing the gem?
[05:38:18] Criten: If it's not there you do!
[05:38:21] Criten: is it the initulizer?
[05:38:34] Criten: initializer*
[05:38:47] Criten: Yeah you need to make that
[05:38:58] RubyRonin: config/initializers/stripe.rb
[05:39:06] RubyRonin: Criten: thanks
[05:39:22] Criten: I haven't created a new app with stripe in a while
[05:39:27] Criten: but i'm pretty sure i had to create it
[05:39:56] Criten: I need to get going... bedtime for me
[05:40:03] Criten: ping me tomorrow if you need help
[05:45:10] bbhoss: dseitz: No backtrace because there is no error. Rails is sending back a 422. The issue is SOMETIMES it sends back "HTTP/1.1 422 Unprocessable Entity" and sometimes JUST "HTTP/1.1 422"
[06:14:30] zrl: what's the recommended way to do file processing in rails? say i have about 200mb of files i want to process and then zip before emailing a link to the user?
[06:14:51] zrl: mostly text files that need searching and replacing
[06:15:31] bricker`LA: zrl: Ruby has good File utilities built-in to the core library
[06:15:57] zrl: yeah, but what about the rails part? i assume i'm looking for some sort of queue system?
[06:22:17] bricker`LA: zrl: to process the files in the background? Yes, background workers would be a good idea. Resque or Sidekiq.
[06:46:16] chare: how do you guys get communication between rails processes?
[06:46:19] chare: whats the idiomatic way to do that
[07:03:36] BrazenBraden: i dont get it... i have a simpleform association group_select (which was working perfectly) but now instead of showing the collection item names, it gives me the object name (e.g. Model:0x00fthagtrssdafblegh)... I dont know what I have changed to loose the values :(
[07:38:59] krz: is initialize_on_precompile not needed in Rails 4? the guide says / assumes its there through http://guides.rubyonrails.org/asset_pipeline.html
[07:47:47] krz: through=though. oh well. guess not needed in 4
[07:59:28] BrazenBraden: not sure what to show but here is a gist with some stuff i guess.. https://gist.github.com/brazenbraden/7b822ca2ba0290df2ef7
[08:41:57] dopie: Hello all... here's my question. I am using ckeditor which uploads files to public/uploads dir... everytime i run a cap deploy it erases those files how can i tell git to not delete those files???
[08:42:03] dopie: should i have them hosted elsewhere?
[08:42:22] bricker`LA: dopie: upload them to shared/uploads and symlink
[08:43:49] dopie: bricker`LA, thank ye
[08:44:02] dopie: atleast my questions are getting a bit more advanced :P
[08:48:42] dopie: bricker`LA,
[08:48:45] dopie: something like this
[08:48:46] dopie: https://gist.github.com/staycreativedesign/8234897
[08:48:49] BrazenBraden: interesting... Model.all works fine for a simple_form colletion.. but Model.order(:name) does not.. why?
[09:17:51] elaptics: BrazenBraden: in a rails 3 or 4 app?
[09:18:27] elaptics: BrazenBraden: hmm that's odd then. I would expect that behaviour of a rails 3 app because #all was just a wrapper for #find(:all)
[09:18:39] elaptics: afaik in rails 4 it's implemented as a scope
[09:19:00] BrazenBraden: should it be Model.order(:name).find(:all)
[09:19:33] elaptics: BrazenBraden: Model.order(:name).to_a would probably do
[09:19:55] elaptics: BrazenBraden: you just need to call something on the scope to get the query to be done
[09:19:58] BrazenBraden: oke.. i dont mind having .all there but someone told me that it was bad practice..
[09:20:54] elaptics: BrazenBraden: well .to_a will do it
[09:21:13] elaptics: BrazenBraden: for collections in simple form, it takes an array or a range
[09:21:23] BrazenBraden: ok.. is it better (more efficient?) than .all?
[09:21:30] elaptics: BrazenBraden: which?
[09:21:42] BrazenBraden: using order().to_a instead of .all
[09:21:52] elaptics: instead of order().all ?
[09:22:08] BrazenBraden: nah just Model.all
[09:22:58] elaptics: BrazenBraden: well in rails 4 all is now a scope so it won't happen until something else is done on it
[09:23:40] elaptics: BrazenBraden: what I don't know off the top of my head is whether simple_form is implicitly taking what's passed in collections and converting it to an array or range
[09:25:55] elaptics: well relation objects have a to_a method so I'd assume that simple_form must call it
[09:26:16] elaptics: but then I don't know why just doing Model.order(:name) wouldn't work
[09:26:40] chirag7jain: i am using pluginaweek/statemachine gem. is there a way i can confiqure a different field name to act as state instead of having a state field. i already have state field in my table which i use for storing address
[09:27:39] elaptics: chirag7jain: yes
[09:28:55] chirag7jain: can anyone help me with state machine gem
[09:29:28] elaptics: chirag7jain: in the dsl you specify it, i.e. state_machine :your_state_field_here, :initial => :foo do ???..
[09:32:58] chirag7jain: #elaptics thanks...
[09:39:34] BrazenBraden: elaptics: i am so confused
[09:40:14] BrazenBraden: elaptics: boss came in.. showed him i finally got the list to work by changing .order() to .all()... changed it back to .order() to show what it was doing.... and it works fine.. -.-
[09:44:34] elaptics: BrazenBraden: odd
[09:56:11] henn1nk: Hello guys, i set in my application.rb file config.autoload_paths += %W(#{config.root}/lib) .. but the file located in the lib folder isn't loaded. what did i miss? (rails4)
[09:59:43] pehlert: Hey folks. Does anyone know how Net::HTTP determines which charset it uses for form data?
[10:01:42] tbuehlmann: henn1nk, there are just load paths edited, you still need to require the file manually
[10:03:16] henn1nk: tbuehlmann: just in my application.rb?
[10:05:43] tbuehlmann: henn1nk, either there or better at the place where you actually need the library
[10:09:13] henn1nk: tbuehlmann: i tested it like this, but doesn't work: https://gist.github.com/henn1nk/8235710
[10:36:09] henn1nk: tbuehlmann: omg, got it ;-)
[10:53:17] certainty: tagrudev: yolo
[10:54:12] tagrudev: certainty, yo
[10:56:54] tbuehlmann: henn1nk, what was it?
[10:57:24] henn1nk: tbuehlmann: i require the file now in an initializer
[11:06:32] gerep: Hi all. I'm making a call to an API and I'm expecting this: 'Pedido j?? cancelado' but I'm receiving this: 'Pedido j\\u00e1 cancelado.' is there a way to fix it? What is it?
[11:11:07] Oog: is there a faster way to execute User.find_all_by_user_id(current_user.id).each { |user| strings.push(user.my_value) }
[11:11:20] Oog: basically I want to get all my_value values out of User table into a single array where the rows user_id=current_user.id [06:10] <pretty_function> more like a #sql question
[11:11:32] Oog: so i cant even copy paste right
[11:11:34] Oog: but you see what i want
[11:11:45] Oog: i join ed#iphonedev by accident lol
[11:15:59] elaptics: Oog: I'm not quite sure what you want - can you try explaining again
[11:16:30] ksinkar: with redis version 2.2.2 and above and resque version 1.25.1, is anyone facing reconnection issues after forking from the parent process?
[11:21:36] Oog: elaptics: I have User model with fields a and b
[11:21:46] Oog: i want to select all the b fields from User model where a = x
[11:22:04] Oog: i only care about b fields and i just want it as fast as possible
[11:22:06] Oog: there could be a lot fo them
[11:22:12] Oog: i wat them in an array
[11:22:32] Oog: im wondering if there is a faster way than doing array.push 5,000 times etc
[11:22:57] certainty: normally you can pluck single values. Don't know if that works with scopes though
[11:24:16] certainty: Somemodel.where(:id => yourid).pluck(:field) or something
[11:24:38] certainty: no project here to test that
[11:26:37] certainty: apidocs support my suggestion http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-pluck
[11:34:16] tommoor: Does anyone know how to render a partial without it parsing ERB tags? I assumed that not adding .erb to file extension would achieve this??? but it seems to parse them anyway
[11:35:01] tommoor: I've kind of resorted to find a way of escaping the template on file read, before render - but that's equally difficult it seems
[11:35:17] Oog: certainty: thanks ill try it
[11:37:14] Oog: awesome that looks like it
[11:37:37] phipes: hi all. i have attr_accessor var, before_update callback, and in the callback method i set var to something. how come the value is not being persisted between method calls?
[11:38:05] certainty: phipes: show us some code
[11:43:20] henn1nk: Does someone know how to change the input name in formtastic? f.input :name should result in <input name="name_foo" /> instead of <input name="name" />
[11:45:46] phipes: henn1nk: try f.input :name, name: "name_foo"
[11:48:02] henn1nk: phipes: why i am asking: https://gist.github.com/henn1nk/8236676 i would like to generate f.input :name_en etc.
[12:01:02] thrillERboy: Hi, how do I disable md5 digests on compile?
[12:01:12] thrillERboy: assets compile*
[12:01:57] thrillERboy: I have added a lightbox plugin that links to images in its css file, but the image assets are renamed on compile
[12:04:58] michael_mbp: hi all happy new year guys
[12:06:30] momomomomo: thrillERboy: Why don't you use the helpers
[12:06:59] thrillERboy: momomomomo, I dont create this css file, it comes with the plugin
[12:07:29] thrillERboy: I just @import this file
[12:07:32] momomomomo: thrillERboy: so edit it? Why would you rather have assets not precompile than open up the plugin and getting your hands dirty?
[12:07:35] momomomomo: http://rubydoc.info/github/petebrowne/sprockets-sass/master/Sprockets/Sass/Functions
[12:08:10] momomomomo: disabling recompilation can result in a large hit in performance
[12:08:23] thrillERboy: momomomomo, okay I'll try
[12:08:31] momomomomo: thrillERboy:
[12:09:33] momomomomo: move that entire plugin to /public
[12:10:16] thrillERboy: I guess that would help
[12:10:26] thrillERboy: lemme try thanks momomomomo
[12:10:35] chb__: Hi guys! Short question: I want to access an AR attribute in the fastest possible way (no type casting needed). I tried #read_attribute_before_type_cast but this only works with persisted AR objects. Is there anything like this for persisted as well as non-persisted AR objects?
[12:11:30] ravionrails: thrillERboy, you have to change path of images in css imo
[12:12:16] thrillERboy: ravionrails, okay I'll try both approaches
[12:12:19] momomomomo: ravionrails: both options will work and allow them to keep precompilation - if it's a huge plugin, it might be too much of a pain
[12:12:25] momomomomo: which is why i suggested #2 as well :p
[12:13:45] momomomomo: chb__: before_type_cast works on non persisted objects
[12:14:35] momomomomo: chb__: If I have a class Project, and Project has attribute name, then: project = Project.new; project.name = 'hello world'; project.name_before_type_cast;
[12:14:45] momomomomo: # => 'hello world'
[12:16:43] chb__: momomomomo huh ok, then I'll have to revisit my code
[12:17:03] momomomomo: try it in console :p
[12:17:37] elaptics: chb__: if you're still having problems then gist your code and the errors/problems you're experiencing
[12:18:41] gerep: Hi all. Can someone please help me with this test error: https://gist.github.com/gerep/8237045 I can't find a solution for this enconding
[12:19:14] chb__: elaptics: Thanks, I will
[12:20:22] elaptics: gerep: gist your full spec file and where is this data coming from?
[12:20:43] momomomomo: gerep: That's a non unicode character
[12:20:50] momomomomo: gerep: Replace it in html with \u00e1
[12:20:57] momomomomo: erm * non-ascii
[12:21:23] gerep: elaptics from an API https://gist.github.com/gerep/8237045
[12:22:06] gerep: momomomomo When I make the API request using a client (Chrome's extension) it returns everything as expected, only on my test that it happens
[12:22:28] momomomomo: http://stackoverflow.com/questions/1268289/how-to-get-rid-of-non-ascii-characters-in-ruby
[12:22:55] momomomomo: but that's replacing the characters, there should be a similar option to resolve this
[12:24:18] elaptics: gerep: is it the api that you're writing which is returning the characters?
[12:25:17] gerep: elaptics no, the API is returning the expected, "j??", I've checked it making the same request with a Rest Client (Chrome's extension)
[12:26:15] gerep: elaptics I have updated the gist with the API result: https://gist.github.com/gerep/8237045
[12:27:30] gerep: elaptics but inside my test, when check for "response.body" it returns this: Pedido j\\u00e1 cancelado.
[12:27:48] gerep: elapitcs and at the top of my test file I have this: # encoding: utf-8
[12:29:10] elaptics: gerep: hmm, not sure then
[12:29:55] momomomomo: you'll have to use Iconv.conv
[12:30:01] momomomomo: this is ISO-8859-1
[12:30:22] momomomomo: Iconv.conv('UTF-8', 'ISO-8859-1', my_response)
[12:30:30] momomomomo: you'll have to parse the json response before hand to get it into a string
[12:30:45] gerep: momomomomo I'll try that :)
[12:30:49] momomomomo: ie: response = JSON.parse(response.body);
[12:30:59] momomomomo: then do a test on the response['message']
[12:31:08] momomomomo: http://stackoverflow.com/questions/8426528/how-to-change-html-encoded-character-to-ascii-character
[12:31:13] elaptics: momomomomo: you mean json is iso 8859?
[12:31:18] momomomomo: nah, the body
[12:31:30] elaptics: that's what I meant :)
[12:31:40] momomomomo: yeah, the response looks like it matches that
[12:32:13] momomomomo: which I lifted straight from that SO post; I'm no expert in that area :p
[12:32:42] elaptics: gerep: does the api you're integrating specify the encoding of its responses?
[12:33:03] gerep: elaptics no
[12:33:27] gerep: elaptics but doing what momomomomo is suggesting fixes it, using JSON.parse(response.body)
[12:33:29] elaptics: gerep: then doing what momomomomo suggests is probably the best bet
[12:34:00] gerep: momomomomo and elaptics, thanks a lot for your time :]
[12:34:01] momomomomo: Iconv was deprecated in 1.93
[12:34:04] momomomomo: so keep that in mind
[12:34:12] gerep: momomomomo ok :)
[12:36:20] elaptics: using the string encode stuff is possibly the safer bet - as per one of the other answers on that SO thread
[12:36:53] momomomomo: elaptics: Yeah, it's pretty straight forward, but beware in your console it'll look weird gerep
[12:36:58] momomomomo: http://stackoverflow.com/questions/19278118/how-to-convert-utf-8-to-iso-8859-1-in-ruby-2-0
[12:37:08] momomomomo: response.first['message'].encode('ISO-8859-1')
[12:37:24] momomomomo: will leave you with j\xE1 (hex) unless you change your terminal encoding
[12:37:41] momomomomo: it should pass your spec test though
[12:38:30] momomomomo: elaptics: What are you doing up so early? East coaster?
[12:38:48] elaptics: momomomomo: I'm in the UK - so it's lunchtime now :)
[12:39:18] momomomomo: I woke up to a couple of spider bites on my arm and couldn't go back to sleep at 4:30 :/
[12:40:05] elaptics: momomomomo: I was up at 5am yesterday to get a head start on the holiday email backlog :)
[12:40:25] momomomomo: ha, nice. Not much of a backlog for me, so there's that :D
[12:40:40] rwsq1: momomomomo, how did you know they were spider bites?
[12:40:49] momomomomo: I'm in minnesota
[12:40:53] rwsq1: was the spider lying dead under your arm?
[12:40:58] momomomomo: aint no mosquitos got a time for the cold
[12:41:33] momomomomo: rwsq1: well, I examined the situation in my sleepy stupor; basically two bites on my left arm near elbow, two more on right arm
[12:41:38] momomomomo: both arms were near the edge of the bed near wall
[12:42:02] momomomomo: the only bugs other than the fruit flies that hang around my damn herb plants I've seen were spiders
[12:42:13] momomomomo: only 1 in the last year or so, so the fuckers are hiding somewhere
[12:43:12] BrazenBraden: gotz a question.... I have a Log model with migration in my main_app.. I want a seperate Log model (no migration) in an engine which passed variables to the main_app Log for writing to the database.. Where do I start with that?
[12:43:23] alex88: how can I run rails new setting a custom app name?
[12:43:30] alex88: instead of having it created by the folder name
[12:44:03] elaptics: alex88: generate it with the name you want and then just change the root folder name?
[12:44:29] alex88: elaptics: ok, that's a workaround, thought it has an option I'm not able to find
[12:44:51] elaptics: alex88: not that I know of. I always just rename the root folder
[12:45:04] alex88: yeah I think I'll do that way, thanks elaptics!
[12:45:05] momomomomo: ^ easier than looking for an answer
[12:45:40] elaptics: yeah, not worth looking when it's an easy workaround
[12:45:58] momomomomo: elaptics: working on any OSS?
[12:46:52] elaptics: momomomomo: not particularly at the moment, not really got much time, with little kids at home :)
[12:47:06] momomomomo: ah, right on, how old?
[12:47:11] elaptics: momomomomo: helping people out on irc is about as much as I can manage atm
[12:47:18] elaptics: momomomomo: 4 and 2
[12:47:43] momomomomo: haha that's a handful; my sister has a 1 && 4 year old, and my little brother at her house who is 7
[12:48:08] momomomomo: If she calls me as she enters the house, it sounds like she's walked into an amusement park
[12:48:21] elaptics: momomomomo: sounds normal :)
[12:50:56] BrazenBraden: basically, the engine specific Log models will be sort of a wrapper to the main_app Log model adding in some engine specific info..
[12:52:03] BrazenBraden: so in the engine, you say Log.success(message), and that will then go to the engine Log model, which will then call main_app.Log.success(engine_name, message) or something like that
[12:52:07] elaptics: BrazenBraden: I'm not sure I understand what you're asking. Can you give some more background of what you're trying to do
[12:52:49] BrazenBraden: elaptics: i would like to implement a log table into my application. a single table which will hold all logs for all engines in the system
[12:53:07] alex88: mmhh anyone uses rubinius? seems by default it installs production gems when running it locally
[12:53:10] BrazenBraden: the log table consists of the following columns.. user_id, module_name, message, status, timestamp
[12:53:38] elaptics: BrazenBraden: what are all these engines in your app for?
[12:54:03] elaptics: BrazenBraden: just trying to get a handle on what you're implementing
[12:54:20] BrazenBraden: elaptics: they different sub-systems which together create the entire app but can be run independently
[12:55:03] elaptics: BrazenBraden: would you not have a log engine then that all the other engines use?
[12:55:49] BrazenBraden: elaptics: that is one solution but I just think an entire engine with only a single model is a bit overkill
[12:56:27] elaptics: BrazenBraden: maybe it doesn't need to be an engine itself, just a specific logging library that they all use
[12:57:10] elaptics: BrazenBraden: I mean it makes sense to me that it just sounds like you want to implement your own logger to use instead of the general Rails.logger ...
[12:57:10] BrazenBraden: what you mean by logging 'library'?
[12:57:33] BrazenBraden: yea.. i want a database table for all the logs which we can query
[12:57:34] elaptics: i.e. BrazenLogger.log "foo bar"
[12:57:49] BrazenBraden: so each engine could access it and filter the results on module_name etc
[12:58:11] elaptics: BrazenBraden: maybe an engine isn't overkill then if you want logging functinoality like that
[12:58:29] BrazenBraden: elaptics: each engine could have a "Log View" which would just pull its data from the main_app Log table
[12:58:43] momomomomo: man, how much stuff is being logged?
[12:58:53] momomomomo: if you have many plugins constantly writing
[12:58:53] BrazenBraden: momomomomo: everything is getting logged
[12:58:57] momomomomo: this stuff will get clunky
[12:59:11] momomomomo: especially in one table with full reads after a while, even with indeces
[12:59:34] BrazenBraden: well, its not going to be read much.. its only for us devs and maybe admins to see
[12:59:38] elaptics: BrazenBraden: what sort of scale are we talking here. Sounds like you're trying to split things up as engines but you still have a monolithic app
[12:59:49] BrazenBraden: and we use AWS so it would be running off a read replica instance
[13:00:17] momomomomo: I like elaptics suggestion earlier, so that if you add more modules/engines in future, you can plug n play
[13:00:58] BrazenBraden: it would be kinda like plug 'n play
[13:01:28] BrazenBraden: each engine would have a Log model which will add the basic module info to the main_app Log model
[13:02:25] BrazenBraden: elaptics: the main_app is pretty much empty. all it has so far is a session model which is for devise
[13:02:38] BrazenBraden: elaptics: the rest of everything is in their respective engines
[13:03:25] elaptics: BrazenBraden: and you say these engines can be run standalone too and need still need logging?
[13:04:34] BrazenBraden: when i say stand-alone, i dont mean stand-alone stand-alone.. they would be mounted within a skeleton app (with devise and logging there) but they dont require any of the other engines in order to work
[13:05:30] elaptics: BrazenBraden: well if they're only designed to work within the context of a skeleton app and you want the skeleton app to deal with the logging then why not just use the Rails logger?
[13:05:49] tagrudev: new year resolution be more yolosome
[13:05:56] BrazenBraden: elaptics: cos the rails logger writes to textfiles
[13:06:04] elaptics: BrazenBraden: use the tagged logger and tag it with the engine
[13:06:11] BrazenBraden: tagrudev: the word 'yolo' died at the end of 2013
[13:06:28] elaptics: BrazenBraden: change the logger that rails uses to log it whereever you need
[13:06:52] tagrudev: yolo can never die
[13:07:18] BrazenBraden: elaptics: i thought the rails logger was as it is...
[13:08:26] elaptics: BrazenBraden: no, you can swap out the logger used for custom ones
[13:08:53] elaptics: BrazenBraden: e.g. http://stackoverflow.com/questions/14400831/create-a-custom-rails-logger
[13:08:55] BrazenBraden: elaptics: http://guides.rubyonrails.org/debugging_rails_applications.html ?
[13:09:44] momomomomo: I would also check out these posts BrazenBraden
[13:09:46] momomomomo: http://stackoverflow.com/questions/1160720/log-to-database-instead-of-log-files
[13:10:26] BrazenBraden: cool. thanks guys.. will do some reading and see what i can learn from all this
[13:12:57] tagrudev: any problems with 2.1 and raisl 4
[13:15:05] momomomomo: tagrudev: I just went through the Rails Getting Started tutorial to check docs and for pipe cloud, and I didn't come across anything
[13:15:14] momomomomo: tagrudev: Not to say that there aren't issues somewhere deeper
[13:15:55] tagrudev: nah was wondering if someone already updated on production
[13:17:08] momomomomo: BrazenBraden: elaptics Might be able to wrangle ActiveSupport::Notifications into something neat as well.
[13:17:12] momomomomo: BrazenBraden: elaptics http://asciicasts.com/episodes/249-notifications-in-rails-3
[13:19:11] momomomomo: tagrudev: http://railsapps.github.io/updating-rails.html looks helpful, for best practices on upgrading, though
[13:19:59] tagrudev: nah I was referring to ruby 2.1
[13:23:43] snapr: I got that song stuck in my head...its a version of Alphabeat's "Fascination", but instead its called "procrastination". Pretty much sums up my day :S
[13:25:01] tagrudev: snapr, yeah try a year
[13:28:10] marjinal1st: how can use the routes of host application, in a mountable engine?
[13:31:07] marjinal1st: how can use the routes of host application, in a mountable engine?
[13:33:14] momomomomo: marjinal1st: Don't repeat yourself - we saw your question. http://edgeapi.rubyonrails.org/classes/Rails/Engine.html#label-Using+Engine%27s+routes+outside+Engine
[13:33:23] helpa: Don't repeat yourself. Asking the same question repeatedly will not give you more answers.
[13:47:33] BrazenBraden: would you say log4r is the "best" logging gem to use?
[13:59:00] helpa: "Best" and "better" are subjective. Try to use a different term.
[14:06:44] bookies: good day. I have a simple question. I will create a model named "Category" that will belong to "post" model. So those will be categories for the posts. Should i use nested routes for the categories? Is it the proper action?
[14:08:44] momomomomo: bookies: Basically, it's preference. http://guides.rubyonrails.org/routing.html#nested-resources
[14:09:00] momomomomo: Nesting one level deep is cool
[14:09:08] momomomomo: nesting 4 levels deep typically is not
[14:10:53] alex88: usually things under /app aren't automatically autoloaded?
[14:11:37] helpa: Please explain your problem better as we are having trouble understanding what you mean. A Gist (http://gist.github.com) is always helpful!
[14:12:26] alex88: momomomomo: since I had to add /app/workers to my autoload path
[14:12:51] alex88: I thought it would have been autoloaded by default, also because sidekiq never advices to include it manually
[14:12:59] toretore: certain directories are, others aren't
[14:14:02] momomomomo: pretty much if you add a gem, and it requires that you add a directory, you'll have to add it to the load path
[14:14:20] momomomomo: if you're doing something included in the core, like a Concern or an Observer folder, provided it's in the right place, it shouldn't need to be added
[14:14:39] alex88: thanks for explaining :)
[14:19:02] momomomomo: I've always autoload_paths 'd my workers, but in this episode's source I can't see any autoload_path call http://railscasts.com/episodes/366-sidekiq?view=asciicast
[14:20:33] BrazenBraden: is this article still valid for Rails 4? http://blog.mmlac.com/log4r-for-rails/
[14:21:04] pontiki: i just created a workers directory and a sidekiq worker, i didn't need to add to autoload_paths
[14:21:17] BrazenBraden: the bulk of the work is done in the config/application.rb file but I dont think that is where rails defines which logger it should use
[14:21:18] jxpx777: What's the best way to keep track of some temporary data across a few page loads?
[14:21:29] jxpx777: I'm working with Stripe and need to store a token representing the customer's card until the checkout process is complete including confirmation page, back to edit cart, etc. This token will not be valid after the charge completes so I don't think it should be a database column.
[14:21:40] jxpx777: Sensitive so probably shouldn't go into the session???
[14:22:18] momomomomo: BrazenBraden: Being that log4r has only incremented its tiny version to 1.1.11 i'd imagine that the gem hasn't changed; whether rails has I'm not sure
[14:22:35] pontiki: BrazenBraden: log4r works in rails 4
[14:23:10] BrazenBraden: pontiki: I know it works in rails 4 but this article is for Rails 3
[14:24:46] BrazenBraden: so im getting http://stackoverflow.com/questions/18920952/undefined-method-formatter-for-log4r-in-rails-4-0
[14:25:36] pontiki: how is that related?
[14:26:07] momomomomo: BrazenBraden: Then use the suggested fix - that's a Gem quirk, not a Rails quirk.
[14:26:35] BrazenBraden: momomomomo: not sure where I'm supposed to do that... since I have been working in config/application.rb, I can assume there?
[14:27:15] pontiki: Rails.logger has already been created (as an instance of Logger) before config/application.rb runs, so if you are resetting it to an instance of log4r in config/application.rb, why would that not work the same?
[14:27:49] pontiki: you can also set it in config/environments/* if you want to do different things based on environment
[14:28:01] pontiki: (different outputters, formatters, etc)
[14:28:29] BrazenBraden: pontiki: for now I am happy to get it running system wide.. once I understand it more, might modify them for different environments
[14:28:36] momomomomo: BrazenBraden: guides.rubyonrails.org/debugging_rails_applications.html#what-is-the-logger-questionmark
[14:29:28] momomomomo: "Rails makes use of the ActiveSupport::Logger class to write log information. You can also substitute another logger such as Log4r if you wish." AND BEHOLD "You can specify an alternative logger in your environment.rb or any environment file:"
[14:29:29] pontiki: log4r is great if you have multiple destinations for log records
[14:29:34] BrazenBraden: momomomomo: yea i read that a while ago.. thats why I asked if the article was up to date seeing as it is doing everything in app.rb
[14:29:52] pontiki: but if you don't, it's way overkill
[14:30:23] pontiki: environment files run after application
[14:30:24] BrazenBraden: pontiki: this will be a big app and a proper logging solution will be needed in the future.
[14:30:35] pontiki: it doens't matter all that much, but i like it in the environments
[14:31:01] BrazenBraden: so the environment files will inherit the stuff in applicatoin then
[14:31:13] pontiki: inherit is quite the wrong word
[14:31:32] pontiki: it's a cascade
[14:31:32] BrazenBraden: you know what i mean
[14:31:44] pontiki: i have no idea what you know or don't, really
[14:33:08] momomomomo: basically, what pontiki is trying to say is that you can just toss the definitions in an environment file if you want
[14:33:15] momomomomo: ie: if you want test/development NOT to use log4r
[14:33:44] momomomomo: OR, you can toss it in application.rb; to clarify the initialization process check out http://guides.rubyonrails.org/initialization.html#back-to-config-environment-rb
[14:33:52] BrazenBraden: momomomomo: yea i understand that.. but if I want dev & test & production to use it, i dont need to copy pasta the code 3 times.. i can just have it once in application.rb
[14:34:11] pontiki: or once in environment.rb
[14:34:22] momomomomo: pontiki: which runs after application.rb anyway
[14:34:43] pontiki: dealer's choice, anyway
[14:34:46] momomomomo: but, since the guide suggests environment.rb, i'd probably do that
[14:34:46] BrazenBraden: so, app.rb -> env.rb -> test/dev/prod.rb
[14:35:26] pontiki: is there a definitive document on the order of all the startup code someplace?
[14:35:36] BrazenBraden: momomomomo: which brings me back to the begining lol.. guide says env.rb.. article says app.rb
[14:36:09] momomomomo: I'm sorry BrazenBraden at this point, you're going to have to select a fork int he road and go with it, they're both essentially the same
[14:36:09] pontiki: it will work either place
[14:36:21] pontiki: and you can override it as things get more specific
[14:36:38] BrazenBraden: thats all I need to know. thanks :)
[14:45:56] Criten: Morning everyone!
[14:48:06] momomomomo: morning Criten
[15:11:32] Delacram: Hey guys.... I'm getting an undefined method error 'first_name' for nil nilclass
[15:11:33] Delacram: https://gist.github.com/drichards2013/8239360
[15:11:41] Delacram: I swear I set everything up correctly
[15:11:52] Delacram: I forgot to post my migrations. I'll post that too
[15:13:41] Delacram: Any suggestions?
[15:13:49] zrl: Delacram: can we see your schema?
[15:13:55] zrl: cat db/schema.rb
[15:14:17] tobago: does someone knows why using mysql2 adapter fails: https://gist.github.com/trinibago/8239452?
[15:14:22] zrl: just prints the contents of a file
[15:14:49] zrl: like on a mac, i'd use cat db/schema.rb | pbcopy to copy the contents of schema.rb, but you can also use a gui
[15:14:52] Delacram: I just updated the Gist
[15:14:59] dagen: so strange. i set in my routes get 'invitations/(:kind)' => 'invitations#index', as: :invitations ... and now try to use invitations_url(kind: :invite)
[15:15:17] dagen: but when i try to open the page i cant see the same named view
[15:15:51] dagen: what i need to do in my controller to see the view named /views/invitsations/invite.html.erb ?
[15:16:16] Delacram: You need an invitations controller with an invite action
[15:16:26] Delacram: and a view file called invite.html.erb
[15:16:33] dagen: def invite
[15:16:33] dagen: render :invite
[15:16:36] dagen: like this?
[15:16:45] tobago: in the folder views/invitations
[15:16:46] zrl: render :invite is implied
[15:16:50] Delacram: It's implied
[15:16:54] dagen: yes i have this file
[15:17:00] dagen: and i have this medthod named invite
[15:17:01] zrl: so just def invite; end
[15:17:16] tobago: dagen, what is the exception?
[15:17:26] dagen: there is no exception
[15:17:34] tobago: what is the log?
[15:17:47] dagen: when i try to use /invitations/somekind i just see the #index
[15:18:29] tobago: what does rake routes tell you about your routes?
[15:18:37] tobago: in terms of invitations
[15:18:48] dagen: in my logs i can see this: Processing by InvitationsController#index as HTML
[15:18:48] dagen: Parameters: {"kind"=>"invite"}
[15:19:03] dagen: tobago how can i check this?
[15:19:06] dagen: rake routes?
[15:19:25] tobago: so you are routing to #index. but i thought you want to reach the Invitations#invite action?
[15:19:50] dagen: what i'm doing wrong?
[15:19:57] tobago: is there a route to inviations/invite?
[15:19:57] dagen: how i can look the routes?
[15:20:01] Delacram: zrl: Do you see anything?
[15:20:02] tobago: rake routes
[15:20:21] zrl: Delacram: i never got your schema
[15:20:34] dagen: You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
[15:20:37] Delacram: I put my schema in the Gist
[15:20:42] Delacram: Is that the same as cat?
[15:20:44] zrl: oh, didn't realize you updated it
[15:21:31] zrl: where are you getting the error?
[15:21:47] zrl: in your view, i see
[15:21:59] dagen: when i try to do: rake routes i have an error: You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
[15:22:10] dagen: am... what's wrong?
[15:22:28] zrl: Delacram: i'd assume that one of your comments doesn't have a .user_id set
[15:22:52] zrl: i'd recommend validating the presence of that field
[15:23:05] zrl: so you don't end up in this situation
[15:23:05] Delacram: Before I do that
[15:23:19] Delacram: Let me delete all comments from database
[15:23:34] tobago: dagen, did you try to follow the hint?
[15:23:51] dagen: 'bundle exec rake routes'
[15:23:57] dagen: works fine
[15:24:02] dagen: but i have no idea why
[15:24:22] dagen: invitations GET /invitations(/:kind)(.:format) invitations#index
[15:25:05] tobago: dagen, why are there brackets? around kind?
[15:25:19] guilund: hey guys happy new year!
[15:25:27] tobago: happy nu year!
[15:25:49] guilund: and girls, too... of course
[15:25:51] dagen: tobago i dont know. syntax
[15:25:58] tobago: dagen, show your routes.rb
[15:26:09] dagen: get 'invitations/(:kind)' => 'invitations#index', as: :invitations
[15:26:29] tobago: dagen, why is there 'invitations/(:kind)' with brackets?
[15:26:40] dagen: i don't know
[15:26:46] Delacram: zrl: I've gone to the console
[15:26:47] tobago: dagen, who wrote this?
[15:26:54] dagen: it's worked perfectly for other urls
[15:27:07] Delacram: zrl: I've gone to the console and run Comment.last.user.first_name, and that works
[15:27:27] zrl: the issue is that one of the courses you were iterating over did not have a user set
[15:27:29] tobago: dagen, you'reheading to #index. there
[15:27:36] zrl: your database is fine
[15:27:38] tobago: dagen, so everything is alright then.
[15:28:02] guilund: let me see if i can explain and if someone has a clue how can i achieve it... i have a client that wants to build a lot of very simple websites for clients, each one with own template, but he should be able to modify the content, not the template... i think the best way to do that is compiling HTML after he edits the data, there's any way to do tha
[15:28:02] guilund: t easily or i have to deal with filesystem?
[15:28:07] dagen: i add check to def index --> if params[:kind] == 'invite' invite end
[15:28:24] tobago: dagen, please post at gits.
[15:28:28] dagen: and in def invite uncomment render :invite end
[15:28:33] Delacram: zrl: Alright, col. So how do I get a user set?
[15:28:37] dagen: and now view is rendered
[15:28:48] zrl: comment.user = user
[15:29:01] zrl: or, when you're creating them, user.comments.create(stuff)
[15:29:03] tobago: dagen, please post at gist.github (or somewhere else)
[15:29:14] dagen: what i must to post?
[15:29:31] Delacram: "comment.user = user" - where do I put that?
[15:29:38] tobago: dagen, pos your routes.rb, your controller and the link you are creating.
[15:30:03] zrl: for some reason @comment = Comment.new(comment_params.merge({:user_id => current_user.id})) is producing unexpected results
[15:30:18] zrl: another way to write that is @comment = current_user.comments.new(comment_params)
[15:30:29] banhbeongon: Hi. I have one question. Within a controller, if I used `render text: "Some text"`, I checked the result in browser and realize that it's not simply a plain text. "Some text" was included in the body tag. Is there anything I missed?
[15:30:46] tobago: does someone knows why using mysql2 adapter fails: https://gist.github.com/trinibago/8239452?
[15:31:22] tobago: banhbeongon, it's rendered into the layout file?
[15:31:24] guilund: banhbeongon: sometimes the inspector adds html tags, have you inspect or saw the result?
[15:31:55] Delacram: zrl: When I navigate to this page, the guide is automatically filled in, but user is blank http://gyazo.com/7002712e8480263813f9fc3e25320bb4
[15:32:04] Delacram: see that? in the comments form?
[15:32:09] guilund: banhbeongon: try layout false
[15:32:21] tobago: banhbeongon, right ^
[15:32:32] dagen: tobago https://gist.github.com/anonymous/a871cecf0db093aeeb7d
[15:32:44] Delacram: that comment would be posted on a guide with ID of 5, I am user ID 1
[15:32:55] dagen: and i user link_to as invitations_url(kind: :invite)
[15:33:01] dagen: user=use_
[15:33:34] banhbeongon: Thanks for your answers. These are what I got when inspecting in browser (even used with layout: false) <html><head></head><body cz-shortcut-listen="true">Hello World</body></html>
[15:34:16] tobago: dagen, and the link leads to invitations#index?
[15:34:25] guilund: banhbeongon: try inspect the result, in Resources i thinkg
[15:35:03] zrl: Delacram: it's hard to say without seeing the code for the form
[15:35:06] dagen: it was leads to : /invitations/invite but render the index.html.erb
[15:35:18] Delacram: Okay. I'll post that too
[15:35:19] dagen: but now is allright it's render the invite view
[15:35:25] guilund: banhbeongon: sorry, in Network, click the file on the left, and then click in response tab
[15:35:31] tobago: dagen, so everything fine?
[15:35:38] guilund: banhbeongon: im assuming you are using chrome
[15:35:40] dagen: but now i have another problem eith model
[15:35:57] dagen: not working the 3: <%= minimal_form_for @invitation do |f| %>
[15:36:02] dagen: undefined method `model_name' for NilClass:Class
[15:36:49] guilund: or in terminal curl the dev url to see the result
[15:36:51] dagen: before this changes with :kind i uses this line in my routes.rb: resources :invitations, only: [:index, :show, :new, :create, :update]
[15:36:52] tobago: dagen, I gues you mean the view?
[15:36:55] dagen: and all works fine
[15:36:56] guilund: banhbeongon: or in terminal curl the dev url to see the result
[15:37:05] Delacram: zrl: Updated the gist
[15:37:07] dagen: yes with view
[15:37:08] guilund: banhbeongon: curl
[15:37:08] Delacram: with the form partial
[15:37:23] tobago: dagen, you didn't post the view
[15:37:24] guilund: banhbeongon: curl
[15:37:47] guilund: banhbeongon: what does it show?
[15:38:13] dagen: tobago https://gist.github.com/anonymous/1108539e5a7d28d0c7cf
[15:38:38] banhbeongon: guilund, thanks very much, I checked there and found the expected result. Perhaps browser automatically display plain text as HTML.
[15:38:41] tobago: dagen, you also can edit a gist at github. please do that.
[15:38:48] guilund: guys, i will put again my question, if someone did it already and want to share
[15:38:54] zrl: Delacram: what does the generated fields for the hidden stuff look like?
[15:38:58] guilund: let me see if i can explain and if someone has a clue how can i achieve it... i have a client that wants to build a lot of very simple websites for clients, each one with own template, but he should be able to modify the content, not the template... i think the best way to do that is compiling HTML after he edits the data, there's any way to do tha
[15:38:59] guilund: t easily or i have to deal with filesystem?
[15:39:08] guilund: banhbeongon: yeah!
[15:39:15] dagen: i see only delete
[15:39:29] zrl: Delacram: it's looking like this comment doesn't have a user set?
[15:39:48] Delacram: It's not even hiding the fields
[15:39:57] tobago: dagen, there is no "model_name" access in the view.
[15:40:07] dagen: tobago i can't edit
[15:40:18] tobago: dagen, please sign in.
[15:40:22] krz: anyone using something similar to asset_sync?
[15:40:27] dagen: tobago but why?
[15:40:41] krz: i.e. upload assets directly to s3
[15:40:42] tobago: or use a paste service, where you can edit anonymously.
[15:41:11] tobago: dagen, because I don't like to switch through several pasties....
[15:41:16] zrl: Delacram: the last two f.inputs aren't needed
[15:41:36] zrl: you only care about f.hidden_field for user_id and guide_id
[15:43:05] tobago: anyone ever used mysql2 adapter? https://gist.github.com/trinibago/8239452
[15:45:01] dagen: tobago https://gist.github.com/anonymous/310949246378b83f7175
[15:45:25] Delacram: This is ridiculous. Everything is setup correctly but it won't display in the view
[15:45:56] tobago: dagen, I can't find the mentioned 'model_name' method.
[15:47:22] tobago: dagen, there is no 'model_name' in your pastie.
[15:47:41] dagen: @invitation
[15:47:42] tobago: dagen which line?
[15:47:55] tobago: third line?
[15:48:07] tobago: that is an object
[15:48:17] tobago: i was searchin for method called 'model_name'
[15:48:52] tobago: is @invitation nil?
[15:48:56] dagen: NoMethodError in Invitations#index; Showing /home/rails/dev/app/views/invitations/invite.html.erb where line #3 raised: undefined method `model_name' for NilClass:Class
[15:49:08] dagen: now is nil but must be filled
[15:49:29] tobago: dagen, lol
[15:49:51] tobago: in your Invitations#invite there is no assignment to @invitation.
[15:50:11] tobago: you just render :invite
[15:50:53] tobago: dagen, I guess you're missing some sleep ;)
[15:51:17] dagen: 31 hours of coding now
[15:51:22] dagen: yes you right
[15:51:26] guilund: theres any gem that helps to compile html using a template?
[15:51:29] tobago: dagen, far too much, bro.
[15:51:33] tubbo: dagen: you mean 8 hours of coding and 23 hours of introducing bugs
[15:51:47] tubbo: dagen: if that was all in one shot of course
[15:51:51] tobago: dagen, that is unhealthy and you coding bullshit that way.
[15:51:56] tubbo: dagen: not kidding
[15:51:57] guilund: dagen: dont do that man, sleep is part of programming
[15:52:21] dagen: but i need to code this project)
[15:52:21] tobago: dagen, go sleeping.
[15:52:41] guilund: dagen: a girl died, some days ago
[15:52:51] guilund: dagen: she was working and taking energy drinks
[15:52:53] dagen: wich girl? and why?
[15:53:03] tobago: dagen, anyway. go sleeping
[15:53:15] dagen: i don't like energy drinks
[15:53:18] guilund: dagen: in indonesia i think, she was in advertising, she was about 30h working non stop, drinking energy drinks
[15:53:22] guilund: and collapsed
[15:53:31] dagen: shit happens.)
[15:53:44] tubbo: guilund: what an idiot
[15:53:48] dagen: but you right this is wrong way
[15:53:59] guilund: dage i did it already, but i prefer now stop procrastinating and code for about 7h a day, with focus
[15:54:20] dagen: energy drinks is evil
[15:54:32] guilund: 30h of code im pretty sure that at least 20 hours procrastinating
[15:54:43] tobago: dagen, you're code after 31 hours in front of the monitor is far more evil ;)
[15:54:51] dagen: guilund )
[15:55:00] dagen: tobago )))))))
[15:55:04] Delacram: zrl: I think I found the problem. But I don't know how to deal with it You still here?
[15:55:07] dagen: you right again
[15:55:13] zrl: Delacram: yeah
[15:55:15] zrl: what's the issue?
[15:55:29] guilund: dagen: read a book called REWORK
[15:55:39] guilund: its from the guys who created Rails
[15:55:41] Delacram: zrl: In my guides controller, I had @comment = @guide.comments.build
[15:55:49] tobago: ACTION is still searching for the reason of my mysql2 adapter issue: https://gist.github.com/trinibago/8239452
[15:55:49] Delacram: That was in my show view on guides
[15:55:52] guilund: dagen: you will feel ashamed to be workaholic
[15:55:54] Delacram: show action
[15:56:10] Delacram: But when I change it to @comment = Comment.last, it works
[15:56:11] zrl: Delacram: and?
[15:56:21] zrl: well, what is @comment used for?
[15:56:21] dagen: but I need to make this code to learn and then to not depend on my adoptive parents as soon as I turn 16 I will leave them
[15:56:30] guilund: tobago: go back to rails 3.2.8
[15:56:40] guilund: i tried rails 4 and nothing worked properly
[15:56:43] dagen: guilund i'm allready
[15:56:51] Delacram: @comment is used because I need to display the comments in the guides show view
[15:57:00] guilund: dagen: good book uh?
[15:57:09] zrl: all of the comments?
[15:57:12] tobago: guilund, I am on rails 3.2.3. why going back to previous version?
[15:57:15] Delacram: For that guide
[15:57:16] zrl: then shouldn't you be doing @comments = @guide.comments?
[15:57:27] guilund: tobago, sorry, i thouhgt you were on rails 4
[15:57:32] zrl: and then, in your view, @comments.each do |c|
[15:57:43] tobago: guilund, wait. my version is even older tha yours.
[15:57:43] dagen: ACTION gone
[15:57:51] guilund: tobago, yeah :P
[15:57:58] dagen: i need to sleep a little bit, you are right
[15:58:03] Delacram: That raises undefined method `model_name' for #<Class:0x000001037108f0>
[15:58:12] tobago: guilund, have you already used mysql2 adapter?
[15:58:16] guilund: dagen: bye man, take a sleeping pill
[15:58:27] zrl: what specifically raises that error?
[15:58:48] guilund: tobago: refresh my memory, theres a mysql gem ? not mysql2 ?
[15:58:53] Delacram: <%= simple_form_for(@comment) do |f| %>
[15:59:04] guilund: i used mysql for a unch of projects, but i cant remember the details
[15:59:07] guilund: let me see
[15:59:08] zrl: here's what i'm not understanding
[15:59:20] tobago: guilund, there is mysql and mysql2. the second solves some utf-8 issues of mysql adapter.
[15:59:20] zrl: are you trying to view comments? or create them?
[15:59:24] zrl: because you've told me both so far
[15:59:32] Delacram: They're already created
[15:59:39] guilund: tobago, let me see a thing here
[15:59:40] zrl: then why do you have a form?
[15:59:41] tobago: that's why I want to to switch.
[15:59:49] Delacram: Because I nee to create it first
[15:59:51] dfr|work: Delacram, that error means that @comment.class doesn't have model_name method. Sounds like @comment is not directly a Comment instance but something funky
[16:00:14] zrl: dfr|work: the problem is that he's creating a simple form for an activecollection
[16:00:38] dfr|work: zrl, ah, sounds like you're on it then. Sorry. No idea what activecolleciton even is >.<
[16:00:43] guilund: tobago: i always use mysql2 gem, let me see your error?
[16:00:57] zrl: Delacram: you probably want @comment = guide.comments.build
[16:01:03] zrl: and then @comments = guide.comments
[16:01:04] tobago: guilund, https://gist.github.com/trinibago/8239452
[16:01:17] zrl: probably better written as @comments = guide.comments and then @comment = @comments.build
[16:01:26] zrl: so put that in your controller
[16:01:32] zrl: and then do simple_form_for @comment
[16:01:37] zrl: for creating a new comment
[16:01:48] guilund: tobago: do you have mysql installed?
[16:02:00] zrl: and show the existing comments by iterating over @comments
[16:02:43] guilund: tobago: tried to rake db:create ? rake db:migrate etc?
[16:03:03] tobago: guilund, mysql was already installed. with that old adapter it works.
[16:03:06] Delacram: Give me a second
[16:03:26] guilund: tobago: did you create the database again?
[16:03:50] tobago: guilund, rake db:migrate fails with another issue (rcov gem)
[16:04:03] guilund: tobago: did you rake db:create ?
[16:04:17] tobago: guilund, the reason is, I want to upgrade the ruby version from ruby 1.8 to ruby 1.9.3
[16:04:29] tobago: guilund, rake db:migrate fails with another issue (rcov gem)
[16:04:47] guilund: tobago: but the database is created?
[16:06:32] guilund: tobago: your gem list shows mysql and mysql2, are you calling both on the Gemfile?
[16:06:49] dagen: last question
[16:07:20] dagen: when i have some errors for form from my view in my controller:flash.now.alert = error_messages(@invitation)
[16:07:20] dagen: new_invitation_url(kind: :invite)
[16:07:21] dagen: render :new
[16:07:45] dagen: if i use render :new then i can see marked fileds with error data
[16:08:07] dagen: but url in browser is wrong after refreshing
[16:08:23] helpa: dagen: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[16:08:23] tubbo: dagen: !gist don't paste
[16:08:23] dagen: disappears /new from /invitations/new/ string
[16:09:08] dagen: how i can use redirect_to or return with highlighting of bad data fields of my posted form?
[16:09:08] Delacram: zrl: Not working. I'm going to roll back my changes and come back to this later... Thanks
[16:09:43] dagen: because i need the '/invitations/new' url instead '/invitations/' this is so strange bug for me
[16:09:44] tobago: guilund, no. the mysql gem is commented.
[16:10:17] helpa: dagen: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[16:10:17] tubbo: dagen: !gist the whole action or i won't help you
[16:10:35] tobago: guilund, but maybe i should fix the rcov gem issue first and then trying to recreate the db.
[16:11:19] guilund: tobago: i see, im sorry i cant help more
[16:11:30] tubbo: tobago: rcov doesn't work on 1.9.3
[16:11:38] tobago: tubbo, true.
[16:11:47] tubbo: you can use simplecov though
[16:11:52] dagen: tubbo https://gist.github.com/anonymous/5b8d6d8297dab384519d#file-invitations_controller-rb-L21
[16:11:54] mwlang: anyone know how to dynamically create new routes at runtime in Rails 4?
[16:12:24] tubbo: dagen: i guess instead of `render` you probably want to redirect_to the route you want to go to
[16:12:30] dagen: if i have error with format of fields i going back with 'render :new' string
[16:12:39] guilund: let me post my question again, its a non trivial one, let me see if you guys knows how can i achieve this
[16:12:54] guilund: let me see if i can explain and if someone has a clue how can i achieve it... i have a client that wants to build a lot of very simple websites for clients, each one with own template, but he should be able to modify the content, not the template... i think the best way to do that is compiling HTML after he edits the data, there's any way to do tha
[16:12:54] guilund: t easily or i have to deal with filesystem?
[16:12:55] tubbo: dagen: yeah but that doesn't "go back", it just renders the form
[16:13:01] dagen: but when i use redirect_to i cant see the highlighting of fields in my form wich have an errors
[16:13:09] dagen: yes hust render
[16:13:17] dagen: but with erorrs
[16:13:26] tubbo: dagen: i mean, does the URL really matter that much?
[16:13:27] dagen: and when i use redirect_to - i cant see the errors
[16:15:00] dagen: bring the view with form trought /invitations/new url
[16:15:29] mwlang: dagen: fall through on errors and simply render the current action. Only redirect on success and use flash notice to report success feedback to the user (or redirect to a "success" page)
[16:15:54] dagen: but, render :new render the same view with another url adress: just /invitations/ without the '/new/' part
[16:16:02] dagen: and there is another URL!
[16:16:11] EminenceHC: Would it be possible to take this select_tag and have it remember the last value? I hear it can be done with :selected but it is coming from an ivar that is mapped. https://gist.github.com/EminenceHC/8227774
[16:16:35] dagen: mwlang but how?
[16:17:07] dagen: i think...
[16:17:20] mwlang: have you generated any controllers using rails g scaffold? If so, you should see the general techniques for doing so.
[16:18:23] guilund: EminenceHC: options_for_select(@quiz_user_name, params[:quiz_user_name]) ?
[16:19:26] tubbo: dagen: instead of just blabbing on could you answer my question?
[16:19:35] tubbo: dagen: why does the URL matter so damn much?
[16:19:37] guilund: EminenceHC: you pass after the , the data you want to be selected
[16:19:46] tubbo: in this sense it's a transitional step
[16:20:07] guilund: EminenceHC: is this your doubt?
[16:21:14] EminenceHC: guilund: I just tried that, but :quiz_user_name is not a parameter. The parameter from @quiz_user_name is a .map that displays user_id & user_name. user_name and user_id are the params.
[16:21:43] guilund: EminenceHC: map another one with the selected value, and pass
[16:22:15] EminenceHC: guilund: I just did options_for_select(@quiz_user_name, params[:user_id]) and it worked!
[16:22:22] guilund: EminenceHC: nice!
[16:22:50] digital-ghost: Kind of an odd question, I'm trying to reproduce an issue a user has when pasting from MS Word into TinyMCE. MS Word carriers over proprietary xml/xhtml and I am trying to strip it, but I cannot seem to get word to do this for me. Anyone know how I can trigger this to happen?
[16:22:53] EminenceHC: guilund: It still remembers that I want the user_id as a parameter but still shows user_name in the select tag. I figured that would be problematic.
[16:23:42] digital-ghost: What's more is that, that code doesn't show up visually in the text editor once pasted, but as if it were embedded. I cannot reproduce it, but a user keeps experiencing it, where they see odd html commented out conditionals.
[16:27:01] guilund: digital-ghost: could be a browser issue, you guys are using the same browser, etc?
[16:27:43] terrellt: digital-ghost: Using the paste plugin for TinyMCE?
[16:28:42] EminenceHC: guilund: It doesn't work like that with multi-select select_tags. Any idea if it is possible?
[16:29:11] guilund: EminenceHC: i dont know, try to pass an array with ids, [2,3,4]
[16:29:56] guilund: EminenceHC: hardcode the array first, if it works, you solve the rest
[16:30:05] mwlang: I need to initialize some stuff after Rails is fully-loaded and has a database connection and has constructed all routes. a file in config/initializer is getting picked up too soon in the initialization startup. any thoughts?
[16:30:37] digital-ghost: terrellt: I spent all day yesterday trying to get that installed, but I couldn't figure out how to configure it. I don't understand the documentation.
[16:31:00] EminenceHC: guilund: options_for_select([2,3,4], params[:survey_id]) ? What would the parameter be in this situation?
[16:31:03] guilund: digital-ghost: teach markdown to your client, i did it once :P
[16:32:03] guilund: EminenceHC: nop, options_for_select(@surveys, [1, 2, 3]) for example
[16:32:13] guilund: try that, i dont know if it works
[16:32:13] digital-ghost: guilund: I'm totally for markdown. Not a fan of RTEs at all, but not my choice in this case.
[16:32:19] EminenceHC: guilund: Ah ok ill try that
[16:32:30] dagen: tubbo i don't understand your question(
[16:32:48] guilund: digital-ghost: :)
[16:32:52] digital-ghost: guilund: I beat my head against a wall trying to understand TinyMCE's plugin usage, when using the gem 'tinymce-rails'
[16:33:04] digital-ghost: To no avail, so fresh start.
[16:33:13] guilund: digital-ghost: theres a simpler version, bootstrap-wywiwyg, something like that
[16:33:19] mwlang: digital-ghost: Do you have the option of going to ckeditor?
[16:33:25] dagen: tubbo do you mean all problem in routes.rb?
[16:33:37] digital-ghost: So now I am wondering is there information that copies over when you're in WINDOWS, IN IE, using WORD. As opposed to in OSX, in CHROME, using WORD.
[16:33:39] mwlang: seems to work better overall with various pasted data sources.
[16:33:44] terrellt: digital-ghost: Yeah, I fought with it for a bit too. One sec.
[16:33:45] guilund: digital-ghost: its very simple, i even contributed to that, let me see the github
[16:33:57] digital-ghost: mwlang: I looked into that, it's way beyond the scope. Would require changing the product substantially.
[16:34:06] mwlang: digital-ghost: copy and paste is definitely different between the different OS's.
[16:34:28] digital-ghost: mwlang: Do you know why? I can imagine it would be, but I don't know the technical bits around it at all.
[16:34:49] guilund: digital-ghost: https://github.com/jhollingworth/bootstrap-wysihtml5
[16:34:55] digital-ghost: mwlang: That will likely be why I can't reproduce it, but that said, I get stuck with my core problem again of not knowing if I installed this plugin correctly.
[16:35:00] terrellt: digital-ghost: I think what you want is https://gist.github.com/terrellt/8241058 in config/tinymce.yml
[16:35:16] digital-ghost: terrellt: I "fought" with it yesterday and had my ass handed to me.
[16:35:37] mwlang: digital-ghost: no, I'm not really sure why. MS-Word tries to offer the text up in rich text formatting as preferred pasting option. On Windows, its more deeply integrated, so copy and paste between MS products works like MS wants it to.
[16:35:56] digital-ghost: terrellt: Yep, so I have a file similiar to that and I did add in "- paste", then added into row 3 the three buttons, which show up and "work" but I haven't been able to test the Paste from Word.
[16:36:14] EminenceHC: guilund: My bad, I was using options_for_select(@quiz_id, params[:survey_id]) when I should have been using params[:id]. Derp
[16:36:23] EminenceHC: guilund: Thanks a bunch for your help sir
[16:36:24] digital-ghost: terrellt: What I REALLY want, is to enable the RTE to automatically strip stuff, which paste allows you to configure, but I don't know how to add the configuration.
[16:36:37] tubbo: digital-ghost: just tell me what you want, what you really really want.
[16:36:42] guilund: EminenceHC: youre welcome
[16:37:09] terrellt: digital-ghost: Where do you see that it'll let you do that?
[16:37:31] toretore: i wanna, i wanna, i wanna, i wanna, i wanna really really really wanna zigazig ha
[16:37:54] digital-ghost: tubbo: I want TinyMCE to enabled the "paste" plugin that it comes with, and to configure it so that you don't have to click the "Paste from Word" button, I just want the feature to run automatically when someone pastes into it. There's a configuration for it, I'll find the exact item.
[16:38:08] digital-ghost: terrellt: One moment.
[16:38:37] digital-ghost: Is there some rule for posting links in this channel?
[16:38:49] digital-ghost: Don't want to be bot kicked :P
[16:38:56] toretore: not links, just code
[16:39:15] slash_nick: digital-ghost: the bot only kicks for stupid links
[16:39:20] guilund: toretore: that was LGBT man
[16:39:26] digital-ghost: http://www.tinymce.com/wiki.php/Plugin3x:paste -- if you scroll down to plugin options, the very first option is what I want to enable on all forms used on the site.
[16:39:36] digital-ghost: slash_nick: great to know.
[16:39:41] guilund: toretore: kidding
[16:39:42] toretore: if you want my future, forget my past. if you wanna get with me, better make it fast.
[16:39:44] rehat: is there a way for me to raise a Pundit::NotAuthorizedError ?
[16:40:03] toretore: raise Pundit::NotAuthorizedError
[16:40:37] rehat: im a noob with rails
[16:40:46] guilund: someone knows how can i compile HTML files out of a template and data from db?
[16:40:55] guilund: theres a gem to do that?
[16:41:00] digital-ghost: tubbo: What makes this confusing, is that the app does not have a "tinyMCE.init({})" anywhere in the code base, there's just a <%= tinymce %> on each form page. I don't know what that call does exactly, or if it can be configured.
[16:41:07] guilund: or i have to deal with filesystem?
[16:41:15] slash_nick: toretore: now that was SABS
[16:41:29] dfr|work: guilund, huh? What exactly do you want to do?
[16:41:34] toretore: TemplateEngine.new(DB.read).to_html
[16:41:55] toretore: slash_nick: sabs?
[16:41:57] guilund: dfr|work: i want to make an interface to a bunch of clients edit the content of very simple HTML sites
[16:42:12] toretore: i'm not getting the joke
[16:42:14] dfr|work: guilund, so you want to generate static html files based on data in dB?
[16:42:22] guilund: dfr|work: basically
[16:42:47] slash_nick: toretore: sporty and baby spice, duh
[16:42:51] guilund: dfr|work: im looking for a smart way to do that
[16:43:03] dfr|work: guilund, take a look at http://jekyllrb.com/
[16:43:07] toretore: slash_nick: lgbt is sporty spice?
[16:43:14] slash_nick: no, the lyric
[16:43:26] tubbo: digital-ghost: time to read the source :)
[16:43:26] guilund: dfr|work: i know jekyll, that was my first shot, deal with filesystem and use jekyll to compile
[16:43:29] digital-ghost: Whoever linked me to bootstrap-wysihtml5 - thanks. Very cool.
[16:43:49] digital-ghost: tubbo: Yeah, I tried doing, I'm totally not familiar with the directory structure of gems.
[16:43:51] guilund: dfr|work: but i think its very... complicated, should be a simpler way to do that?
[16:43:54] dfr|work: guilund, by "dealing with filesystem" you mean storing html on filesystem?
[16:44:34] guilund: dfr|work: yeah, compiliing the whole site and storing on s3, or something like that
[16:44:55] guilund: dfr|work: to reduce the server costs
[16:45:14] tubbo: digital-ghost: one thing i like to do is `git clone` the source and then `git grep 'def tinymce'`, because if it's a ruby helper method it's probably in app/helpers and it's probably defined that way.
[16:45:19] dfr|work: guilund, why not just compile it to a zip or whatever you want, and then unzip it on the S3 if you want to avoid CPU usage on s3?
[16:45:39] digital-ghost: tubbo: I'm pretty sure it's a helper.
[16:45:55] dfr|work: guilund, i mean, what alternative do you want? You'll obviously will have to evaluate the templates somewhere, so best you can do is push that CPU usage around
[16:46:21] dagen: How can I select the first item from Invitation::KINDS? https://gist.github.com/anonymous/f11ca9af5fcad8a48b6e
[16:46:34] terrellt: digital-ghost: Are you using TinyMCE 3?
[16:46:48] dagen: I mean that first raiod must be selected by default, but i cant understand how to do this)
[16:46:59] digital-ghost: terrellt: Yes, 3.5.6? I believe. Whatever is current on the tinymce-rails gem documentation page.
[16:47:24] digital-ghost: terrellt: I asked devs above me about upgrading to 4, wasn't an option either.
[16:47:33] guilund: dfr|work: the user will edit the site, i mean, once a month, tops, i dont want to deal with scaling anything, i want the client login in his area, edit the data end hit PUBLISH, then it will compile the whole site once, and serve as static HTML
[16:47:41] terrellt: digital-ghost: You're sure you're not accidentally using 4?
[16:48:15] digital-ghost: terrellt: Gemfile is showing it locked at '3.5.9.pre2'
[16:49:04] guilund: dfr|work: i was wondering whats the best approach to that, but then i can use jekyll on the server to compile, but then i will have to open files, save, etc.
[16:49:13] dfr|work: guilund, so... have a front end that allows the client to make changes and hitting the publish button, which saves info to DB. And then another pipeline that generates the static based on data in DB
[16:49:22] terrellt: digital-ghost: Then I dunno. Says that first option is enabled by default. As for what the helper does, https://github.com/spohlenz/tinymce-rails/blob/master/lib/tinymce/rails/helper.rb it's pretty straight forward.
[16:49:34] dfr|work: guilund, I think jekyll will open files etc for you.
[16:50:17] dfr|work: guilund, anyway, that's an idea. Obviously there's no directly solution for your issue, so you'll still have to invest dev time.
[16:50:43] guilund: dfr|work: yep, i was looking for someone that already did it, and could share some insights
[16:50:45] digital-ghost: terrellt: Thanks for the link, I'm going to learn how gem's directory structures work today, I'm tired of not being able to follow the code.
[16:51:35] guilund: dfr|work: i will think about it, thanks
[16:51:39] digital-ghost: terrellt: If the first option is enabled by default, then all I need to do is actually reproduce the users action to see if it works.
[16:52:33] dagen: i have rake routes for invitations: https://gist.github.com/anonymous/93033cada3661a41a6a5
[16:53:03] dagen: but can't understand why when i try to render :new from my controller i get the url /invitations/ and not the /invitations/new/
[16:53:23] dagen: please help
[16:54:19] terrellt: dagen: Rendering just renders a view for an action. Redirecting will actually go -to- the controller action for processing.
[16:54:50] dagen: but with redirect_to i cant see an errors for form fields
[16:55:02] dagen: ACTION sigh
[16:56:20] terrellt: dagen: The formula you're seeing is normal. When there are errors you see the posted URL, but the proper form with error inputs.
[16:57:14] dagen: and how can i change the url for render :new?
[16:57:22] dagen: trough routes.rb or not?
[16:57:24] mwlang: guilund: here's an snippet from one of my projects that generates HTML from DB data https://gist.github.com/mwlang/8241564
[16:57:50] mwlang: the template.erubis is just a standard ERB template just like found in most Rails projects.
[16:57:51] terrellt: dagen: You can't change the URL just by rendering. You can use pushState with Javascript to change it if it's that important to you, but I really don't recommend it.
[16:58:07] guilund: mwlang: nice man, thanks!
[16:58:16] dagen: no i don't want to use js, i agree with you
[16:58:41] mwlang: passing in "binding" is the key to passing variables to the template.
[16:58:46] dagen: but there is some another way to render form with not filled inputs?
[16:58:58] digital-ghost: Thanks terrellt, tubbo, guilund: I am on the right footing now to getting this working. It looks like I had it installed correctly within the first 15 minutes, but didn't understand the basic configuration/initialization of it, now I do seeing that code you linked.
[17:06:01] digital-ghost: Awesome. So I just discovered that the dev who installed this is calling the tinymce js file three god damn times.
[17:06:28] mwlang: 3rd time's a charm!
[17:06:32] slash_nick: is 3x tiny still tiny?
[17:06:35] digital-ghost: Pretty sure they misinterpreted the setup instructions.
[17:06:51] digital-ghost: There's 3 ways of including it, .. we have all three hahaha.
[17:06:53] mwlang: no, its tripleMCE
[17:16:27] guilund: mwlang: what is the ERB.new in the example you shared?
[17:19:11] mwlang: Its the Erb template class.
[17:19:18] mwlang: http://ruby-doc.org/stdlib-2.1.0/libdoc/erb/rdoc/ERB.html
[17:19:30] guilund: mwlang: thanks!
[17:21:39] mwlang: If you're interested in using some other template, like HAML or Mustache, etc???.you can look up documentation for each and also, you can look at the tilt gem's source for examples of using many different templating engines. https://github.com/rtomayko/tilt
[17:22:06] digital-ghost: I used Mustache about a year ago, that was a lot of fun :)
[17:22:28] guilund: mwlang: im planning how to do it, this information is valuable, thanks!
[17:22:48] mwlang: just wait until they put out Brazilian -- that will be even more fun. :-)
[17:23:21] guilund: i'm brazilian, its a new template language? :P
[17:25:32] mwlang: guilund: j/k -- doesn't really exist (IFAIK)
[17:26:15] guilund: mwlang: hehehe brazil is a fun country, we have a very funny government :P
[17:26:24] rehat: If I am implementing a voting system what kinds of things should I consider besides a user sending more than one
[17:27:25] GeorgesLeYeti: Hi I have an issue for uploading a Sound file with CarrierWave
[17:27:32] mwlang: rehat: robots
[17:28:08] GeorgesLeYeti: I just wanna delete the cache folder after storage
[17:29:14] GeorgesLeYeti: but i really don't get why it didn't work. Actually it creates me 2 folders in my cache directory and only one of them is becoming empty after storage
[17:35:22] brycesenz: I'm having a problem with Rails migrations, if anyone out there thinks they can help. Basically, if I run "rake db:drop", and then "rake db:setup", all of the tables get built, but I still get a warning telling me that there are pending migrations that need to be run (even though the migrations listed as pending have clearly been run in order to build those tables). What could be going on?
[17:39:35] interactionjaxsn: brycesenz: opt for rake db:create, rake db:migrate
[17:40:36] brycesenz: #interactionjaxsn: I acknowledge that those commands work, but I don't know WHY. The documentation I've read indicates that rake db:setup *should* work, and I'd just love to understand what is driving this issue.
[17:42:13] interactionjaxsn: rake db:setup runs rake db:create rake db:schema:load and rake db:seed and is used when setting up a new db on your app.
[17:47:05] interactionjaxsn: brycesenz: there is also rake db:reset. you can run rake -T to get a list of rake commands and further more you can see where the code lives with rake -W db:setup.
[17:47:07] ddd: notice the second thing he mentioned. rake db:schema:load. that doesn't run the actual migrations
[17:47:27] ddd: what it does is load the db/schema.rb file. doesn't touch the migrations
[17:47:53] ddd: in order to mark the migrations as run, you have to run the db:migrate command which updates the schema's version number
[17:48:03] ddd: i forget the field in the schema that records that
[17:48:09] brycesenz: #ddd - so is there a way to force a schema rebuild? This is a new project, so I'm fine losing all of the data in the DB.
[17:48:10] ddd: interactionjaxsn: you know it off the top of your head?
[17:48:21] ddd: brycesenz: just run rake db:migrate
[17:48:31] ddd: any migrations pending being run will be run
[17:48:51] ddd: that field we can't remember the name of (hehe) will be updated and you won't get that warning anymore
[17:49:11] ddd: look in the schema.rb file. its like version or migration_version, something like that
[17:49:28] ddd: tthats the field that gets updated and that rails/rake looks at to determine if all migrations have been run
[17:49:52] ddd: basically the timestamp of the highest run migration gets put in that field
[17:50:13] ddd: so if you have any *newer* migrations, when rails/rake looks it sees there are more and warns you
[17:50:51] ddd: I do *not* know if (when running rake db:set which runs rake db:schema:load) if it incorporates the missing migratiomns but does NOT update the version stampo.
[17:51:34] ddd: that MAY be why you get the warning but your version field is not updated. I do not swear to that, but if you're saying that the database (after running this command) reflects the migration changes, then thats probably why
[17:51:55] ddd: I didn't think sb:schema:load did that (or even the rake db:setup) but i might be wrong.
[17:52:15] ddd: s/rake db:set /rake db:setup /g
[17:52:34] zeknox: im having an issue password protecting the sidekiq web console, when you visit /admin/sidekiq, "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." if i remove my customfailure redirect_to method it works properly, any advice would be much appreciated: https://gist.github.com/zeknox/8242695
[17:52:39] ddd: now that i've put out a wall of text hehe, i'll sit back and let you catch up
[17:53:24] ddd: plus that will allow any lurkers with knowledge to catch up and correct me if or where i'm wrong
[17:56:21] zeknox: why would sidekiq think my root_path is "/admin/sidekiq/" instead of '/' ?
[17:56:27] brycesenz: #ddd - what I'm confused by is that running rake db:setup should be loading my schema.rb file, which has my latest migration timestamp set in that field. But it *still* tells me that there are migrations pending!
[17:56:50] ddd: brycesenz: remove the #. # means a comment, so if yo're trying to hilight it for me, its not going to work
[17:57:10] ddd: brycesenz: probably because you have newer migrations than that recorded timestamp
[17:58:10] ddd: it takes the string in that version field, compares it to the timestamp in the migrations filenames (like blah_blah_restistimestamp.rb and compares just the portion marked restistimestamp)
[17:58:27] interactionjaxsn: brycesenz: like i said, avoid using setup without looking into the rake commands it runs.
[17:58:35] ddd: so if you have anything newer than what is recorded it'll give you warnings which you should pay attention to
[17:58:38] brycesenz: ddd: I don't. That's what's killing me - the recorded timestamp matches my last migration timestamp, but it still tells me all of my migrations are pending.
[17:58:59] ddd: because either you DO have newer migrations OR the migration version field wasn't properly updated so the comparance is off
[17:59:00] diegoviola: <%= f.select :sublevel, ("A".."Z").to_a %> <-- i have this line in my view, but not sure if i should be generating letters like this? is there a better way to do it and where should i be placing this code?
[17:59:11] ddd: so just rerun rake db:migrate and let it update the version field
[17:59:17] ddd: then rerun rake db:setup
[18:01:15] krz: anyone deploy to ec2? are micro instances good for a web application bigger than a blog? speaking to an aws engineeer and he recommends using a small instance instead
[18:01:44] interactionjaxsn: diegoviola: this comes down to personal preference. Im not sure about what you are doing so it's hard to say if this is the right place for it but this is innocuous enough to be left there
[18:02:00] ddd: krz: I use an aws micro. works for me, but my traffic levels are hella low
[18:02:18] diegoviola: interactionjaxsn: i just need to generate a select elements with many options those options need to be letters from A to Z
[18:02:41] interactionjaxsn: krz: the beauty of aws is that you can always change it later. throw up a micro and see how that feels...
[18:03:23] ddd: \what interactionjaxsn said
[18:04:03] ddd: krz: and if you find that aws micros are not sufficient, then upgrade to the next level (but that's paid). or, check out digitalocean.com or even linode.com
[18:04:31] krz: yea on a micro now. cloudwatch reports close to 100% cpu usage on the ec2 mircro instance. but only when it boots (i.e. when doing git aws.push)
[18:04:31] ddd: but i'd be suprised if a 1GB memory aws wasn't sufficient. it works for my jruby
[18:04:41] krz: i think thats normal. but thats just me
[18:04:45] ddd: well yeah, its an initial bootup
[18:04:47] interactionjaxsn: diegoviola: right... if it works then its fine. the thing you have to ask yourself is, do you need that select criteria somewhere else? would you be repeating yourself later down the road?
[18:04:56] ddd: load levels are always high on initial boot on ANY machine or virtual
[18:05:16] diegoviola: interactionjaxsn: i don't think i need that somewhere else right now
[18:06:17] interactionjaxsn: diegoviola: then skip this for now and come back to it when its a real issue. don't get caught up on what to put where.
[18:06:30] diegoviola: interactionjaxsn: right, thanks
[18:08:11] ddd: brycesenz: i just checked my logic with others as or more knowledgable as me and I'm correct on the steps involved and what touches what
[18:08:35] krz: ddd: you on the elastic beanstalk?
[18:08:38] ddd: so either you DO have migrations pending and aren't seeing it, or your version field is NOT being updated correctly which rerunning rake db:migrate will fix
[18:08:38] krz: just curious
[18:09:03] ddd: i haven't had time to check that out yet so i haven't added it
[18:09:10] ddd: I'm on the free year aws micro stuff
[18:09:33] brycesenz: ddd: I found an issue on Stackoverflow that mirrors my issue if you want a more thorough description. (http://stackoverflow.com/questions/18227592/rake-dbsetup-dbtestprepare-wont-behave-as-expected).
[18:09:39] ddd: and i really wish i coulkd move off aws's us-west to us-east
[18:09:46] ddd: brycesenz: sec
[18:10:29] ddd: give me a sec'ond
[18:10:46] ddd: sec is shorthand for that. sorry. internet shorthand :)
[18:11:27] ddd: ok let me read this. i'm slow today, so give me a few seconds lol
[18:13:08] ddd: see the entry by sevenseascat
[18:13:19] interactionjaxsn: You need to run rake db:migrate, and you should have a schema.rb file. You say rails should apply the migrations - but you're not telling it to.
[18:14:17] brycesenz: ddd: but then when I run "rake db:migrate", I immediately get an error telling me that the table already exists (because it is being built in rake db:setup, yet still claiming that the migration is pending)
[18:14:45] brycesenz: This is the error "rake aborted!
[18:14:45] brycesenz: An error has occurred, this and all later migrations canceled:
[18:14:45] brycesenz: PG::DuplicateTable: ERROR: relation "versions" already exists"
[18:15:23] ddd: brycesenz: yeah because the 2 of them are doing the same thing, except migrations does it from scratch
[18:16:12] brycesenz: ddd: Yes, but that's my point - if the table exists when the schema is loaded, and the timestamp on the migration is from BEFORE the latest timestamp in the schema version, why am I still getting a notification that the migration is pending?
[18:16:14] ddd: from reading that as well, it looks like its not honoring the 2nd db:* on the same line (rake db:setup db:test:prepare)
[18:16:23] interactionjaxsn: brycesenz: why are you dropping your tables like this? how often are you doing this?
[18:16:24] brycesenz: It's older (by timestamp), AND it's already been built!
[18:17:27] brycesenz: interactionjaxsn: A handful of times? Early on in a project when I'm still figuring things out, I'll just change old migrations, drop the database, and recreate it rather than adding new migrations.
[18:18:03] brycesenz: ddd: This problem is occuring whether or not I use db:test:prepare as well.
[18:19:11] interactionjaxsn: brycesenz: rollback your migrations to a specific point in time, make your migration changes and then rake db:migrate.
[18:21:17] diegoviola: interactionjaxsn: i just found i don't even need the #to_a in the view
[18:21:28] diegoviola: so not sure if i should leave it there or remove it
[18:21:45] diegoviola: it will still give me a array of letters
[18:22:41] ddd: sorry, dealing with the family for a few. I don't have an immediate answer
[18:22:43] diegoviola: f.select :sublevel, ("A".."Z") is enough it seems
[18:22:49] ddd: all i can say is --trace and see what's going on
[18:23:19] ddd: (iirc its either --verbose or --trace to see what rake is doing as its doing it) and compare the outputs
[18:29:17] diegoviola: why is that when i add ("A".."Z") as the value for a select() i get all the elements converted to <option>? but when i execute ("A".."Z") in pry i don't get the values unless i call #to_a?
[18:29:33] diegoviola: will f.select() already call #to_a?
[18:37:38] brycesenz: interactionjaxsn: I rolled back all of my migrations and migrated everything. Yet still, if I try to run rake db:reset or a similar set of commands, I get all of my tables rebuilt, yet a message stating that I have 30 pending migrations.
[18:43:18] pontiki: how many migrations do you have?
[18:44:55] pontiki: can you see all 30 timestamps in the database migrations table?
[18:45:22] brycesenz: ddd: So through some trial and error, it looks like the command "rake db:migrate:reset" gives me the output that I want , even though "rake db:reset" is behaving oddly.
[18:45:34] jxf: I'm having some issues with putting validations on model instances. If anyone has thoughts I'd be much obliged: http://stackoverflow.com/questions/20910594/how-does-one-put-validations-on-individual-activemodel-activerecord-objects
[18:51:13] brycesenz: pontiki: That's the difference! Ok, I got it - when I run rake db:setup, it loads the schema, but creates an empty migrations table. So then even though the schema is up to date, it sees my old migration files and figures that they still need to be run (even though the timestamp settings are correct).
[18:51:34] brycesenz: Whereas if I run rake db:migrate:reset, the database migrations table gets correctly populated.
[18:52:18] brycesenz: So....how do I fix that? How do I tell rails that no, when you load the schema, all of my old migrations HAVE actually been run?
[18:56:46] pontiki: jxf: idk, maybe something about extending ActiveModel::Validation in HasWinterTyres?
[18:57:43] brycesenz: jxf: I replied on StackOverflow - let me know if that works for you.
[18:57:46] jxf: pontiki: If you extend it, then `validates` won't be a class method so you can't use it.
[19:01:39] jxf: brycesenz: Also replied there. Appreciate your input. :)
[19:01:58] diegoviola: f.select :sublevel, "A".."Z"
[19:01:58] diegoviola: is that the way i'm supposed to get a range in a select
[19:02:02] diegoviola: no need to call #to_a on it right?
[19:03:20] diegoviola: not sure if i need options_for_select()
[19:04:28] brycesenz: jxf: What error are you getting exactly when you try to put the validations in a concern?
[19:05:11] brycesenz: jxf: Because I often define things in a concern that the module itself wouldn't understand.
[19:07:20] jxf: brycesenz: See: https://gist.github.com/fj/572437ac01e195ce5ba4/raw/bfd4760c2c6392e7759d92ac1e1026cb781af6d4/gistfile1.txt
[19:07:24] mmun: I have a post model has a new comment_count property, and I want to do a one time migration to initialize it. Post.joins(:comments).update_all(:comment_count => 'not sure what to put here')
[19:07:56] jxf: mmun: what do you want to initialize it to?
[19:08:02] jxf: mmun: the actual value?
[19:08:21] mmun: jxf: to get the count of comments that belong to the post and put it into the comment_count column
[19:09:31] jxf: mmun: I'd probably use something like "Post.joins(:comments).find_each { |p| p.comment_count = p.comments.count }".
[19:10:20] jxf: (and do updates/validations/etc. as you see fit in the rest of the block)
[19:11:50] gerep: Hi all. I'm sure this is simple but I can't load my image that's inside the folder /public/uploads/users/..., <img alt="17" src="/uploads/users/1388776208278711/17.jpg">
[19:12:02] gerep: <%= image_tag(resource.document_file_url) %>
[19:12:12] gerep: what am I doing wrong?
[19:13:19] mmun: jxf: thanks
[19:16:17] mmun: jxf: would I not need to use includes instead of joins in that case?
[19:36:02] tubbo: gerep: does that file actually exist? can you `ls /your/app/public/uploads/users/1388776208278711/17.jpg` and get a successful response?
[19:36:33] gerep: tubbo, yes, the file is there :)
[19:36:44] tubbo: gerep: well, that is strange then
[19:36:58] tubbo: gerep: looks like it's making the right <img> tag
[19:37:01] gerep: tubbo I'm using carrierwave
[19:37:17] tubbo: gerep: is this like, local?
[19:37:24] tubbo: or on a vps somewhere?
[19:37:29] gerep: tubbo yes, local
[19:37:36] tubbo: hmm, that is strange
[19:38:00] helpa: gerep: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:38:00] tubbo: gerep: !gist your uploader, model and the exact error you got
[19:38:26] tubbo: gerep: so the file exists but it doesn't load?
[19:38:38] gerep: tubbo yes
[19:38:45] gerep: tubbo I'm gisting the code
[19:40:33] gerep: tubbo https://gist.github.com/gerep/8245050 the Model and UserUploader, the column is document_file
[19:41:52] gerep: tubbo please refresh the gist, I've added the erb
[19:44:06] gerep: tubbo I think I know what it is, refreshing my view, the numbers in the file path are changing, maybe because of the path I've set up on User Uploader?
[19:45:11] gerep: tubbo that's it
[19:45:44] gerep: tubbo, the problem happens because the path I choose on UserUploader is generating a random number each time
[19:45:50] tubbo: gerep: haha and this DateTime.now.to_i
[19:45:53] tubbo: gerep: i was about to say
[19:45:59] gerep: tubbo that's it :)
[19:46:03] tubbo: that looks really suspicious, you sure it isn't changing the dir every time store_dir is called?
[19:46:04] gerep: tubbo thanks a lot for your time :)
[19:46:21] tubbo: gerep: generate all that on the model, save the random numbers in the db, and call it from store_dir
[19:46:27] tubbo: that way you generate the numbers once and persist them
[19:46:48] tubbo: gerep: tryna be slick? ;)
[19:46:55] gerep: tubbo will do that :) thanks a lot ;)
[19:48:23] tubbo: hey guys i have a question for once
[19:48:33] tubbo: let's say i'm storing location attributes in a postgres GEOGRAPHY type
[19:48:44] tubbo: and i'm using activerecord-postgis-adapter
[19:48:56] agent_white: Afternoon fellas
[19:49:19] tubbo: how can i search that with /locations?lat=0&long=0
[19:49:33] tubbo: the location is stored in one column, which i think serializes to an array
[19:49:43] tubbo: do i have to do that param transformation in the controller?
[19:53:11] lethjakman: anyone know where activerecord .save is specified?
[19:54:01] gerep: lethjakman what do you wanna do with them?
[19:54:21] gerep: lethjakman and answering your question, I don't know :)
[19:54:21] lethjakman: gerep: I'm remembering a method that set and saved if the value wasn't already what I'm setting it to...and I'm trying to remember what it was
[19:54:27] interactionjaxsn: lethjakman: activerecord:persistence
[19:55:08] gerep: lethjakman man...the only thing I understood in that line was my name :)
[19:55:29] lethjakman: I know I'm over complicating things I think...
[19:59:59] bricker: lethjakman: fun trick: @your_record.method(:save).source_locastion
[20:00:02] bricker: source_location
[20:00:11] lethjakman: bricker: what's that do?
[20:00:14] helpa: lethjakman: Why don't you try it and find out for yourself?
[20:00:14] bricker: lethjakman: !try
[20:00:41] bricker: (or look it up in the Ruby documentation) Method#source_location
[20:00:52] slash_me: http://ruby-doc.org/core-2.0/Object.html#method-i-method
[20:00:58] lethjakman: thank you that helps me a lot.
[20:01:40] lethjakman: that's gonna make my life like 10 times easier
[20:01:47] lethjakman: I thought that was something to do with my actual question.
[20:01:57] lethjakman: didn't want to save weird things to my database.
[20:02:04] slash_me: oh cool... hadn't seen Method#source_location .. thanks bricker!
[20:03:15] slash_me: seems like that could drive a neat static ruby code analysis feature... "what % of your code is plain ruby?"
[20:04:33] lethjakman: hrm...yeah I want an update that updates only if it's different from what it originally pulled from the database. does that exist?
[20:06:07] crankharder: lethjakman: thats what #save does
[20:06:07] slash_me: lethjakman: are you using AR?... you could just `@obj.save if @obj.changed?`
[20:06:55] lethjakman: I am using AR
[20:07:02] lethjakman: crankharder: I'm trying it and it seems to be htiting the DB
[20:07:16] tubbo: slash_me: define plain ruby
[20:07:24] bricker: lethjakman: I *think* AR already does that.
[20:07:47] bricker: lethjakman: It checks the changed attributes before saving and only updates those (finding the code now...)
[20:08:05] tubbo: lethjakman: did you check out AR::Dirty?
[20:08:18] lethjakman: ohhh it's doing something weird...
[20:08:20] slash_me: tubbo: it'd determine what percentage of your code uses methods that weren't defined in stdlib or the library undergoing analysis
[20:08:33] lethjakman: I have seen it
[20:08:37] tubbo: slash_me: oh ok
[20:08:37] lethjakman: the if changed is faster though
[20:08:39] lethjakman: that's what I need
[20:08:42] slash_me: tubbo: AM::Dirty :)
[20:08:43] lethjakman: I could have swore that was a method though
[20:08:46] tubbo: slash_me: yes :)
[20:09:37] bricker: lethjakman: check it https://github.com/rails/rails/blob/master/activerecord/lib/active_record/attribute_methods/dirty.rb#L69
[20:09:55] bricker: slash_me: actually it's AR::Dirty that does this
[20:10:38] bricker: slash_me: (but it uses AM::Dirty, so you're half right)
[20:10:55] bricker: slash_me: half credit earns you 10 bricker coins, nice work.
[20:12:09] slash_me: bricker: can i get my other 10? (he's using #changed?) https://github.com/rails/rails/blob/04cda1848cb847c2bdad0bfc12160dc8d5547775/activemodel/lib/active_model/dirty.rb#L102
[20:12:41] slash_me: there that's better: https://github.com/rails/rails/blob/master/activemodel/lib/active_model/dirty.rb#L109
[20:13:14] bricker: slash_me: I was talking about the partial writes
[20:14:09] slash_me: Talking about how it inserts only the values from #changed ?
[20:14:57] jsilver: why is trolling #centos so addictive
[20:15:40] slash_me: because "yum"
[20:15:50] lethjakman: oooo there's lots of cool goodies in here.
[20:15:53] lethjakman: that command helps a lot.
[20:24:43] lethjakman: so...every time I make a coffeescript file it surrounds it with: https://gist.github.com/lethjakman/8245881
[20:24:49] lethjakman: is there a way to configure rails to not do that?
[20:25:35] bricker: lethjakman: Yes but it does that for a very good reason and telling it not to is not advised.
[20:26:08] bricker: lethjakman: actually now that I think about it, I'm not certain that there is an "official" way to do that (it'd be a coffee compiler configuration)
[20:44:15] lethjakman: bricker: why would I want that?
[20:44:35] lethjakman: it messes with my variables/functions and makes it ugly to declare them for use in another file with one file
[20:45:25] lethjakman: maybe there's a way to make library coffeescript files or something?
[20:46:34] tubbo: lethjakman: nope, unfortunately that's part of the coffee compiler settings sprockets passes down
[20:46:45] tubbo: lethjakman: the way i get around it just attach things to window or `this.`
[20:46:59] tubbo: so just do `class @MyAwesomeJSObject` instead of `class CoolJSObject`
[20:47:18] tubbo: lethjakman: you could also use this lib i wrote github.com/tubbo/sumatra
[20:47:26] tubbo: err http://github.com/tubbo/sumatra-rails and http://github.com/tubbo/sumatra
[20:48:02] lethjakman: tubbo: I know...I just think that's ugly.
[20:48:18] tubbo: me too :)
[20:48:21] lethjakman: meh I'll see if there's something better I can do.
[20:48:29] lethjakman: I wonder if they'd accept a change to the library...
[20:48:35] lethjakman: no clue how hard that'd be to do.
[20:49:22] tubbo: lethjakman: tbh if you did the work to add a config setting i'd +1 it. :)
[20:49:34] lethjakman: I'll see if I get some time over the weekend.
[20:49:36] tubbo: i would rather coffeescript not surround my code with those crazy closures so i can use classes globally
[20:49:38] lethjakman: I'd definitely want it too.
[20:49:42] rwilcox: There's https://github.com/metaskills/sprockets-blackcoffee. Don't know if it still works, but it was around when I had the same problem a year or so ago
[20:49:42] tubbo: since it's all one big file anyway
[20:49:56] tubbo: oh awesome
[20:49:58] lethjakman: which is why they do it...but still that's not a good option to force on people
[20:49:59] tubbo: lethjakman: that is what you want ^^
[20:50:13] tubbo: sprockets-blackcoffee, if it works, renders with --bare
[20:50:34] rwilcox: I also wrote a blog entry at the time: I think you can probably avoid using blackcoffee, but.... http://www.greenriver.com/news/2012/09/rails-asset-pipeline-coffescript-edgecases.html )
[20:52:19] lethjakman: oooo this is a great blogpost I've been looking for this rwilcox
[20:52:37] rwilcox: lethjakman: glad you enjoy :)
[21:40:49] RubyRonin: greetings all
[21:41:47] RubyRonin: when installing the bootstrap-sass gem where do I find the actuall css files to edit?
[21:51:46] slash_nick: The Dude007 abides
[21:52:33] droptone: we're intersted in coding a rails 3.2.x view that pulls youtube videos from a user's channel, and displays the most recent video at a larger resoltuion, then the less recent ones in smaller boxes beneath.
[21:52:47] droptone: We were looking at this youtube_it gem, which seems to offer full interaction with the youtube api
[21:53:20] droptone: but going through the github description and instructions for the gem, I dont' see antyhing regarding pulling and embedding videos from a channel
[21:53:32] droptone: have any of you performed such a task with youtube videos?
[21:54:04] droptone: oh never mind, apparently this does support video embedding
[21:55:22] wmoxam: Fuck it, Dude007, let's go bowling.
[22:01:38] Dude007: wmoxam: Sure thing, where do you live? LP
[22:03:03] Delacram: Hey guys... I'm getting 'undefined method "first_name" on nil nilclass'
[22:03:05] Delacram: https://gist.github.com/drichards2013/8239360
[22:03:24] Delacram: Can't figure it out everything looks like it's set up correctly
[22:04:13] wmoxam: Dude007: I like your style, Dude007
[22:05:43] tubbo: Delacram: you never tell us at which action the error occurs
[22:05:59] Delacram: It's in the gist description right at the top
[22:06:03] Delacram: It occurs at
[22:06:41] Delacram: show.html.erb, on line 4. comment.user.first_name
[22:07:10] tubbo: Delacram: https://gist.github.com/drichards2013/8239360#file-guides_controller-rb-L21 don't you want @comments here?
[22:07:21] tubbo: @comment = @comments.build
[22:07:36] Delacram: Let me give that a try
[22:08:34] Delacram: undefined method `build' for nil:NilClass
[22:08:46] Delacram: on @comment = @comments.build
[22:09:09] tubbo: Delacram: yeah, see what you did there?
[22:09:19] tubbo: look at the line above and tell me what's wrong with it
[22:09:29] Delacram: @comments is nil
[22:09:44] tubbo: Delacram: yeah but why?
[22:09:51] tubbo: what does it equal? what is `guide`?
[22:10:19] Delacram: Do you know the answer and are quizzing me?
[22:10:26] Delacram: Or are you asking me for real?
[22:10:30] tubbo: i'm trying to get you to figure out the answer for yourself
[22:10:34] tubbo: because it's very simple
[22:10:58] Delacram: Well what is guide?
[22:11:07] tubbo: Delacram: to me it looks like nothing :)
[22:11:14] tubbo: the var you set above it is called @guide
[22:11:16] tubbo: not 'guide'
[22:11:38] tubbo: Delacram: the reason i didn't just correct you is because you did it twice. i was afraid you misunderstood how ruby worked in this case.
[22:12:17] Delacram: What instance of guide are you talking about?
[22:12:54] tubbo: Delacram: well here, you set an ivar called '@guide' https://gist.github.com/drichards2013/8239360#file-guides_controller-rb-L19
[22:13:11] tubbo: Delacram: and here, you reference a local variable (which doesn't exist) called 'guide' https://gist.github.com/drichards2013/8239360#file-guides_controller-rb-L20
[22:13:21] tubbo: Delacram: so i'm pretty sure you want @guide there
[22:13:28] tubbo: Delacram: because that would be a variable that exists
[22:14:08] Delacram: Still getting undefined method `first_name' for nil:NilClass
[22:14:27] tubbo: Delacram: yeah, why do you think that is happening? consider what we just did, and look at the last line of code in that method.
[22:14:38] tubbo: `@comment = comments.build`
[22:14:44] tubbo: why would that be failing now?
[22:15:10] tubbo: Delacram: well, the line of code above this, what did we do?
[22:15:20] tubbo: we set @comments to @guide.comments
[22:15:32] tubbo: now, we want to reference @comments in the line below. but that's not what you're doing
[22:15:40] Delacram: The only two lines I have are these
[22:16:04] Delacram: http://gyazo.com/128415cf8ccc6b86342ed2212e98b225
[22:16:15] Delacram: Are we on the same page?
[22:16:34] tubbo: Delacram: what happened to this line? https://gist.github.com/drichards2013/8239360#file-guides_controller-rb-L21
[22:16:44] tubbo: that's what you reference in your view
[22:17:19] lethjakman: tubbo: hey, wasn't that task you told me to run migrations "cap production deploy:migration" ?
[22:17:32] tubbo: lethjakman: deploy:migrate, yeah
[22:17:38] tubbo: i think that's the task
[22:18:01] Delacram: Alright, tubbo
[22:18:12] Delacram: are the two first lines in my picture correct?
[22:18:18] lethjakman: weird...not running.
[22:18:23] tubbo: Delacram: they look good to me
[22:18:31] Delacram: THe third line
[22:18:35] tubbo: Delacram: oh wait a second
[22:18:39] tubbo: Delacram: you don't need the third line
[22:18:42] tubbo: lol sorry about that
[22:18:46] tubbo: Delacram: yeah you should be ok now
[22:19:17] Delacram: Okay let me see
[22:20:15] Delacram: tubbo: undefined method `first_name' for nil:NilClass
[22:20:18] Delacram: on the same lines
[22:20:39] tubbo: Delacram: hmm, is @guide nil?
[22:20:49] Delacram: How would I check that?
[22:21:06] tubbo: Delacram: use pry or a debugger
[22:21:28] tubbo: `require 'debug' ; debugger` to start a new instance right there
[22:21:36] tubbo: or you could write a test and try to replicate this code
[22:22:41] momomomomo: Delacram: http://pryrepl.org/
[22:42:46] kedric: Hey all, looking to wrap my rails header around a phpbb forum. Any good way to go about doing this? Should I take css of the site and put it in the phpbb theme or is there a way to render a php page within a rails app?
[22:45:22] terrellt: ...You can use an iFrame I guess. The CSS way is probably better though.
[22:46:23] kedric: terrellt: The iFrame would mean people could link directly to the forum which would not be good :(
[22:46:24] s2013: use the css.. or maybe use jquery to load that portion
[22:46:44] s2013: that will use ajax but it should work
[22:46:47] terrellt: Yeah, use CSS.
[22:47:47] s2013: i have a question about js charts. i asked beore but anyways after seeing how ryan bates did it, i thought it was a bit odd.. he outputed the json dump in a data attribute.. is that the proper way of doing it?
[22:54:33] dagen: if I need to check values of some fields trought 'validates_presence_of :pass_series' in my user.rb model, how can I add some IF to user.rb model for the condition to be performed only when i post some data for some page?
[22:56:14] dagen: for example i have some form to post user passport data, and i want to check fields of this form trought 'validates_presence_of :pass_series' only when i post teh requiest from view with passport data, not with personal or photo or something else...
[22:57:17] s2013: you mean conditional validation?
[22:57:24] dagen: now when i add some fields to 'validates_presence_of' *, *, * etc - the alidation of added fields was worked at all pages
[22:57:39] dagen: hm, maybe
[22:58:00] s2013: you can add something lke validates_presence_of :blah, if :something
[22:58:03] s2013: and then declare that method
[22:58:24] s2013: http://edgeguides.rubyonrails.org/active_record_validations.html#conditional-validation dagen
[22:58:53] dagen: I need to check worked only for a specific views, and the method of the controller, and not for all methods
[22:58:58] RubyRonin: what is the syntax for "if page == index.html.erb do else do "...is it that simple or should I add something?
[22:59:02] dagen: i need this
[22:59:04] dagen: you right
[23:00:03] dagen: s2013 your nick is depricated)
[23:00:03] s2013: RubyRonin: whats the usecase?
[23:00:11] s2013: dagen: i know :( i will soon be as well
[23:00:42] RubyRonin: s2013: I want to remove a div from my application layout file
[23:00:51] RubyRonin: only if a certain state page is loaded
[23:00:57] RubyRonin: and replace with other html
[23:01:02] s2013: you can use current_page?
[23:01:16] s2013: so like current_page?(controller: "blah", action: 'blah")
[23:01:24] s2013: if you only want to remove certain div
[23:01:27] bricker: you're doing it backwards. Set the HTML in a content_for block in index.html and render that content block in the layout file
[23:01:30] bricker: RubyRonin: ^
[23:02:17] RubyRonin: ok...not really sure how to do either, I'll google both :-D
[23:02:19] dagen: s2013 and what I must to do with : payment_type == "card" from your example to do the check?
[23:02:22] RubyRonin: thanks bricker and s2013
[23:02:27] ivanskie: man why does sublime cost so much
[23:02:51] bricker: ivanskie: because they give it away for free so they need to charge the people to buy it way more
[23:02:53] ivanskie: been using it for so long now, i kinda want to just buy. but its so expensive
[23:02:53] skyjumper: it's in demand and programs have money
[23:02:53] s2013: dagen: what do you mean
[23:02:56] dagen: RubyRonin if page == something do <div> else nil end?
[23:02:59] skyjumper: programmers have money
[23:03:03] s2013: that reminds me.. we purchased multiple sublime license
[23:03:12] s2013: but i never registered mine. i should do that
[23:03:14] bricker: skyjumper: we do??
[23:03:27] bricker: ACTION checks wallet
[23:03:29] bricker: ACTION checks pockets
[23:03:31] RubyRonin: dagen thanks
[23:03:36] skyjumper: bricker: we're supposed to
[23:03:38] bricker: ACTION checks bank account
[23:03:54] dagen: ivanoats do you mean sublime text 3 editor?
[23:03:54] skyjumper: doesn't always work out that way though
[23:03:56] ivanskie: will have to wait till i have spare 80 bucks. dont get paid as a programmer. :( so can't ask company to pay for it either
[23:04:01] bricker: hm, mine seems to have gone missing.
[23:04:32] terrellt: Yeah, programmers don't have money. Companies who employ programmers have money.
[23:04:35] terrellt: Like I'd pay for an IDE, psh.
[23:04:42] bricker: ivanskie: if they really cared, they would put actual limitations on the trial version. Think of purchasing as a "Donation" more than anything.
[23:04:48] bricker: ivanskie: reguarding Sublime, I mean
[23:04:55] dagen: s2013 i mean: how can I set some params to get checking of in wich views or method i'm present in
[23:05:02] pipecloud: What is munny?
[23:05:02] slash_nick: terrellt: sure they do... but what the hell do they do with that money?
[23:05:03] ivanskie: ya i got it
[23:05:09] pipecloud: ACTION is poor lonely developer.
[23:05:40] pipecloud: ivanskie: Are they holding you captive as slave?
[23:05:49] tubbo: pipecloud: it's that green stuff you trade for scarface-level mountains of cocaine
[23:05:53] skyjumper: thought rails devs were highly in demand
[23:06:06] pipecloud: skyjumper: In demand to work for free!
[23:06:33] agent_white: I'm currently unemployed. I've found it does not pay well.
[23:06:50] ivanskie: lol not quite. but might as well
[23:07:04] dagen: s2013 how can I do something like this? validates :pass_series, presence: true, if: params[:kind] == 'passport' ?
[23:07:07] ivanskie: agent_white: yep been there. certainly doesnt
[23:07:12] pipecloud: dagen: lambda.
[23:07:19] dagen: lambda... hmm
[23:07:35] pipecloud: dagen: if: -> { params[:kind].eq('passport') }
[23:07:53] s2013: can you access params directly in the model though?
[23:08:17] pipecloud: You can pass them in however you want though.
[23:08:29] dagen: s2013 directly not, but maybe i try it wrong
[23:09:31] dagen: undefined local variable or method `params' for #<User:0x9f1a2bc>
[23:09:48] bricker: !critical-thinking
[23:09:50] dagen: i get this error when i try this string: validates :pass_series, presence: true, if: -> { params[:kind].eq('passport') }
[23:10:04] pipecloud: dagen: Then figure out how to get the kind passed into the model.
[23:10:08] pipecloud: Think about it.
[23:10:16] s2013: because you cannot access params in the model dagen
[23:10:34] dagen: i understand and i try to find the some way to do this
[23:10:47] tubbo: dagen: wait is .eq() a method?
[23:10:50] bricker: dagen: make "kind" a property of the Model.
[23:11:04] pipecloud: tubbo: Why wouldn't it be?
[23:11:15] tubbo: because ==
[23:11:33] dagen: bricker but how? i dont know
[23:11:39] dagen: and i try to understand this
[23:11:44] bricker: dagen: start with `attr_accessor`
[23:12:23] pipecloud: tubbo: because == looks and reads lamer than eq?
[23:12:32] pipecloud: or eql? whatever
[23:12:40] tubbo: pipecloud: says you
[23:12:47] dagen: but why is attr_accessor?
[23:12:48] pipecloud: tubbo: No one else matters.
[23:12:52] tubbo: pipecloud: <3
[23:13:02] bricker: dagen: !g ruby attr_accessor
[23:13:03] pipecloud: dagen: You should learn some ruby basics.
[23:13:24] tubbo: also known as "virtual attributes"
[23:13:28] pipecloud: It'll make your work with rails less flabbergasting.
[23:13:31] tubbo: ACTION cues techno music
[23:13:34] dagen: i learn about attr_acessor but i don't understand why i should use this with current task
[23:13:38] ivanskie: is it a convention to name all haml files in views and layouts as filename.html.haml ?
[23:13:50] pipecloud: dagen: How do you expect to get the kind in the model?
[23:13:52] s2013: i just realized attr_accessor is same as @property in objc. cool
[23:13:59] tubbo: dagen: well, the way rails works...is that when you pass in attributes to YourModel.create(), rails actually sets those values to attributes of the model
[23:14:06] dagen: tubbo ) Sven Vath?
[23:14:08] bricker: ivanskie: not convention, it's necessary for rails to find your templates properly
[23:14:15] dagen: pipecloud i dont know
[23:14:15] s2013: ivanskie: you need to
[23:14:18] pipecloud: See ActiveModel::Model's initialize method.
[23:14:19] bricker: and process them with the right processor
[23:14:20] s2013: cause it goes from haml -> html
[23:14:27] s2013: it still has to process them into html
[23:14:38] ivanskie: im glad i asked before just steaming ahead to rename all files to .haml lol
[23:14:41] pipecloud: dagen: Sounds like a good thing to spend a few minutes thinking about, but I'm sure tubbo is just going to give you the answer.
[23:14:46] tubbo: dagen: ActiveRecord overrides method_missing (the "magic") so when you don't define a method it just defines one to read data or write to the database.
[23:14:51] s2013: dagen: basically pass the parameter to your model
[23:14:52] pipecloud: s2013: I don't think so, actually.
[23:14:55] ivanskie: s2013: that makes a lot of sense
[23:14:57] tubbo: just a high-level overview
[23:15:09] pipecloud: scss, sass, and haml don't need to end in their respective extensions as the last one.
[23:15:24] dagen: i'm a little bit confused
[23:15:26] s2013: hmm. i always thought they did ..
[23:15:30] pipecloud: tubbo: I thought they did something else.
[23:15:34] pipecloud: s2013: Things change.
[23:15:47] s2013: but you dont pipecloud . you are a ball of sunshine always
[23:15:49] pipecloud: tubbo: They read the schema and define the class with the methods.
[23:15:58] dagen: deadlocked with this.
[23:16:09] s2013: dagen: you can initialize your model
[23:16:09] pipecloud: s2013: I'm the motherfucking image of kindness.
[23:16:20] s2013: atleast i thikn thats how you approach it
[23:16:27] s2013: initialize your model.. and pass the parameters to it
[23:16:29] pipecloud: dagen: Think about how you intend to get the 'kind' attribute to your model.
[23:16:30] dagen: s2013 what do you mean?
[23:16:36] tubbo: pipecloud: hmm, well conceptually you are correct, but i believe it defines method_missing somewhere to do so
[23:16:41] dagen: pipecloud i dont know(
[23:16:55] tubbo: pipecloud: that's why it's not recommended to define method_missing on AR models, because AR does it and you're interfering with the flow of the whole ORM
[23:17:00] pipecloud: tubbo: I'm not really into activerecord, but I was semi-certain they removed it.
[23:17:17] tubbo: pipecloud: maybe they did and they do things differently now...not sure. i don't see why they would do that though
[23:17:20] pipecloud: tubbo: Any rubyist knows to pass everything up the chain with super appropriately.
[23:17:24] tubbo: to me that's the most efficient way of doing the job
[23:17:29] pipecloud: tubbo: But it's not.
[23:17:33] tubbo: you don't call anything from the db until you need it
[23:17:50] pipecloud: Getting all attributes from the class you reference via the schema at the first time you call the class is the most efficient.
[23:17:57] pipecloud: Blow less method caches, plz
[23:18:04] tubbo: whatever, it really doesn't matter
[23:18:09] s2013: dagen: http://stackoverflow.com/questions/13612846/how-to-access-params-in-the-callback-of-a-rails-model
[23:18:52] tubbo: though i wonder if i can now override method_missing in AR without it hating me
[23:19:05] RubyRonin: hmmm....I'm using twitter bootstrap sass gem, and the getboostrap div class col-md-6 class doesn't work
[23:19:09] pipecloud: tubbo: As long as you pass everything up via super, you should be able to.
[23:19:11] RubyRonin: any advice?
[23:19:21] tubbo: pipecloud: well i wonder if AR still overrides it
[23:19:34] pipecloud: tubbo: They'd have to use #prepend_features to stop you.
[23:19:46] dagen: RubyRonin what version of bootstrap you use?
[23:20:06] RubyRonin: gem 'bootstrap-sass', ''
[23:20:16] dagen: s2013 i read you linkm but cant understand them(
[23:20:31] pipecloud: dagen: You're missing a lot of fundamental ruby. Go learn that.
[23:20:31] dagen: RubyRonin hm
[23:21:03] dagen: pipecloud i know but what i need to read to understand how to fix this problem with params?
[23:21:43] pipecloud: dagen: A ruby book or tutorial. I don't remember what I'd suggest to someone right now.
[23:22:15] dagen: RubyRonin i thin u use 'col-md-6' wich placed in bootstrap 3, not 2 version.
[23:22:20] erichmenge: dagen: where is params defined? The controller right?
[23:22:37] erichmenge: and validates is in the model, right?
[23:22:46] erichmenge: Question answered.
[23:22:56] dagen: i need to send params from controller to model?
[23:23:18] erichmenge: dagen: Most people use new/create and update_attributes to do just that.
[23:23:37] s2013: no he has conditional validation
[23:23:51] s2013: so if htere is a parameter present something will need to be present, otherwise no
[23:23:56] dagen: erichmenge i just try to understand how i can do the check with walidates for separated views
[23:24:22] dagen: it's very hard to understand
[23:24:54] pipecloud: Not really. You should put rails down for a minute and stop trying to figure out this stuff because you think it's so magical.
[23:24:56] erichmenge: dagen: That's because you're starting at the wrong place. You need to learn some basics first.
[23:24:58] RubyRonin: dagen: thanks
[23:24:59] pipecloud: You should learn some basics.
[23:25:12] dagen: RubyRonin y are welcome
[23:25:36] s2013: dagen: ok look
[23:25:47] dagen: erichmenge and pipecloud i learn some basic but i cant understand this part( and i dont know what i need to read to understand
[23:25:47] s2013: create a virtual attribute, pass that to the model in your controller
[23:25:48] pipecloud: dagen: If you have something, a variable, a string, whatever, and you needed to pass it to another object so it can use it, what are your options?
[23:25:51] s2013: and then check that
[23:25:57] pipecloud: dagen: I'll find you a book.
[23:26:55] RubyRonin: dagen: upgraded to 4.0...still no go
[23:27:13] dagen: the english is not my native language and sometimes i hard to understan some phrases(
[23:27:30] dagen: RubyRonin very strange
[23:27:42] pipecloud: dagen: http://astonj.com/tech/best-way-to-learn-ruby-rails/
[23:27:49] RubyRonin: dagen: I upgraded to the latest version of bootstrap sass gem but my results are still the same
[23:27:55] pipecloud: dagen: Specifically: http://www.manning.com/black3/
[23:28:12] dagen: RubyRonin but currently is 3.0.3 not?
[23:28:37] dagen: RubyRonin try to cleanup web-server cache
[23:28:49] s2013: dagen: http://paste.ubuntu.com/6687739/ id think its something lik ethat
[23:29:19] s2013: osmeone correct me if im wrong (which i probably am)
[23:29:31] RubyRonin: sass-rails 4.0
[23:29:31] dagen: s2013 wait a moment
[23:29:44] RubyRonin: dagen: how do I go about that?
[23:29:48] pipecloud: s2013: #kind isn't a class method.
[23:29:58] pipecloud: Model.new(attributes_from_controller).kind
[23:30:10] dagen: RubyRonin bootstrap is independet from rails
[23:31:27] s2013: but the general idea is thats how youd do it.
[23:32:19] s2013: k im out.. good luck dagen
[23:32:34] dagen: s2013 thanks i'll try it
[23:32:45] dagen: RubyRonin what do you want to do?
[23:33:12] RubyRonin: attempting to place a few <p> tags in two columns aligned side by side
[23:33:41] RubyRonin: using the stacked-to-horizontal grid steup
[23:34:01] dagen: show me the code pls
[23:34:18] erichmenge: SHOW ME THE CODE!
[23:34:26] dagen: try to included <div class='row'>
[23:34:37] dagen: erichmenge ?
[23:35:09] erichmenge: dagen: Oh sorry, reminded me of https://www.youtube.com/watch?v=yzBB0xYImmM
[23:35:18] RubyRonin: dagen: whats the link to post the code?
[23:35:58] dagen: https://gist.github.com/
[23:36:09] dagen: try this or some another pastebin
[23:37:35] RubyRonin: https://gist.github.com/anonymous/8248891
[23:37:57] dagen: show me the money))))))))
[23:38:19] RubyRonin: what color do you prefer your fiat currency in?
[23:39:55] dagen: RubyRonin http://getbootstrap.com/components/ try to read on emore time, because i dont seee an error in your code and cant check they
[23:40:58] dagen: pipecloud what do you mean by this string? Model.new(attributes_from_controller).kind
[23:41:08] pipecloud: dagen: not for you
[23:41:25] dagen: this is not for my situation?
[23:41:45] pipecloud: I don't like repeating myself.
[23:41:50] pipecloud: No, I don't like repeating myself.
[23:42:00] shevy: pipecloud what do you not like?
[23:42:08] pipecloud: shevy: you. <3
[23:42:15] shevy: you already said that before :(
[23:43:02] RubyRonin: dagen: will do
[23:53:01] RubyRonin: i'm uing bootstrap-sass 3.0.3
[23:54:04] dagen: RubyRonin the code is correct i think, but maybe in your sass something going wrong?
[23:54:17] dagen: do you shure that you uses 3.0.3 on server?
[23:54:22] dagen: on your web srv
[23:54:28] RubyRonin: dagen: I realized i had the wrong version of boostrap
[23:54:34] RubyRonin: I change the version in my gem file and did a bundle install
[23:54:50] dagen: that's right
[23:54:50] RubyRonin: can't fathom what else is wrong, i restarted the server
[23:55:01] RubyRonin: maybe it is the cache, not clear on how to clear the servers cache
[23:55:07] dagen: try ro cleanup
[23:55:31] dagen: try this: rm log/* && touch log/development.log && rm -fr tmp/* && rm -fr public/assets
[23:55:38] RubyRonin: do u mean rails cleanup?
[23:55:45] dagen: from your working directoy of ruby project
[23:56:25] dagen: but i think the problem is not in cache
[23:56:57] RubyRonin: ok i'll try