frankson

Activity Graph

Page 1 of 3 | Next »

2015-07-23

[18:12:49] frankson: Ping timeout: 264 seconds

2015-07-13

[21:38:28] frankson: has joined #RubyOnRails

2015-05-26

[21:05:47] frankson: Ping timeout: 250 seconds

2015-05-23

[19:10:14] frankson: has joined #RubyOnRails
[19:50:17] frankson: https://gist.github.com/sickslives/19bfb96a6f5bcab6a140
[19:50:53] frankson: im trying to save a model, and associate a bunch of objects to it at the same time, but fields_for isn't producing the number of items i'm associating
[19:51:47] frankson: the models im trying to associate already exist in the database, but i think its not behaving the way I expect because the parent isn't saved yet
[19:53:31] frankson: any idea what im doing wrong?
[19:58:24] frankson: should I even use fields_for for this?
[20:01:00] frankson: nah thats all it was
[20:01:14] frankson: i was looking at that though and it didn't jump out at me cuz that doesn't use f.fields_for
[20:01:29] frankson: but i guess that's cuz it's passing the parent in afterwards
[20:09:32] frankson: comic sans forever
[20:10:15] frankson: heolix: you might need to bind your server to 0.0.0.0 instead of localhost
[20:10:53] frankson: may also need to forward ports
[20:11:11] frankson: yea nvm that ips local :P

2015-05-01

[22:09:29] frankson: i wanna bump one element of an activerecord collection to the beginning of the list, does anyone know the method i'm looking for
[22:11:26] frankson: one that i specify
[22:13:45] frankson: mikecmpbll: so should i just remove the item i want to be first from the collection, display it first, and then display the rest?
[22:15:16] frankson: mikecmpbll: just equivalency of an integer id attribute
[22:17:30] frankson: you'd want to compare rails to laravel
[22:17:37] frankson: or another php framework
[22:18:48] frankson: Gondei: you could write a web app with ruby, it'd just be a pain
[22:18:55] frankson: thats what frameworks are for
[22:18:57] frankson: same as with php
[22:19:39] frankson: all rails is is a barebones ruby webapp
[22:23:54] frankson: i thought rails 4 was all pro at scaling

2015-04-24

[22:02:17] frankson: b4tm4n: might need to compile your assets
[23:10:57] frankson: Doddlin: i thought the heroku cli tool automatically precompiles assets when you push an update
[23:11:00] frankson: but if it didn'
[23:11:15] frankson: t you'll have to use heroku's cli to precompile them over there
[23:12:37] frankson: ewilliam: http://guides.rubyonrails.org/active_record_validations.html
[23:13:34] frankson: ewilliam: look at 6.1 custom validations
[23:13:46] frankson: or 6.2 custom methods
[23:20:14] frankson: did you push it again

2015-04-21

[04:54:55] frankson: can i only call visit once within an rspec feature scenario?
[05:40:29] frankson: hmmmm k one sec lemme gist this up
[05:43:42] frankson: https://gist.github.com/sickslives/9e3610b52c3335683e33
[05:44:58] frankson: so long as i don't call visit again the test passes
[05:45:26] frankson: and i can use click_link to get to other pages, with multiple assertions per scenario to verify i am indeed navigatin pages
[05:45:36] frankson: but visit seems to explode the session
[05:48:45] frankson: the test fails because the user is no longer logged in
[05:49:03] frankson: page does not have content 'logged in as'
[05:54:06] frankson: added the failure
[05:55:01] frankson: was that what you meant by full failure
[06:02:14] frankson: added the sessions controller, i'm probably not saving data in the session correctly
[06:04:16] frankson: it works when i run the server
[06:04:59] frankson: so where should i be verifying what in my test
[06:05:17] frankson: i thought integration tests were supposed to be written from the user persective and i dont have access to the session
[06:05:33] frankson: it creates one if they dont exist
[06:07:58] frankson: i could throw the whole thing up if you want
[06:09:09] frankson: ahhhhhhh but none of this goofyness is committed
[06:09:28] frankson: one sec lemme sort this out
[06:15:31] frankson: https://github.com/sickslives/mike
[06:18:49] frankson: well my logout spec only checks if the user is logged out
[06:19:28] frankson: which is the problem, that multiple visit calls log the user out
[06:19:36] frankson: so it is correctly passing
[06:20:09] frankson: yea thats the login via google link
[06:20:54] frankson: i've been dicking around with it so it's all messed up right now
[06:21:38] frankson: no, i just wanted to know if you knew why visit might be killing my session
[06:23:33] frankson: k, i'll try something else
[06:28:21] frankson: actually, i guess i should only use visit once, as the only time the user would enter a url and not navigate through page interaction is on the initial visit to the site
[06:28:46] frankson: its not a problem! its a best practise
[06:39:40] frankson: sevenseacat: have you worked with omniauth together with rspec feature tests
[06:39:57] frankson: do you have any sample code i can look at
[06:40:02] frankson: or non sample code
[07:22:19] frankson: vedu: http://www.toptal.com/ruby-on-rails/elasticsearch-for-ruby-on-rails-an-introduction-to-chewy
[07:49:48] frankson: vedu: yea, between that article and the chewy docs i figured it out, tho mixing in some of the elasticsearch filters were less than obvious
[07:51:06] frankson: but setting up the search indexes and doing basic searches was actually pretty easy

2015-04-18

[05:40:32] frankson: post only works in controller tests
[05:40:45] frankson: factories are for defining sample data
[05:41:41] frankson: https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs
[05:42:11] frankson: in there, where it's got the 'get :index' would be where a 'post :create' would be acceptable
[05:43:33] frankson: if you're just trying to use the factory, then in that same example, instead of Team.create you'd have create(:media_source)
[05:44:58] frankson: delinquentme
[05:46:19] frankson: from what i hear though, you shouldn't write controller tests?
[05:48:37] frankson: fat objects and skinny controllers is another convention
[05:49:27] frankson: and in line with that, using model specs and integration tests is, from the perspective of some, the thing to do
[05:50:11] frankson: i.e. unit test the behaviour of your objects, and integration test the whole stack from the behaviour perspective
[05:50:24] frankson: so you can refactor your implementation without affecting behaviour
[05:50:55] frankson: https://github.com/andreareginato/betterspecs/issues/14
[05:51:08] frankson: much better explanation of the different viewpoints here
[05:54:36] frankson: i've just recently been learning how to test and came accross that yesterday
[05:55:26] frankson: i was all gung ho about testing my controller cuz that's the only thing about my app right now that I know exactly everything it's going to do
[05:56:38] frankson: so i wrote a nice test for it and was all proud of myself, but then i found this and my joyous feelings were crushed
[05:58:00] frankson: i'm definitely still figuring out what's worth testing, but the controller test i wrote is definitely testing my implementation, not necessarily it's behavior
[05:59:08] frankson: especially since controllers inherit from eachother and rails can still handle requests you don't have actions for
[17:41:46] frankson: could your game do it with curl?
[17:44:54] frankson: acriax: why not? all you really need is to be able to do a post request to your devise sessions controller, and handle the cookie you get in the response no?
[17:47:41] frankson: what are you using to build the game?
[17:51:28] frankson: lol not very secure
[17:52:16] frankson: does your app have a web sign in?
[17:54:40] frankson: you could find the account via username/password first, and then pass that result to sign_in if its not false
[17:57:03] frankson: devise has valid_password?('pass123')
[17:57:19] frankson: so find the user, check the password, then sign them in

2015-04-14

[00:09:41] frankson: so should i always use bundle exec working with gems?
[00:10:39] frankson: except for gem install bundler of course!!!
[00:22:46] frankson: renegadeandy: your error says something's nil that's not supposed to be, if you stick byebug in before line 15 and poke around with @user you might find what's nil thats not supposed to be

2015-04-13

[23:44:48] frankson: Kendro: when you think of a feature you want to implement, first step is to google <feature> gem
[23:44:59] frankson: you will likely find out you don't need to implement it
[23:49:45] frankson: is pundit > cancancan?
[23:50:26] frankson: lol he didnt guess, thats what the error said
[23:54:24] frankson: yea dont listen to me
[23:56:01] frankson: does chruby + ruby-install have something like gemsets?
[23:57:36] frankson: but if you have multiple projects that use different versions of the same gem, wont you still get explosions

2015-04-11

[08:53:19] frankson: how do y'all feel about cucumber, worth?
[08:59:19] frankson: you still test tho right
[08:59:40] frankson: cucumber or testing....
[08:59:55] frankson: why doesn't it have a use now
[09:02:01] frankson: yea i spose im just writing step definitions twice with cucumber arent i
[09:02:15] frankson: thats not very DRY at all!
[09:09:16] frankson: thankyou sevenseacat, i think you've saved me quite a bit of time
[20:39:42] frankson: mrbubbles: create and destroy aren't get requests by convention
[20:42:59] frankson: mrbubbles: yea, usually a redirect or an ajax response
[20:44:35] frankson: yea i guess thats what i mean by ajax

2015-04-05

[21:50:50] frankson: hey if cucumber can't access the sessions hash, how should I assert that my user has been logged in?
[21:51:20] frankson: if session[:user_id] not being null signifies that they are, indeed logged in

2015-04-04

[09:30:51] frankson: what's the correct way to validate that an object has a minimum of one in a has_many association?
[09:34:41] frankson: you know what, nevermind, i don't think im testing my validations correctly

2015-04-03

[05:40:17] frankson: nooooo! hellpaaaa!
[05:40:49] frankson: thats not very helpaful is it
[05:42:15] frankson: you can probably just make it
[05:45:50] frankson: floopie: i dont think the generator generates that file, but you can make it manually and it'll work the same
[05:46:35] frankson: floopie: actually, you should see what the UserMailer that was generated is inheriting from if anything
[05:46:42] frankson: and generate that for your defaults
[05:46:54] frankson: er manually create* if it doesnt already exist
[05:47:14] frankson: i've never seen a rails generate create the base class though
[05:47:37] frankson: so actionmailer base already exists in rails
[05:48:05] frankson: yea now just make your usermailer inherit from applicationmailer instead of actionmailer base
[05:48:57] frankson: nah just ApplicationMailer
[05:49:20] frankson: and your ApplicationMailer should inherit from ActionMailer::Base, so your UserMailer does too

2015-03-28

[21:33:50] frankson: as in you want a single field to contain the array?
[21:34:13] frankson: postgres allows for an array datatype
[21:34:22] frankson: what db are you using?
[21:35:15] frankson: submit a form or send an ajax request to your server
[21:35:51] frankson: if you're using sqlite you might just need to save your array as a string and just reparse it when you pull it from the db again
[21:45:20] frankson: frank_o: ajax query your app, on a path where your app queries the db
[21:47:49] frankson: like rhizome said, you could setup a path on your app like /status/:id
[21:47:57] frankson: where id is the id of the picture or whatever you're checking the status of
[21:48:05] frankson: and that route returns true or false if the status is good or not
[21:48:14] frankson: then thats the path you do your ajax request on
[21:48:27] frankson: so if your ajax request returns true, your know your object is done or whatever on the db side
[21:49:06] frankson: but javascript is on the client, it can't query your database directly
[21:52:16] frankson: http://guides.rubyonrails.org/routing.html
[21:53:55] frankson: frank_o: you should also look at the layouts and rendering guide on that site
[21:54:24] frankson: you'll probably want that /status/:id path or whatever to only respond to ajax requests
[21:54:43] frankson: but you could have to respond with more javascript behaviour if you wanted
[21:55:43] frankson: yea working code ftw
[22:02:01] frankson: Limix: im definitely bad at testing, but wouldn't testing an api only app just make things easier?
[22:02:22] frankson: as in you don't need to worry about css selectors, you can just make sure the response returns the data you're api is supposed to?
[22:03:01] frankson: what are you using right now?
[22:04:43] frankson: hmmm rspec and capybara i think
[22:15:40] frankson: yea something like that
[22:15:47] frankson: your js will need to know the id indeed
[22:42:45] frankson: yea the free version isn't meant for production sites
[22:43:00] frankson: but the paid version is probably overkill for a real estate agent's personal site
[22:43:19] frankson: i'd probably just use a digitalocean box for that
[22:43:44] frankson: 10 bucks a month could probably handle multiple realtor sites :P
[22:44:39] frankson: i've never dealth with their support but i've never had a problem either
[22:44:41] frankson: they have good docs
[22:45:06] frankson: but they basically just give you a vanilla box to configure however you like
[22:45:27] frankson: and they have a buinch of basic predefined stacks you can setup

2015-03-21

[01:43:09] frankson: hey if i'm dealing with a polymorphic association through a nested route, is there an easy way to determine the type from the controller? or should I just pass the parent's type and id in hidden fields

2015-03-18

[00:47:15] frankson: ahh eve online, the second job you don't get paid for
[00:48:57] frankson: hey does anyone know a way to save a datetime object and preserve the timezone it was parsed in

2015-03-09

[00:13:31] frankson: right, but what if i want to still know what TZ the data was originally entered in
[00:14:34] frankson: say a user enters "2015-03-09 7:00 PM EST", it parses and saves the correct time but tosses the EST and the offset out the window
[00:16:12] frankson: guess I should just save it as a string and parse it every time?
[00:19:02] frankson: does your update method in the controller define the resource as a variable?
[00:20:37] frankson: the old ones you're checking might have a before filter that defines it
[00:21:04] frankson: if you use the scaffold generator it includes a before_action that does a @resource.find(params[:id]
[00:21:16] frankson: for create update edit destroy
[00:21:35] frankson: er show edit update destroy

2015-03-08

[22:32:48] frankson: anyone know a good way to get the timezone abbreviation from a datetime object?
[22:33:35] frankson: DateTime.strftime('%Z') doesn't return what Time.strftime('%Z') does
[22:34:16] frankson: and parsing the datetime object as a time object applies to offset and then gives me UTC
[22:35:05] frankson: applies the* offset
[23:51:31] frankson: is there a way to preserve the timezone saved with a datetime attribute
[23:52:12] frankson: or will i need a separate attribute if i want that'

2015-02-16

[03:21:37] frankson: hey guys, trying to get a namespaced and nested dynamic segment to work, what's wrong with this gist? https://gist.github.com/sickslives/54f742f1c030d671c0c9
[03:27:03] frankson: when i check the controller_name and action_name it says 'courses' and 'show' the error is that there's no courses with id='analysis'
[03:27:17] frankson: hmm maybe thats not even the right controller
[03:27:22] frankson: checking routes
[03:40:46] frankson: updated my gist with rake routes results. the leading 'admin' after the to: in my route was incorrect but even corrected it still seems to be going to the show action
[03:43:26] frankson: yea this is a really messy project so im trying to clean it up a bit
[03:43:32] frankson: updated gist again with error
[03:44:38] frankson: it only works without the dynamic segment
[03:46:42] frankson: ACTION facepalms
[03:46:59] frankson: yea ok so im dumb. i was swapping one route for the other instead of including them both
[03:48:00] frankson: yea i included both in the example to illustrate what worked and what didn't
[03:48:18] frankson: but in my actual code i was taking segment-less route out
[03:49:00] frankson: i guess i had assumed it'd work fine even when no segment was passed
[03:49:26] frankson: oh? ok how do i mark it optional
[03:50:12] frankson: ahhh brackets
[03:50:46] frankson: thankyou thankyou

2015-02-07

[21:53:12] frankson: is it really bad to do a post onkeyup for a live preview of a formatted post
[21:53:33] frankson: am i raping my webserver or what
[21:53:43] frankson: it feels like a bad idea but it works really well
[22:00:37] frankson: gheegh: maybe use the session hash?
[22:04:00] frankson: gheegh: you don't need to rewrite your serverside to do js pagination though, you can just return whatever results you're returning for each page now as the js response
[22:06:16] frankson: so when someone clicks the 'next page' or adds a filter, it does an ajax request to your server instead of asking for a new page
[22:07:54] frankson: whoa turbolinks works that way?
[22:08:30] frankson: like it wouldn't reset the state of his js goodies?

2015-02-06

[22:33:45] frankson: hey yall. does content_for not work with partials?
[23:04:18] frankson: okay refining my question: is there a way to get a content_for block in a partial to yield in the layout? I've discovered i can yield to my view fine but due to the order in which stuff gets rendered
[23:04:36] frankson: it wont make it to the layout

2015-02-02

[08:30:20] frankson: hey guys, is it possible to get an array into a dynamic route segment?
[08:34:55] frankson: can i use slashes instead?
[08:35:26] frankson: or are those reserved
[08:36:54] frankson: yea i want like /tags/:tags[]
[08:37:13] frankson: or /tags/pork/cheese/tentacles/
[08:38:02] frankson: oh i need a constraint that allows the slash
[08:42:27] frankson: hmm so there's no way to do it without some sort of split?
[08:42:52] frankson: no way for the route to map params[:tags] to an array
[08:45:10] frankson: wouldnt you ever
[08:46:24] frankson: pineappletree: i think you can handle CSV's pretty well with just straight ruby
[08:49:36] frankson: and then you might need to register it as a mime type but you can just format your response as a csv for exporting
[09:09:57] frankson: try gardener_questionnaires_answers_path
[09:10:11] frankson: your answers resource is nested
[09:10:34] frankson: mikecmpbll: oops
[09:16:42] frankson: !command_line
[09:16:54] frankson: http://guides.rubyonrails.org/command_line.html
[09:17:17] frankson: do you mean being able to type rails g migration user name:string email:string etc?
[09:19:13] frankson: Rails_noob: type rake routes into console
[09:19:26] frankson: it will tell you what all the method names are for the various routes you've defined
[09:20:02] frankson: and actuall you can do rake routes | grep answers
[09:22:45] frankson: Rails_noob: cantonic is right
[09:23:01] frankson: no i didn't actually look at what was calling the route
[09:24:24] frankson: Rails_noob: use form_for [@gardener_questionnaire, @answer] do |f|

2015-01-08

[00:23:50] frankson: but not for my where clause :P