« Back to channel list

#RubyOnRails - 15 September 2013

« Back 1 day Forward 1 day »
[00:09:32] tjr9898: bastilian: Looks like i'm moving on. Thanks for your time
[00:09:58] bastilian: tjr9898: you are welcome. if you need more help/pointers let me know.
[00:17:45] bastilian: tjr9898: not related, but might be an interesting read for you: http://pivotallabs.com/writing-rails-engine-rspec-controller-tests/
[00:21:44] tjr9898: bastilian: That's interesting
[00:22:34] hls_: hello guys, is there a good idea to re-create my php (drupal) personal page (blog and portfolio) to learn Ruby on Rails? I'm following Rubyonrails[dot]org tutorial. Thank you
[00:23:12] hls_: hello guys, is it a good idea to re-create my php (drupal) personal page (blog and portfolio) to learn Ruby on Rails? I'm following Rubyonrails[dot]org tutorial. Thank you
[00:25:21] Andrevan: hls_: rails would probably be fine for that, but you would have to reinvent a lot of wheels if you want to make it have feature parity with drupal
[00:25:39] Andrevan: I think even a lot of rails devotees will use a wordpress or a drupal for a personal blog
[00:26:10] Andrevan: refinery is a CMS for rails, I've never used it though
[00:26:37] tjr9898: hls_: It would be like recreating the site with Laravel
[00:27:58] hls_: Andrevan I don't want to do a Drupal style website. So you think it's a lot of work, or an unecessary work just for a portfolio?
[00:28:34] tjr9898: bastilian: I was using combustion as an internal rails app.
[00:28:37] Andrevan: hls_: it depends what "just a portfolio" means in this case
[00:28:57] hls_: tjr9898 I was trying laravel 4, but I can't find so much practical tutorials to get me on the game
[00:29:42] tjr9898: hls_: http://codehappy.daylerees.com/
[00:30:10] tjr9898: hls_: http://net.tutsplus.com/tutorials/php/laravel-4-mastery/
[00:30:35] tjr9898: sorry everyone for the diversion
[00:30:37] tjr9898: back to rails
[00:30:45] hls_: Andrevan ..It's just a "blog style" portfolio, with authentication, category, tags, images, etc
[00:31:21] Andrevan: hls_: I mean sure, it would be fine, devise is the auth gem I use which should get you going
[00:31:28] Andrevan: carrier_wave for images
[00:31:47] Andrevan: there are tons of implementions of categories and tags floating around, I dunno what's good
[00:31:54] Andrevan: acts_as_taggable is one I've used in the past
[00:32:08] foucist: act as taggable is pretty much the main one
[00:32:30] bastilian: hls_: take a look at BrowserCMS. it takes away all the cms-interface implementing and let's you focus on building models and controllers you need.
[00:32:37] foucist: Andrevan: wouldn't paperclip be a bit more straightforward than carrier_wave
[00:33:47] foucist: interesting, browsercms is new to me
[00:33:54] Andrevan: foucist: I prefer carrier_wave to paperclip
[00:34:28] Andrevan: it supports regular file saving, imagemagick, and s3 with fog more or less out of the box
[00:34:51] Andrevan: it's pretty straightforward, you just make an uploader class and do mount_uploader in a model
[00:35:06] bastilian: foucist: it is super nice. it takes a bit to get used to it's portlets feature, but once you get the hang it is pretty awesome.
[00:35:40] hls_: Ok, nice guys, thank you for the help. But I just have one more question. Where do I host it? Is the Heroku free 750Hh per month enough?
[00:35:41] foucist: bastilian: weird, it's been around since 2008 ?
[00:35:47] foucist: bastilian: i never heard of it before
[00:36:47] foucist: hls_: heroku free is fine
[00:37:07] foucist: only issue is slow load time (during first visit)
[00:37:18] foucist: you can get around that by pinging the site regularly or some such
[00:38:41] hls_: fascist hmm, thank you. I'll give it a try. I know everybody like it, but i have my doubt
[00:40:40] hls_: bastilian The BrowserCMS looks insteresting ;)
[00:59:39] taternuts: Anyone have any experience with a twitter oauth2 webapp? Finding it to be a real pain in the ass to get things set up to the point where I can use the generators for oauth->oauth-plugin (Gemfile: http://goo.gl/GNjzCz, what I was looking at: http://goo.gl/2PXwt7)
[01:06:17] bastilian: taternuts: you did install the gems with bundler? (just asking to make sure)
[01:09:01] taternuts: I just removed everything to start fresh, because I saw somethign that said to remove the gemfile.lock and remove rspec-core to update and that fubared everything
[01:12:10] bastilian: taternuts: gimme a sec. gethering info.
[01:12:19] taternuts: take your time - thanks for the help
[01:15:34] taternuts: generated a new project, http://i.imgur.com/49FxhQj.png is the gemfile, http://i.imgur.com/XlIjLOX.png is the result of the generator I'm trying
[01:21:47] taternuts: I've got 1.9.3 installed through railsinstaller
[01:21:55] bastilian: taternuts: it might be that the gem is not released yet with the fix. try replacing line 51 with:
[01:21:56] bastilian: gem 'oauth-plugin', :git => "https://github.com/mistaguy/oauth-plugin.git"
[01:22:57] taternuts: oh cool, so gems can point to the latest and greatest release via github
[01:23:24] bastilian: taternuts: see http://bundler.io/v1.3/git.html
[01:23:50] taternuts: so gem releases are major releases/branches and github is experimental
[01:23:50] bastilian: you can even reference branches/tags/shas
[01:24:20] bastilian: depends on the release stratagy of the gem-maintainer.
[01:24:52] bastilian: depending on a git repo can be dangerous though. (be warned) :)
[01:25:57] taternuts: victory (http://i.imgur.com/7LjDA7e.png) - thanks bastilian
[01:28:27] taternuts: I do love the hash shorthand of git: 'url'
[01:29:01] taternuts: but => lambda notation is home for me as a c# guy
[01:29:10] bastilian: yeah, it is ruby 1.9.3 syntax... my head has not switched completely yet...
[01:29:50] taternuts: yeah I just started learning ruby so I'm learning on the latest
[01:33:11] taternuts: really liking ruby though (I guess you always like the latest language you learn, c# => javascript => as3 => ruby), I did a daily programmer challenge recently (http://i.imgur.com/j47yeC3.png) and I really think its pretty the way it reads
[01:59:18] sam452: Dang. Anyone seen a Devise login on a Rails 3.2 app on Heroku fail?
[02:01:21] sam452: I followed the Railscast to generate a preview environment, and have set the Heroku config key to "preview". It runs in development, and appears to do so on Heroku.
[02:02:29] sam452: But my seed user, which is valid and in the Heroku db just does not actually log in on Heroku.
[02:03:40] sam452: By that I mean, the login does not cause a failure and redirects to the home page as expected. But there is no session created.
[02:04:41] sam452: My logs begin with "Started GET "/users/sign_up" and Started POST "/users/sign_up" but just a redirect to the home page.
[02:06:04] sam452: I've checked Google and repushed my commit to Heroku. And I've verified that my precompiled assets presented no error.
[02:07:04] sam452: Other posters seem to present an actual error. I get no notice of an error, just the redirect as if I have logged out.
[02:25:38] kurt21: how would I make this work:
[02:25:39] kurt21: def action1
[02:25:39] kurt21: render link_to "hello link. id=#{params[:id]}", great_action2_path
[02:26:03] kurt21: right now, I get: undefined method `link_to'
[02:26:18] kurt21: great_action2 is obviously another named route.
[02:40:56] fryguy: kurt21: create a view file and add it, link_to is a view helper that isn't available (by default) in controllers
[02:41:09] kurt21: fryguy: ty
[02:41:20] kurt21: I did get this to work: ActionController::Base.helpers.link_to
[03:06:41] Senjai: How can I selectively update a model only if a user made a change. E.g. no reason to execute SQL if no changes are made?
[03:07:21] pontiki: isn't that the standard behaviour?
[03:07:55] Senjai: I was just going to dup it and compare it against a stub, but I guess if it's standard there is no reason to.
[03:12:15] pontiki: well, run a little check in your console. i'm pretty sure if an entry is unchanged, nothing gets saved
[03:13:01] pontiki: that's what it's showing for me
[03:14:44] dasibre: can anyone help me with a this. I'm working on an app which works a bit like pinterest....its a football app, where a user can pin their favorite player to a board they created.......
[03:15:19] dasibre: i'm able to get a User to create a board, get a player and pin the player to the board in the console...
[03:15:49] dasibre: can't figure out how to do it from the views pages...
[03:16:21] Senjai: pontiki: I just wanted to add specific behavior
[03:17:10] Senjai: pontiki: implimented it like this: https://gist.github.com/Senjai/6567749
[03:17:13] Senjai: feel its kind of crude
[03:17:19] Senjai: but its better than checking attributes one by one
[03:17:34] dasibre: so a user on the players index page, clicks on PinPlayer button, the button should trigger a way for them to choose a board to which they can pin the player on
[03:39:03] pontiki: Senjai: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changed-3F
[03:40:09] Senjai: pontiki: I checked that out, but it doesnt help. I find the account via the params[:id] so it will always be clean. After calling update(accounts_params) it gets saved immediately.
[03:40:56] Senjai: So I need some way of comparing the params, or the changes they'll make before the update to the current model loaded from the db.
[03:41:03] Senjai: That was the only way I thought of doing it
[03:43:18] pontiki: you may want "unless" at line 2 in controller.rb
[03:43:43] pontiki: but still.. hmm...
[03:45:08] bastilian: Senjai & pontiki: have you looked at this: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changed
[03:47:43] pontiki: i showed that already
[03:48:13] pontiki: what if you just merged the incoming params, and then checked .changed?
[03:56:39] bastilian: Senjai: change the attributes not with update or any AR-methods use the setters and then you can check with .changed?
[03:57:21] pontiki: Senjai: maybe: https://gist.github.com/tamouse/6567890 ?
[03:57:22] Kaylors: I have an array of strings. I need to check if a string I have is in that array. I have information regarding the case of the strings in the array. I'm guessing in this situation using a include? wouldn't work? So what do I do?
[03:58:04] Kaylors: *I have no information
[03:59:24] pontiki: refactors to one line, no intermediate vars: https://gist.github.com/tamouse/6567890
[04:01:41] pontiki: Kaylors: try: %w{One woRd miGHt be All we NeEd}.any? {|x| x =~ %r{word|all}i}
[04:02:45] Kaylors: Thanks, I'll have a go..
[04:06:47] pontiki: array.map(&:downcase).include? "thing" should work too, i suppose
[04:07:02] akurilin: Could someone confirm that rails 3+ wraps migrations into a single transaction, so that if some DDL fails, the whole thing will get rolled back?
[04:07:28] pontiki: check your logs
[04:08:41] akurilin: pontiki, rails logs or db server logs?
[04:09:20] pontiki: rails logs
[04:10:49] akurilin: pontiki, I'm actually using standalone_migrations, so there are no logs.
[04:11:41] akurilin: It's rails 3 migrations without rails.
[04:11:52] pontiki: then i have no clue
[04:12:00] brownies: you've gone off the rails?
[04:12:06] pontiki: ^ well played
[04:12:21] akurilin: pontiki, so you don't happen to know off the top of your head what the default behavior is?
[04:12:28] brownies: and yeah, i'm pretty sure it wraps them in a transaction
[04:13:03] pontiki: not a clue
[04:13:04] s2013: anyone here works for/worked with pivotal labs or know anything about them?
[04:13:25] pontiki: or do you mean the behaviour of rails doing rails migrations?
[04:13:53] pontiki: i don't wish to even speculate
[04:13:58] s2013: pontiki: arent you american?
[04:15:32] akurilin: I'll investigate some more then, thanks!
[04:15:47] pontiki: why do you ask, s2013 ?
[04:16:02] s2013: cause i thought you were. but i might be wrong and i might be thinking of the wrong person
[04:16:13] s2013: because of the spelling of behavior
[04:16:32] pontiki: this is a strangeness
[04:16:46] pontiki: i cannot look at americanised spellings and think of them as correct
[04:16:51] pontiki: they feel quite wrong
[04:17:15] pontiki: and i grew up in the USA
[04:17:35] s2013: anyways sorry just a side thing. i might be thinking of thewrong person with a similar nick. anyways back to rails
[04:19:42] pontiki: perhaps my evile twin
[04:20:32] jrobeson: oh noes dark pontiki
[04:21:13] Senjai: pontiki: nice solution :)
[04:43:06] treehau55: til: turbolinks should be the last thing you require in a manifest
[04:57:38] davidcelis: except for jquery.turbolinks, treehau55
[04:57:41] davidcelis: that comes after turbolinks
[05:22:11] digitalcake: I have a model "site" where I'm using hstore to list key words {key => count} per site.
[05:22:30] digitalcake: how can I get a hash of the most keywords used.
[05:23:29] digitalcake: is there simple method like sum or something like that I could use
[05:25:49] macmartine: digitalcake: the hash has duplicate key values?
[05:27:17] macmartine: er, duplicate keys, i mean
[05:27:22] pontiki: do you mean most-used keywords?
[05:28:17] macmartine: google 'ruby sort hash by value'
[05:28:38] digitalcake: well I mean a composite of all
[05:28:57] macmartine: total of all values?
[05:29:00] pontiki: show what you're looking for as output
[05:30:07] macmartine: oh, you're seating a bunch of records that each have a hash? you'll have to merge them all, then sort
[05:30:27] macmartine: *seaching, not seating :)
[05:30:37] macmartine: geez, searching
[05:31:25] digitalcake: so if I have a total_count hash I could just keep dumping and merging in key values from each of the sites
[05:32:37] macmartine: i'd use a separate tables with string and int columns, but sure
[05:32:44] pontiki: nite railsanistas
[05:33:10] NDD: I have a bunch of checkboxes on a form_for with "Yes" and "No" options that submit "true" or "false" to the boolean value in my migration. I have used radio buttons instead of checkboxes to ensure the user has consciously made a choice. The app works fine in development, but fails in production because any answers that select "no" fail to pass "validates: x, presence => true". I assume submitting "false" is recorded as "nil". A
[05:34:00] NDD: Does anyone know why this only happens in production? Or how I can change the values submitted by my radio buttons so they are still compatible with a boolean data type but aren't stored as "nil"?
[05:36:10] NDD: nvm, found the answer http://stackoverflow.com/questions/4112858/radio-buttons-for-boolean-field-how-to-do-a-false
[05:37:13] macmartine: NDD: a false value is simply not submitted. look at the params after you submit
[05:39:03] digitalcake: Boom! merge(p){|k, old_v, new_v| old_v + new_v}
[05:40:20] macmartine: woohoo to google and stackoverflow! ;)
[06:47:49] s2013: a user can register for an event that someone else listed, the way to dea with it would be to create a model called Registration and have the event_id and the user_id right?
[06:47:55] s2013: or am i missing something?
[06:51:19] nomnomdeguerre: qq: I'd like to execute some sql which returns a numeric result. How can I do this without making it look like crap?
[07:05:03] tubbo: nomnomdeguerre: Model.where(your: query).count ??
[07:08:46] jammanbo: s2013: correct. it is called a join model.
[07:09:09] jammanbo: nomnomdeguerre: use arel?
[07:15:55] s2013: jammanbo: yeah i know that but thing is that the person who created the event is also an user
[07:16:21] s2013: so what i ended up doing was basically the event has many creator class name user and many subscriber class name user
[07:16:28] s2013: through registrations
[07:16:57] s2013: ill paste the code
[07:19:21] s2013: https://gist.github.com/ss2k/803ff4a6b284aa2a0603 jammanbo does this make sense?
[07:20:02] nomnomdeguerre: hm, that's not what I was hoping for
[07:30:02] jammanbo: s2013: Think it looks okay, except you are missing the has_many :regsitrations assoc in both User and Meal, and I wouldn't deviate from standard naming unless its actually necessary … dineins, chefs, diners, … these are needlessly confusing.
[07:30:31] s2013: well the thing is that there are 2 diff user types
[07:30:36] s2013: diners and chefs
[07:30:56] s2013: and also how can i say something belongs to user as well as has many users
[07:30:57] s2013: is that valid?
[07:31:34] jammanbo: nope. Meal belongs_to a User (@meal.user) and it has many Users through … (@meal.users)
[07:32:06] s2013: so i can p ut meal belongs_to user as well as meal has_many users through?
[07:32:09] s2013: thats legal?
[07:32:15] jammanbo: sorry, that's confusing. I mean yes it will be valid.
[07:32:40] s2013: ok but doesnt it make more sense to have something like meal has_many diners and meal belongs_to chef ?
[07:33:42] jammanbo: Its a matter of opinion, but it means I (as a maintainer of your code or whatever) have to go a look to find out that those are both User classes. It's just confusing I think.
[07:34:23] s2013: belongs_to :chef, class_name: 'User' but it says they are User but i guess i understand what you mean
[07:34:41] jammanbo: I don't subscribe to the view that code should read like prose. It is not prose. If it can read well, great, but more important is clarity.
[07:35:27] jammanbo: yes it says that in the user.rb file. But everywhere else @meal.chef tells me that there is a Chef class.
[07:35:53] jammanbo: and I have to go and work to investigate to discover the truth.
[07:36:05] jammanbo: its a question of taste though, you are right.
[07:37:02] s2013: quick q. if i do use an alternate name. should it be chef_id instead of user_id ?
[07:37:09] s2013: for the foreign key field
[07:37:33] s2013: cause when i type in @meal.chef it returns nil and @meal.user returns undefined method which makes sense
[07:38:57] s2013: hmm any clue why im getting nil?
[07:39:38] jammanbo: in the db it should still user_id (the custom naming should be a layer of sugar and not permeate all the way down through the stack!) and so the foreign key must be user_id.
[07:41:27] s2013: yeah but its getting nil. thts weird
[07:41:48] jammanbo: what does your line look like now?
[07:42:04] s2013: what do you mean
[07:42:05] s2013: which line?
[07:42:22] s2013: im in the console. i typed in m = Meal.first and then m.chef . it returns nil
[07:42:39] jammanbo: your belongs_to
[07:42:51] s2013: belongs_to :chef, class_name: 'User', dependent: :destroy
[07:42:58] s2013: thats for meal
[07:43:13] jammanbo: foreign_key :user_id
[07:43:24] jammanbo: foreign_key: :user_id
[07:44:41] s2013: belongs_to :chef, class_name: 'User', dependent: :destroy, foreign_key: :user_id ?
[07:45:17] s2013: ok that worked
[07:45:24] s2013: i wasnt sure if i had toe xplicitly declare the foreign key
[07:45:43] jammanbo: nice, lexical attribute sorting. man after my own heart.
[07:46:07] s2013: that should be all the foreign keys i need to declare on meal.rb right?
[07:46:45] jammanbo: you need to specify the foreign key whenever it cant be deduced from the name you have used for the association.
[08:00:56] s2013: jammanbo: i want to create a registration form where the meal_id and the user_id as well as num_seats is filled up. i tried <%= simple_form_for [@meal, @registration] do |f| %> ... but it gives me an error
[08:01:11] s2013: @meal = Meal.find params[:meal_id] @registration = Registration.new
[08:01:22] s2013: i get this error: undefined method `meal_registrations_path' for #<#<Class:0x5a00d50>:0x5a70440>
[08:01:36] s2013: should i do [@user, @meal, @registration] ?
[08:01:58] s2013: that seemed to have worked but not sure if thats the right way
[09:00:16] wartech0: Could anyone suggest to me the best book for learning rails?
[09:00:20] wartech0: not so much ruby
[09:01:59] liquid-silence: any suggestions on a decent keyboard for a mac?
[09:02:41] jammanbo: liquid-silence: ?? The standard wireless one obviously, no?
[09:03:09] jammanbo: really?? why not? I love this board.
[09:03:52] jammanbo: wartech0: Personally I don't think books are the way to go. Do the 15 minute blog and watch lots of Railscasts is my recommended approach.
[09:04:18] wartech0: I feel like the tutorials are great and stuff
[09:04:25] wartech0: but they only show me how to do specific things
[09:04:37] wartech0: I want a more indepth catch all knowledge to rails
[09:09:34] liquid-silence: wartech0 learn ruby first
[09:09:48] wartech0: I don't see the need
[09:09:51] wartech0: ruby is simple
[09:10:15] jammanbo: ACTION runs for cover
[09:10:16] wartech0: this isn't the first language I have done
[09:10:26] wartech0: going from C++ to ruby, I have had no problems at all
[09:10:44] jammanbo: who told you that?
[09:11:00] wartech0: no one, I have been programming in ruby for the past 3 days
[09:11:04] wartech0: nothing has confused me
[09:11:09] wartech0: the syntax is simple to understand
[09:12:55] jammanbo: It is, isn't it? But recognising syntax does not mean you have mastered the language. Lots of nuances. I'm not saying "get a ruby book", but perhaps be a bit more humility would serve you well.
[09:16:11] wartech0: jammanbo, I did do some ruby exercises on code academy
[09:16:27] wartech0: the thing is I haven't hit a bump where I didn't understand the ruby code
[09:17:19] DaniG2k: guys I'm having a problem with error display for nested attributes. I have a form with nested attributes and when I submit it with incorrect values, the validator kicks in but insteaf of the page re-rendering as its supposed to, I get an activerecord error instead
[09:18:34] DaniG2k: here's the code dealing with that part
[09:18:35] DaniG2k: https://gist.github.com/DaniG2k/6569119
[09:19:22] jammanbo: wartech0: Fair enough. I'm not trying to start a fight, but I was just making the point that _perhaps_ it's not that you've "had no problems at all" but instead that you're just not well versed enough yet to recongnise the problems you've had/created.
[09:19:49] jammanbo: wartech0: But anyway, as I understand it the two standard Rails books are AWDR and Rails 4 in Action.
[09:20:03] wartech0: the only problem I am really having is just understanding how I should use rails
[09:20:15] wartech0: like it emphasizes DRY
[09:20:28] wartech0: but I find myself repeating myself quite often
[09:20:50] wartech0: so what I wanted to do was get a grasp of rails so that what I don't need t repeat myself as often
[09:21:14] wartech0: http://i.imgur.com/VdFuXkU.png < here is what I have so far (its a working authentication system)
[09:21:21] wartech0: with the zurb-foundations front end
[09:21:28] wartech0: so its not like I am doing terrible
[09:22:09] jammanbo: Good idea. So as a compromise :) order one of those books and while you're waiting, watch lots of recent Railscasts. RyanB will show you how to write nice clean idiomatic Rails code.
[09:22:31] wartech0: jammanbo, a lot of those railscasts cost money though
[09:22:39] jammanbo: but a lot dont
[09:22:49] wartech0: idk I would rather spend money on a book then and subscription to videos
[09:22:58] wartech0: I can check them out though
[09:23:05] wartech0: thats where I got this authentication system
[09:23:18] jammanbo: Do. They are mostly free in fact.
[09:27:09] jrobeson: it's only $9 dollars wartech0
[09:27:17] jrobeson: cheaper than most books
[09:27:38] jrobeson: well you an watch a lot in one month
[09:27:44] jrobeson: enough to make it worth $9
[09:27:58] jrobeson: atm all subsriptions last two months though
[09:28:03] jrobeson: because he's taking a break
[09:28:35] jrobeson: so you'd have two months worth of casts to check out
[09:28:37] wartech0: 9USD a month is a lot for me though
[09:29:22] jammanbo: really, you dont need a subscription. There's plenty there to be watching before you need to start thinking about paid content.
[09:29:53] pallavi: How do I combine these 2 ---> projects.find(params[:id]) and projects.find(params[:name])
[09:31:14] jammanbo: pallavi: Project.where(id: [params[:id], params[:name]])
[09:31:19] jammanbo: for example
[09:55:32] pallavi: jammanbo: Ty
[09:58:49] geeky-sh: I am new to writing test cases. I am writing a test case for a gem that I want to contribute in. My question is how do I open something similar to rails console for that gem. I want look at the test objects that are being created
[09:59:10] geeky-sh: Is there a way to open a console for a gem?
[10:01:10] workmad3: geeky-sh: just run 'irb' and require the necessary gem files
[10:01:18] jammanbo: open console and require the gem
[10:04:41] geeky-sh: In the gem root directory, I opened irb and did require 'gem_name', but its throwing me an error. "cannot load such file gem_name"?..Am I doing something wrong?
[10:44:00] KevinSjoberg: Hi, everyone.
[11:02:51] b3hnam: Is any open source project like Joomla or Drupal in rails ? I find some CMS like locomotivecms but they are just simple CMS.
[11:10:21] kamiyuki: any1 have any idea why this doesn't work in rails 4? https://gist.github.com/anonymous/6569771
[11:11:26] kamiyuki: accessing any subdomain (e.g. a.mise.dev | b.mise.dev) just doesn't go to the 'stores#index'
[11:15:48] kamiyuki: any1 have any idea why this doesn't work in rails 4? https://gist.github.com/anonymous/6569771
[11:15:53] kamiyuki: accessing any subdomain (e.g. a.mise.dev | b.mise.dev) just doesn't go to the 'stores#index'
[11:16:00] kamiyuki: instead it redirects me to 'home#index'
[11:18:40] Xeago: kamiyuki: I think you have your routes in the wrong order
[11:19:06] kamiyuki: Xeago: can you enlighten me on that one?
[11:19:15] kamiyuki: am i supposed to put constraints above root ?
[11:19:26] Xeago: not really, am a noob myself, the routing guide might be able to help
[11:19:31] Xeago: but yes, thats what I meant
[11:19:58] kamiyuki: Xeago: it's still giving me the same error
[11:20:13] geoffw8_: Hey all. If I click an AJAX link in my app, it reloads the current page (using AJAX, I get the XHR successful in chrome). Anyone have any ideas why this might be?
[11:20:49] geoffw8_: it also does what its supposed to
[11:38:53] Trudko: Guys i have problem running migration where i add two columns and delete one: http://pastie.org/8325752 I checked database and those fields are in table.
[11:39:49] jammanbo: geoffw8_: You're probably not preventing the default action. Return false or call event.preventDefault() as the last line of your JS.
[11:40:05] jammanbo: Trudko: Still?!?
[11:40:22] Trudko: jammanbo: yeah i didnt manage to fix it yesterday
[11:40:44] Trudko: jammanbo: i wrote you but i couldnt check answer if you did answer later
[11:41:09] jammanbo: Trudko: Are you migrating up or down?
[11:41:37] jammanbo: no, down, right?
[11:41:51] Trudko: yeah let me retest just tobe sure
[11:42:10] jammanbo: Does your posts table currently have a statut column?
[11:42:22] DaniG2k: i'm having a problem with my nested attribute form. I have a validation that's kicking in, but I'd like it to re-render the edit method instead of giving me an activerecord error message
[11:42:27] DaniG2k: code: https://gist.github.com/DaniG2k/6569119
[11:42:50] DaniG2k: I have a feeling the problem may be the fact that in the form's nested attribute part I have <%= f.fields_for :educational_experiences do |builder| %>
[11:42:58] DaniG2k: and i might need to reference the @tutor form there?
[11:43:06] DaniG2k: i mean, the @tutor object
[11:44:12] jammanbo: DaniG2k: The error details would be useful no?
[11:44:26] Trudko: jammanbo: yeah my players table does have statut and contanct. I run ActiveRecord::Base.connection.execute("SELECT statut, contact FROM players") to check it
[11:45:16] jammanbo: Trudko: delete schema.rb and run migrate again
[11:45:26] DaniG2k: jammanbo: I have a validator as you can see for the nested attribute which says limit: 5
[11:45:37] DaniG2k: jammanbo: so the error is not really an error, just the validator which is kicking in
[11:45:40] DaniG2k: it says ActiveRecord::NestedAttributes::TooManyRecords in TutorsController#update
[11:45:51] DaniG2k: but i'd like the edit form to be re-rendered
[11:45:58] DaniG2k: instead of getting this activerecord message
[11:46:17] DaniG2k: from my controller I'm calling if @tutor.update_attributes(tutor_params)
[11:46:24] DaniG2k: so that should update the nested attributes as well
[11:46:54] DaniG2k: or not if i pass in more than 5 entries
[11:47:02] DaniG2k: and if not it should just render 'edit'
[11:47:07] DaniG2k: which its not doing
[11:47:25] DaniG2k: it's basically getting stuck at if @tutor.update_attributes(tutor_params)
[11:47:31] Trudko: jammanbo: i did but only last migration run
[11:48:09] jammanbo: DaniG2k: I'm not sure that that limit is correct. I think it just limits the number of assocs that can be created in one go. Are you not trying to make an actual limit (irrespective of whether they were created all at once or over multiple edits)?
[11:48:18] jammanbo: Trudko: Okay, no try rolling back?
[11:48:39] Trudko: jammanbo: same error. i can just recreate whole database
[11:48:57] DaniG2k: jammanbo: yes limit it to 5 overall. but the funny thing is it's saying Maximum 5 records are allowed. Got 7 records instead.
[11:49:05] DaniG2k: which is fine because i passed in 7 records
[11:49:19] DaniG2k: i just dont want it to render this error message, i want it to re-render edit
[11:51:21] justforfun: ACTION Hello Folks
[11:51:24] jammanbo: DaniG2k: You need a validation I think. Remove that limit and replace it with a validation, then you'll get the controller/view behaviour you expect. Think you'll have to write a custom one. Google it. Don't forget to take into account the records which have been marked_for_destruction. Again, google it.
[11:51:40] justforfun: Can I talk to a buddy that can advice me about Ruby jobs?
[11:52:17] jammanbo: Trudko: Must be something more serious wrong. Are you certain that you are looking at the right migration file for a start? There's no chance you've accidentally duplicated the file or somthing?
[11:55:50] Trudko: jammanbo: yes
[11:57:06] jammanbo: DaniG2k: yeah, the limit option raises an exception rather than behaving like a validation. A hack would be to rescue the exception in the controller and manually handle it (add appropriate errors and re-rerender) but anyone who did anything to awful would deserve to be beaten. Remove and add a validation in the parent model.
[11:57:53] jammanbo: Trudko: At that code you posted is definitely the file? No chance its an old copy?
[11:58:32] Trudko: jammanbo: yes it is def. that file
[11:59:05] jammanbo: there's hardly anyone active atm justforfun, but just ask your question and someone might answer.
[12:00:10] jammanbo: Trudko: connect to the db via the command line
[12:00:23] justforfun: jammanbo: I want to know about Ruby or ROR job position? Anybody here that hire any Ruby developer and can advice me
[12:00:23] jammanbo: sqlite3 yourdb
[12:01:08] jammanbo: justforfun: advise you about what specifically?
[12:01:22] justforfun: Yes, I want to know what is needed
[12:01:24] jammanbo: Trudko: .schema players
[12:01:28] jammanbo: and pastie the output
[12:02:42] Trudko: jammanbo: i should run .schema players?
[12:03:29] justforfun: jammanbo: Can I send PM to you?
[12:03:53] jammanbo: justforfun: not saying I can help but if you like
[12:04:12] Trudko: jammanbo: http://oi39.tinypic.com/2ufapow.jpg
[12:04:44] Trudko: jammanbo: contanct has bad type!
[12:05:01] jammanbo: Trudko: lol … kick yourself (ourselves) time ...
[12:05:22] Trudko: sorry about that i acutally know how that happened
[12:05:22] jammanbo: Trudko: I'm reading that apparently sqlite3 doesnt have the ability to drop columns!
[12:05:43] jammanbo: I dunno though, I dont use it.
[12:05:54] jammanbo: Hard to believe but that's what I'm reading.
[12:07:25] Trudko: jammanbo: ok i fixed type manually and i was able to recreate it
[12:08:17] Trudko: but i am bit supprised by error output of rails. I would expect that there is some sql error which rails would provide to user.
[12:11:41] jammanbo: Trudko: Well, to be fair its not Rails, its the sqlite adapter, but yeah, some better error would seem appropriate if sqlite does in fact not support remove_column.
[12:12:15] Trudko: jammanbo: what do you mean? I was able to run migration and remove those columns after i fixed the type
[12:13:13] jammanbo: Trudko: what do you mean fixed the type?
[12:19:56] coderhs: how do we write the documentation so that it gets filled when we run rake doc:app
[13:30:10] kris: when i upload images i am getting Started GET "/jquery-file-upload/jquery.fileupload.js" for at 2013-09-15 18:59:25 +0530 ActionController::RoutingError (No route matches [GET] "/jquery-file-upload/jquery.fileupload.js"): error
[13:30:17] kris: in rails 4
[13:31:04] tbuehlmann: kris, looks like you don't have such a route
[13:34:15] DaniG2k: guys im trying to get a fadein effect on this code but cant seem to get it right
[13:34:18] DaniG2k: https://gist.github.com/DaniG2k/6570731
[13:34:25] DaniG2k: any ideas?
[13:34:36] iron_houzi: OK. I've looked through the guides. Did the firt tutorial and understood how powerful and easy RoR is for creating html and websites, but can someone please share a link that will blow my mind away and get a true impression of what amazing things people have done with RoR?
[13:35:50] bastilian: kris: do you get the error when going to the page where you have an upload form or when submitting the form?
[13:36:40] kris: <bastilian> yes, in rails 3 its working but in 4 shows error
[13:36:57] DaniG2k: iron_houzi: github is written with rails
[13:37:08] tbuehlmann: DaniG2k, that's rather a question for an js channel
[13:37:11] bastilian: kris: yes on the page with the form or on submitting?
[13:37:20] DaniG2k: tbuehlmann: yea ive asked there too but nobody's answering
[13:37:37] kris: on submitting
[13:38:07] kris: <bastilian> on submitting at terminal
[13:38:15] bastilian: kris: hm... is the form submitting with a POST or GET request?
[13:38:27] kris: <bastilian> get
[13:38:41] bastilian: uploads only go for POST.
[13:38:49] bastilian: and multipart
[13:39:22] zeh235: hi there. can somebody help me to build an hash out of an integer? i have '3', what i want to have is [ "chain 1" => "1", "chain 2" => "2", "chain 3" => "3"] how could i do this ?
[13:39:49] iron_houzi: Another question: I've been looking at node.js and js in general. I found meteor.js, who has a great demo video which displays its powers. Will RoR be a complete replacement for js, or is RoR more like a supllement to js?
[13:39:56] bastilian: iron_houzi: there are a lot of big sites build with rails. twitters frontend, all 37signals products (of course) Shopify... what are you looking for?
[13:41:33] bastilian: iron_houzi: "Ruby" on Rails is a framework to build apps in Ruby. meteor.js is a framework to build apps in js and has node.js underneath, but i think it does not expose node.js to the "end"-developer
[13:41:38] iron_houzi: bastilian: A video that will showcase the benefits of choosing RoR for someone who is trying to understand what webdev route to choose: js (node, meteor, angular), python, RoR, ..PHP :) ..but yeah, there are a myriad of choices, so why choose RoR?
[13:41:42] kris: <bastilian> my routes is concern :commentable do resources :photos, :except => [:update, :edit] end resources :bugs, concerns: :commentable how to change to post
[13:42:32] iron_houzi: meteor.js has a great demo video that explains its powers. Something like this for RoR would be great..
[13:42:47] bastilian: kris: take a look at this: http://guides.rubyonrails.org/routing.html
[13:47:21] bastilian: iron_houzi: if i would have to sell Rails to you, i would say: 1) it is based on Ruby, a super nice readable language. 2)it has a TDD-philosophy by design. 3) Package-mgmt 4) eco-system around it has grown in size and quality.
[13:47:47] thatmanjose: hey everyone: just wanted to tell everyone thanks for all of the work that's gone into the training and development of this community. Finally got Rails set up and am blowing through the Hartl tutorial now. Wouldn't have been able to do it without all of the resources out there. Thanks!
[13:57:28] awalkerca: Hi, I'm looking for help on Nested Model Forms. I have Model A that has_many Model B's through Model AB. I'd like to find_or_create Model B, based on whether it exists for current_user.
[13:58:06] awalkerca: all the examples I see suggest the find_or_create is performed on the Model as part of the attributes, but the Model doesn't (and shouldn't, i'd imagine), know about current_user
[14:09:39] scyllinice: awalkerca: You could manually extract the nested attributes and find_or_create with those yourself.
[14:13:06] awalkerca: scyllinice: in the controller, yes? yeah, I guess I could do it that way
[14:15:13] awalkerca: I was hoping to take advantage of accepts_attributes_for and do some kind of sneaky black magic
[14:15:23] awalkerca: but creating something from the attributes manually isn't so painful
[14:27:35] geoffw8_: Hi Everyone. I'm using Turbolinks, and for whatever reason my click events "build up". What I mean by that is if I visit 1 page and click one of my links, its fires once. If I visit an additional page and click a link with .on click, it will fire 3 times. Then +2 times for every additional page
[14:27:44] geoffw8_: for example, if I click a link now, it will fire the event 9 times
[14:27:50] geoffw8_: its like the events are collecting
[14:27:56] geoffw8_: anyone have any idea what this could possibly be?
[14:47:13] git_: سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ
[15:29:42] sebastianb: git_: doesn't work
[15:55:40] Gaelan: If I create a HABTM relation, can I easily convert it to a `has_many :through` relation later if I need it?
[16:00:25] geoffw8_: Hello everyone. Does anyone know how to reset javascript variables with turbolinks?
[16:08:13] Stalkr^: Hey all. If I want to make some simple web apps, should I learn Ruby prior to Rails?
[16:08:34] geoffw8_: Stalkr^: nope
[16:08:39] geoffw8_: it will help, most certainly
[16:08:42] geoffw8_: but you dont *have* to
[16:08:57] geoffw8_: in the early days ruby is 5% of the battle
[16:09:48] Stalkr^: So it's the same syntax, but two different kind of structure or how can you compare them?
[16:10:18] geoffw8_: Stalkr^: first you should learn actually what the two things are. It is the same syntax, because Rails is written in Ruby
[16:10:30] geoffw8_: its not that its different structure
[16:10:32] bastilian: Stalkr^: Rails is written in Ruby. it is most certainly helpful to learn Ruby basics.
[16:10:58] Stalkr^: Okay, I was just curious what direction I should go when learning, I will pick up some Ruby first
[16:11:02] geoffw8_: Stalkr^: imagine buying an old Ford Focus (thats Ruby), and then you order off the internet a "boost up" that includes all sorts of gizmo's - thats rails
[16:11:10] geoffw8_: your'e still in the fiesta
[16:11:21] bastilian: Stalkr^: at RailsGirls workshops we let them go through TryRuby first -> http://tryruby.org/levels/1/challenges/0
[16:11:45] platzhirsch1: This is new to me, when you issue a POST request to /your_resources then normally it makes an automatic redirection so a template for /your_resources/create gets rendered?
[16:11:57] Stalkr^: bastilian: I was actually going through that earlier today
[16:12:05] Stalkr^: Hash, array, reverse and what not
[16:13:03] Stalkr^: I also read that RoR is great for small start ups, is it true it's easier than Django for small projects?
[16:13:08] Stalkr^: That's why I am interested in RoR
[16:13:44] bastilian: Stalkr^: it depends on the developer.
[16:13:58] DaniG2k: guys if I have a limit: 5 on a nested attribute, this raises a TooManyRecords exception. I'd like for the form to be re-rendred instead of that error being raised
[16:13:58] geoffw8_: platzhirsch1: not technically. When you issue a post to /something then rails routing knows to send that to the #create action (assuming everything is set up correctly). That action renders either back to the form if something went wrong, or redirects to a show view
[16:14:02] DaniG2k: but my code doesn't seem to work
[16:14:26] geoffw8_: so I guess from a distance, you are correct
[16:14:35] geoffw8_: DaniG2k: you need to rescue?
[16:14:43] platzhirsch1: geoffw8_: ah ok, I just noticed that before I made an explicit call to render, for instance render :text => ...
[16:14:48] DaniG2k: Ill post the code now hold on
[16:14:50] geoffw8_: rescue TooManyRecords
[16:14:50] geoffw8_: # your code
[16:15:38] DaniG2k: here it is
[16:15:39] DaniG2k: https://gist.github.com/DaniG2k/6572103
[16:15:48] jammanbo: DaniG2k: I explained earlier. limit will always raise an execption if it is exceeded. a) this is not the behaviour you want b) this does NOT stop you ending up with more than 5 associated objects. You need a custom validation!
[16:15:49] DaniG2k: yeah i should probably rescue but....I feel there's a better way to do this
[16:16:07] DaniG2k: ...your probably right
[16:16:14] DaniG2k: then what's the limit for though? i dont understand
[16:16:42] geoffw8_: DaniG2k: jammanbo is right, you can have a custom validation that adds an error to base.errors, I think
[16:16:48] jammanbo: it restricts the number of nested objects that can be created through any given request,
[16:16:59] jammanbo: look it up in the source code
[16:18:00] jammanbo: https://github.com/rails/rails/blob/ae8f2c6ed79af1774f74f84f70a4cee249ce769f/activerecord/lib/active_record/nested_attributes.rb#L491
[16:18:42] DaniG2k: hmm but I actually think that's fine
[16:18:56] DaniG2k: perhaps vustom validator is better
[16:19:21] jammanbo: It is not! Look at it. It raises an exception. It does not add errors. You want to display errors. That is what validations are for.
[17:05:10] creature: I've got a problem with my routing. I expect this is partially because I don't fully grok the routing engine. In my app, I have two relevant models: a Location, which is a bit like a City (ie. a big geographical area) and a Place (which is a business - a cafe, pub, restaurant, etc.)
[17:05:35] creature: So, here are the routes that I'm expecting to use for these, and the error I get when I go to /london. http://pastebin.com/sHzUK4nL
[17:06:14] creature: I can't help but notice that the thing that *I* think should be a Location is actually coming through as a Place.
[17:14:41] git_: سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ
[17:26:23] pontiki: really hate people who try to blow up other's irc clients
[17:42:10] Syrit: My bootstrap modal is submitting to the current form, i don't want this, i want to submit other form/controller, how do i do that ?
[17:44:12] rightisleft: I'm a programmer coming from an ActionScript3 / Java background - i'm looking for a book to learn ruby THEN rails - any recomendations?
[17:44:43] foucist: david black's book on ruby
[17:45:27] foucist: the well grounded rubyist
[17:45:59] rightisleft: that looks exactly like what im looking for
[17:46:55] foucist: for a rails book, well, maybe http://pragprog.com/book/rails4/agile-web-development-with-rails-4
[17:47:17] foucist: or the rails3.2 version
[17:47:30] foucist: there's also rails 3 in action, rails 4 in action
[17:49:48] creature: (Going back to my routing issue: my route was matching OK, but I had a thing that was generating a route to a Place, and because I wasn't supplying a :location it didn't know how.)
[17:50:19] rightisleft: thanks foucist
[18:01:17] Syrit: is it possible to specify a url or a controller which is out of the current context , to force bootstrap model to submit to ?
[18:02:41] bricker`LA: Syrit: yes, you can specify a URL option in a form_for or form_tag helper.
[18:03:13] Syrit: thank you, that's what i was looking for bricker`LA , i will do some search
[18:03:25] spiderface: i have an important question
[18:03:40] spiderface: What is worst on a first date at the romantic restaurant: Refuses to put dick away, or "smell it from here" vagina?
[18:05:35] Syrit: lol, this is out of context :D
[18:06:01] spiderface: sorry its important
[18:10:59] jxriddle: /whois spiderface
[18:39:14] henn1nk: using ariel for quering… Model.where(user: [1,2,3,4]) generates a IN sql statement… can i change this, that not only one user_id has to match?
[18:39:45] henn1nk: (has_and_belongs_to_many relationship)
[18:40:46] foucist: henn1nk: like an includes?
[18:41:10] henn1nk: foucist: i am searching objects, that have ALL the given ids related
[18:49:12] henn1nk: https://gist.github.com/henn1nk/6573365#file-admin-rb-L15 is just want to receive users, that have ALL the given basic_articles associated :(
[18:53:03] Cache_Money: is there a helper method that will prefix a float with a "+" or "-" symbol based on whether it's positive or negative?
[18:55:54] Syrit: guys here is a gist, it explains all, i am submitting a modal, and coudln't get it to submit to the controller i want, instead, it submits the current form ! : https://gist.github.com/anonymous/687b74fa08833e8f4415
[18:59:09] foucist: Syrit: seems like your clients controller is redirecting the create to /meetings afterwards or something
[18:59:33] Syrit: how can i prevent this ?
[19:02:07] scyllinice: Cache_Money: There isn't one provided, but it would be trivial to write
[19:02:31] Cache_Money: scyllinice: true. thought I'd ask
[19:10:00] henn1nk: does ariel not provide a way to select only objects, that have all the given ids associated? (habtm) :/
[19:14:46] foucist: Syrit: if the form itself only has @clients (or action='/clients') then there's no way it's posting to /meeting .. unless something is getting changed, or the new method in clients controller happens to have a redirect
[19:15:54] gwillen: henn1nk: A.joins(:bs).where(:bs => { :id => given_ids_list })
[19:16:44] henn1nk: gwillen: sure?
[19:17:21] gwillen: henn1nk: probably? Why, did you try that and it didn't work?
[19:17:34] henn1nk: gwillen: i test it
[19:17:49] Syrit: i will double check foucist , thanks
[19:47:54] yaymukund: what do I need to do to html encode characters when using to_json (using Active Model Serializers if that makes a difference)
[20:06:02] Gaelan: Can I easily convert a HABTM to a has_many :through easily?
[20:06:23] Gaelan: Oops, double easily.
[20:12:44] bricker`LA: Gaelan: yes - HABTM is a has_many :through
[20:12:50] bricker`LA: HABTM just hides the :through part from you
[20:13:31] bricker`LA: Gaelan: great a model for the join table, change has_and_belongs_to_many :things to has_many :things, through: :join_model_name, and that's it
[20:14:41] Gaelan: bricker`LA: Cool! Guess I'll use HABTM for now until I see a need for :through, then I'll switch.
[20:27:36] dsample: I've set default_url_options to help me with a scope+nested resources, but now all links have the parameter on the querystring. Is there a way to remove the default_url_options parameter for links outside the scope?
[20:34:37] Maoko: Guys, would you please check my gist and tell me "what am I doing wrong?) I'm completely stuck with jquery file uploader plugin implementation. Tried going on my own with no luck and later decided following Ryan Bates's tutorial. The problem is that this plugin doesn't give any response. Here is the gist https://gist.github.com/maokomioko/61e79567472c96e7892a
[20:35:46] scyllinice: Maoko: So what does it do?
[20:36:40] Maoko: scyllinice, it should ajax post the array of submitted files. But the form acts like the script isn't attached.
[20:39:41] scyllinice: Maoko: Do you see any javascript errors in the browser console?
[20:40:25] Maoko: scyllinice, nope. And rails logs don't show anything useful.
[20:42:27] scyllinice: I've got nothing then. Nothing jumps out at me
[20:44:04] elaptics: Maoko: is your javascript definitely working? Try adding some console.log calls in and check that you see them in the javascript console
[20:48:53] greengriminal: What do people make of jRuby?
[20:49:13] jrobeson: people use it
[20:49:22] jrobeson: lots of people
[20:49:31] scyllinice: It's worth the time
[20:49:46] greengriminal: jrobeson: I was asking for opinions if anyone here is using. jRuby channel is like a graveyard.
[20:49:54] jrobeson: i know people who are using it
[20:50:14] jrobeson: i mean like people i've met in real life
[20:50:47] jrobeson: i'm not yet but i'll probably give it a shot when needed
[20:51:45] scyllinice: Go build a game with it. Must easier than MRI due to the wealth of Java graphics libraries
[20:51:49] greengriminal: Yeah, I have a project coming up that I will be working on which will be using Juby 1.74 + Ruby 1.9.3 and Rails 4.0
[20:52:33] greengriminal: I won't be building a game. Going to be getting into some nitty gritty stuff using ActionController::Live for which I've never used before should be fun
[20:53:17] jrobeson: i just played with actioncontroller::live and puma
[20:53:34] greengriminal: Exactly that how is it?
[20:53:38] jrobeson: it works as advertised
[20:53:48] bratsche: What did you build with it?
[20:53:53] greengriminal: Watched the railsconf video with brian cardella giving his presenation.
[20:53:58] jrobeson: pressure sensor presses
[20:54:08] jrobeson: updating a score card thing
[20:54:11] jrobeson: live score*
[20:54:27] jrobeson: i'm nt sure how it's going to work in production yet
[20:54:46] jrobeson: i might end up having to use Rack::Hijack and esaping rails.. we'll see
[20:55:09] greengriminal: Bcardella mentioned that also in his presentation also
[20:55:31] greengriminal: That allows you to hijack the tcp socket correct?
[20:55:44] jrobeson: it's not that low level
[20:56:07] jrobeson: it's still http at that point
[20:56:16] greengriminal: Because effectively you are capturing the events on the client, sending it to the server and then the datas normalised. Event data is then brodcasted.
[20:56:37] jrobeson: it's already been put in rack request vars and such
[20:57:00] jrobeson: if you really need speed you might move up in the stack and handle it with nginx
[20:57:28] jrobeson: or similiar anyways..
[20:58:13] greengriminal: jrobeson: Understood.
[20:59:02] jrobeson: i'm still devving on it myself.. i ended up easily locking it up until i really did enable eager_load and cache_classes
[20:59:08] jrobeson: so i setup guard-puma to help
[21:08:37] bakis: hey does anyone know how to keep sessions through heroku? after x amount of time, even without physically closing the browser, the session drops. is there a better way to maintain the session longer?
[21:09:13] Radar: bakis: sure it's not just your app?
[21:09:19] Radar: I don't think sessions are a Heroku-specific thing.
[21:09:51] bakis: i know they're not, i don't think i'm doing anything wrong but i'm not sure.
[21:10:02] Radar: hard to know without seeing any code at all
[21:10:14] bakis: that's why i was asking the proper way. i just use session[:user_id] = @user.id
[21:10:40] jrobeson: Radar, is it too possible to use Spree::Config outside of spree?
[21:11:03] jrobeson: i haven't found a modern maintained gem similiar to that
[21:12:54] Radar: jrobeson: You mean build your own Config object like what we have?
[21:14:01] bakis: Radar: https://gist.github.com/anonymous/6574364
[21:14:28] Radar: bakis: that's not enough codew
[21:14:49] Radar: that is only setting the session. Maybe there's some code to check the session and expire it after a period of inactivity
[21:15:26] bakis: well i certainly wouldn't have written that.. i'll look around
[21:15:30] jrobeson: well the preference stuff seems nice
[21:18:19] bakis: like how long are sessions typically supposed to last?
[21:18:34] elaptics: bakis: what sort of store are you using for the sessions?
[21:18:43] foucist: bakis: 30 days? ;)
[21:18:45] bakis: active record
[21:18:58] bakis: foucist: mine last like 30 minutes
[21:19:24] foucist: that works too :P
[21:19:35] elaptics: bakis: gist your session config
[21:21:31] bakis: Nottwitter::Application.config.session_store :active_record_store
[21:21:33] bakis: thats all
[21:24:15] elaptics: bakis: did you write the whole app yourself?
[21:24:30] bakis: my session locally lasts a while, even with browser closing and such, but on heroku its like 30-60 minutes
[21:24:37] bakis: elaptics: yeah, why?
[21:24:54] elaptics: bakis: so you'd know if you'd wrote some sweeper code that cleared out old sessions
[21:25:35] bakis: yeah. that's why i said that.
[21:56:19] dsample: Is there a way to ignore default_url_options (or just url_options) for links that go outside of a scope?
[21:59:44] elaptics: dsample: don't think so, what's the problem?
[22:02:03] dsample: elaptics, I've got a scope for my multi-tenant app, and resources nested inside it. Using default_url_options was the easiest way to stop all of the views and redirect_to statements complaining
[22:02:45] dsample: elaptics, but now every link that goes outside of the scope has the querystring "?tenant=foo" because of the url_options
[22:04:05] dsample: elaptics, There are very few links which go outside of the tenant, so I'm ok doing something special for those specific links, but I can't work out a way to tell link_to to ignore the default_url_options
[22:05:11] elaptics: dsample: if there's very few, how about not using link_to, or just directly create the url
[22:05:29] elaptics: dsample: e.g. link_to "Foo", "/foobar"
[22:06:25] dsample: elaptics, I'd like to still get the link url/path dynamically if possible, but the querystring is embedded in the ..._path objects.
[22:10:08] elaptics: dsample: as far as I know you can't pick and choose if you've set default_url_options, maybe Radar might know otherwise - he's written a book about multi tenancy with rails
[22:11:07] scyllinice: All the times I've seen multitenacy done, it's been keyed to subdomains
[22:12:23] dsample: scyllinice, I know, that's the main issue I've had... I'd like to do it as a directory. I've managed it, it's just these few links that are annoying me
[22:12:27] elaptics: yeah, I haven't had to do a multi tenancy app myself but I'd choose subdomains if I needed to
[22:12:51] elaptics: dsample: how many is just a few?
[22:13:21] scyllinice: if you do :only_path => true, does it help at all?
[22:13:23] dsample: ActsAsTenant has been really easy to use
[22:16:14] dsample: scyllinice, no, at least not as an argument for link_to. Is it supposed to be an argument to the _path method?
[22:17:23] scyllinice: dsample: Well, it would be the _url helpers
[22:17:50] scyllinice: eg job_url(Job.first, only_path: true)
[22:18:02] scyllinice: I don't know if it will strip the query param
[22:18:06] scyllinice: But it's worth a shot
[22:18:58] ryanf: dsample: you can use url_for to control the link generation
[22:19:11] ryanf: link_to url_for(...)
[22:19:44] soosc: What would cause a 'superclass mismatch for class ClassName (TypeError)' to be raised when rails server is started in one environment, but not another?
[22:19:59] ryanf: dsample: now that I think about it, that probably doesn't help
[22:20:15] scyllinice: soosc: Class caching
[22:20:19] ryanf: soosc: in production, it eager-loads all of the models at startup instead of waiting for them to be referenced
[22:26:25] soosc: Ah, thank you. I had a duplicate class in a concern file.
[22:29:15] Radar: dsample: good mornibng
[22:30:23] Radar: dsample: Want to talk about multitenancy stuff still?
[22:31:15] dsample: Radar, of course, if you've got any additional advice :)
[22:33:48] dsample: scyllinice, I just tried only_path:true in both ..._path call, but it didn't help
[22:34:05] Radar: dsample: How are you doing the multitenancy stuff at the moment?
[22:35:02] dsample: Radar, using acts_as_tenant
[22:35:40] dsample: Radar, I've created an TenantController that inherits ApplicationController, and that deals with the set_tenant before_filter, etc.
[22:35:40] Radar: So what's this about default_url_options? Is it including the subdomain in those settings?
[22:36:02] Radar: I really prefer the apartment gem because it doesn't do routes hackery like what it appears acts_as_tenant does
[22:36:05] Radar: no before_filter nonsense either
[22:36:44] dsample: Radar, the TenantController also defines default_url_options for the routes to know what to put as the scope object
[22:37:00] Radar: dsample: yeaaah, that's extreeeemly hacky imo
[22:37:17] Radar: apartment gem works as a rack middleware, so all the filtering happens before it even hits the controllers
[22:38:38] dsample: Radar, Will it work using directories rather than subdomains?
[22:39:24] dsample: and within a single DB (no schemas)?
[22:39:44] Radar: If you use MySQL, yes it will work within a single DB.
[22:40:11] Radar: I don't know about it using directories rather than subdomains… you may have to define a new "elevator" for that.
[22:40:16] Radar: https://github.com/influitive/apartment/blob/development/lib/apartment/elevators/generic.rb
[22:40:19] Radar: Elevators are fairly simple
[22:43:24] Radar: Come to think of it, you may be able to build a path elevator by using the params
[22:43:39] dsample: Radar, Apartment's readme seems to only mention database separation
[22:44:16] Radar: dsample: why do you want the data in the one database?
[22:45:38] dsample: At the moment I'm interested in allowing sharing with the public and across tenants, so not full isolation.
[22:46:42] dsample: which is why I liked acts_as_tenant as it's a more like soft-tenancy rather than full isolation
[22:46:54] Radar: Ah ok, I thought you wanted full separation.
[22:48:22] dsample: I might change my mind later, but at the moment that's the idea :)
[22:49:02] Radar: Ok then, good luck :)
[22:49:27] dsample: Radar, but that leaves me with my predicament with the url_options :P
[22:49:33] Radar: dsample: indeed :)
[22:49:37] Radar: I don't know how to help you wrt to that.
[22:58:51] nate_: is the most appropriate/best place to have code for parsing data from an api/parsing by screen scraping in a helper method/file
[23:00:24] Radar: nate_: Why is that data not being stored in the database?
[23:08:26] nate_: parsing / being stored
[23:08:55] Radar: nate_: Put that in a model.
[23:09:39] nate_: ok so that code goes directly into the book.rb
[23:09:54] nate_: what would be approprate code to go into helper methods
[23:09:54] Radar: This is the first time I have heard about book.rb
[23:09:59] Radar: helper methods are for the views.
[23:19:09] mp___: Hi. I need a callback to trigger when a HABTM relationship is modified. Eg model.foos << bar needs to trigger behaviour
[23:21:21] mp___: ah. after_add & after_remove
[23:46:15] martianixor: anybody here is maintaining the official rubyonrails guide?
[23:46:22] martianixor: the web page?
[23:46:58] martianixor: there's an issue
[23:47:54] martianixor: with the guides web page
[23:48:05] bastilian: martianixor: what kind of issue?
[23:48:20] martianixor: this URL http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
[23:49:05] martianixor: bastilian shows a strange pop up "Syntax Highlighter, can't find Brush for Ruby"
[23:49:37] bastilian: martianixor: nope, it does not.
[23:49:47] martianixor: bastilian, a dialogue with the message I've mentioned
[23:50:08] bastilian: martianixor: nope. can it be an extension you are using?
[23:50:11] martianixor: bastilian, I'm using chromium
[23:50:22] martianixor: I don't think so
[23:50:26] martianixor: because I didn't change anything
[23:50:38] martianixor: a couple of hours earlier it was working fine
[23:51:44] martianixor: no update on the system, nothing has changed
[23:51:58] martianixor: besides it's the only page that shows that
[23:52:23] tjbiddle: Completely off topic - but does anyone know of an AWS IRC channel?
[23:52:24] martianixor: actually the guides subdomain in general
[23:52:43] tjbiddle: Trying to work some things out and I don't know where to go for help
[23:52:52] bastilian: martianixor: just tested with chromium and can't see a popup.
[23:53:16] martianixor: bastilian, I'll check with another one
[23:53:58] martianixor: bastilian, you're right, probably cache needs clearing
[23:54:49] martianixor: bastilian, that corrected the issue
[23:56:50] martianixor: sorry false alarm