asteros

Activity Graph

Page 1 of 1

2016-01-24

[09:56:00] asteros: has joined #ruby
[09:56:00] asteros: has joined #RubyOnRails
[10:33:16] asteros: Quit: asteros
[17:40:15] asteros: Client Quit
[17:40:15] asteros: has joined #ruby
[17:40:15] asteros: has joined #RubyOnRails

2015-12-09

[00:49:41] asteros: Quit: asteros
[00:51:15] asteros: has joined #ruby
[00:51:15] asteros: has joined #RubyOnRails
[01:11:59] asteros: Quit: asteros
[01:24:01] asteros: has joined #ruby
[01:24:01] asteros: has joined #RubyOnRails
[01:26:01] asteros: Client Quit
[01:44:06] asteros: Client Quit
[01:44:06] asteros: has joined #ruby
[01:44:06] asteros: has joined #RubyOnRails

2015-12-08

[23:53:52] asteros: has joined #ruby
[23:53:52] asteros: has joined #RubyOnRails

2015-12-02

[01:12:19] asteros: Quit: asteros
[01:26:16] asteros: has joined #ruby
[01:26:16] asteros: has joined #RubyOnRails
[01:46:12] asteros: Quit: asteros
[02:39:12] asteros: has joined #RubyOnRails
[02:39:13] asteros: has joined #ruby
[02:44:02] asteros: Ping timeout: 260 seconds
[02:46:11] asteros: has joined #RubyOnRails
[02:46:12] asteros: has joined #ruby
[02:55:35] asteros: Quit: asteros
[18:38:02] asteros: has joined #RubyOnRails
[18:38:03] asteros: has joined #ruby
[20:16:12] asteros: Quit: asteros
[20:59:22] asteros: Client Quit
[20:59:22] asteros: has joined #ruby
[20:59:22] asteros: has joined #RubyOnRails
[21:35:34] asteros: has joined #ruby
[21:35:34] asteros: has joined #RubyOnRails
[23:23:12] asteros: Quit: asteros

2015-12-01

[19:44:44] asteros: has joined #ruby
[19:44:44] asteros: has joined #RubyOnRails
[20:54:24] asteros: Quit: asteros
[21:02:11] asteros: has joined #ruby
[21:02:11] asteros: has joined #RubyOnRails
[21:18:58] asteros: Quit: asteros
[21:29:39] asteros: has joined #RubyOnRails
[21:29:40] asteros: has joined #ruby
[21:30:48] asteros: Client Quit
[21:32:33] asteros: has joined #ruby
[21:32:33] asteros: has joined #RubyOnRails
[22:08:21] asteros: Quit: asteros
[22:39:23] asteros: has joined #RubyOnRails
[22:39:24] asteros: has joined #ruby

2015-07-15

[23:19:23] asteros: has joined #ruby
[23:19:23] asteros: has joined #RubyOnRails
[23:38:09] asteros: Quit: asteros
[23:43:22] asteros: has joined #ruby
[23:43:22] asteros: has joined #RubyOnRails
[23:52:51] asteros: Quit: asteros

2015-06-18

[00:25:16] asteros: Quit: asteros

2015-06-17

[22:37:22] asteros: has joined #ruby
[22:37:22] asteros: has joined #RubyOnRails
[23:26:54] asteros: Quit: asteros
[23:27:26] asteros: has joined #ruby
[23:27:26] asteros: has joined #RubyOnRails

2015-06-15

[22:22:38] asteros: has joined #ruby
[22:22:38] asteros: has joined #RubyOnRails
[23:12:33] asteros: Quit: asteros
[23:21:37] asteros: has joined #ruby
[23:21:37] asteros: has joined #RubyOnRails
[23:21:48] asteros: Client Quit

2015-06-12

[00:51:18] asteros: has joined #ruby
[00:51:18] asteros: has joined #RubyOnRails
[00:51:47] asteros: Client Quit

2015-06-10

[00:01:22] asteros: has joined #ruby
[00:01:22] asteros: has joined #RubyOnRails
[02:12:17] asteros: Quit: asteros
[02:15:39] asteros: has joined #ruby
[02:15:39] asteros: has joined #RubyOnRails
[02:15:48] asteros: Client Quit

2015-06-09

[22:48:52] asteros: has joined #ruby
[22:48:52] asteros: has joined #RubyOnRails
[23:39:46] asteros: Quit: asteros

2015-05-31

[00:50:38] asteros: has joined #ruby
[00:50:38] asteros: has joined #RubyOnRails
[00:51:15] asteros: Client Quit

2015-05-30

[00:26:53] asteros: Quit: asteros
[00:28:38] asteros: has joined #ruby
[00:28:38] asteros: has joined #RubyOnRails
[00:43:58] asteros: Quit: asteros
[00:50:37] asteros: has joined #ruby
[00:50:37] asteros: has joined #RubyOnRails
[01:06:29] asteros: Quit: asteros
[01:29:33] asteros: has joined #ruby
[01:29:33] asteros: has joined #RubyOnRails
[01:37:13] asteros: Quit: asteros

2015-05-29

[21:30:25] asteros: has joined #ruby
[21:30:25] asteros: has joined #RubyOnRails
[21:30:32] asteros: Client Quit
[21:30:50] asteros: has joined #ruby
[21:30:50] asteros: has joined #RubyOnRails
[22:02:22] asteros: Quit: asteros
[22:12:46] asteros: has joined #ruby
[22:12:46] asteros: has joined #RubyOnRails
[23:13:45] asteros: Quit: asteros
[23:50:30] asteros: has joined #ruby
[23:50:30] asteros: has joined #RubyOnRails

2015-01-20

[22:40:41] asteros: blahwoop: you should have the client convert the timezone and be mostly dealing with UTC on the server
[22:45:16] asteros: blahwoop: i???d imagine it would be easiest to send the times at UTC, and then use something like moment.js on the client to convert the timezone at the browser. usually that???s the only ???bulletproof??? way to determine someone???s timezone anyway
[23:09:26] asteros: does anyone know if there???s a way to exclude an asset pattern from sprockets? apart from rewriting the initial Rails.configuration.assets.precompile[0] proc?

2014-12-19

[01:36:54] asteros: Cache_Money: you do that in your controller
[01:37:58] asteros: Cache_Money: f.submit is just a helper to genreate the HTML for the submit button, which submits to the form URL. if you want it to do something after that procesess, issue a redirect in the controller action

2014-12-16

[20:49:30] asteros: does anyone know if there???s an idiomatic way to have ActiveRecord use a ???custom??? attribute, or fallback to a query if not?
[20:49:47] asteros: basically trying to avoid the n+1 query situation
[20:50:49] asteros: Radar: sorry, I have an attribute defined on a model that???s a calculated relationship, for example relationship.sum(:amount)
[20:51:18] asteros: if I???m getting an array of the parent objects and then calling the calculated value on each, it does a n+1 query
[20:51:26] asteros: but I can have ti return the calculation with a join query
[20:51:35] asteros: so I???ve currently overwritten the getter method as:
[20:51:41] asteros: has_attribute?(name) ? read_attribute(name).to_i : association.sum(:amount)
[20:52:10] asteros: which seems to work - if I run Parent.joins(???), it won???t re-query for the calcualted column when I iterate over it
[20:52:14] asteros: and if i don???t do the join, it does
[20:52:19] asteros: but i???m wondering if this is something that is already built into AR
[20:52:22] asteros: in some way
[20:53:30] asteros: Radar: hmm, ok. that makes me feel like this is less hacky :) it seems like it would be a somewhat common use case
[20:58:30] asteros: why not return a count in the response? that???s pretty commmon too { count: 10, items: [] }
[21:00:48] asteros: you want the total count, even though the return object array is not the entire array
[21:03:49] asteros: { meta: {}, items: {}}
[21:42:42] asteros: well, you can inherit serializers
[21:42:47] asteros: if you are going to have 10 different serializations
[21:42:49] asteros: what else are you going to do?
[21:42:57] asteros: you define a common serializer
[21:43:00] asteros: and then inherit the rest
[21:44:57] asteros: yes, I don???t see why it wouldn???t be simpler to call the correct serializer based on the permissions
[21:45:39] asteros: and that???s worse than having 10 different conditional logic in 1 serializer?
[21:46:41] asteros: you???re saying that you have Object, and depending on who is serializing it, you either have [a, b] attributes or [c, d] attributes
[21:49:06] asteros: pipework: tubbo: interactor is nice, but I wish you could explicitly define input and output context
[21:49:26] asteros: the default implementation makes it not the clearest what the interactor takes as arguments
[21:50:24] asteros: pipework: I mean since it???s a hash, e.g. Interactor.call(foo: a, bar: b)
[21:50:57] asteros: pipework: ah, maybe. the examples on the gem page don???t define arguments for #call
[21:51:09] asteros: https://github.com/collectiveidea/interactor#an-example-interactor
[21:52:25] asteros: towski_: config.assets.compile = false
[21:52:53] asteros: towski_: it normally is default false in production environments
[21:53:05] asteros: towski_: http://guides.rubyonrails.org/asset_pipeline.html#live-compilation
[21:54:03] asteros: F__i__L: if you have 10 auth levels, and 3 objects, how are you ever going to get around having 30 different unique serializations?
[21:56:05] asteros: F__i__L: I dont??? understand why you can???t make a serializer for each auth level?
[21:57:03] asteros: F__i__L: let me give you an example using AMS
[21:57:21] asteros: lets just pretend you have two auth levels
[21:57:40] asteros: you have ObjectASerializer and ObjectBSerializer
[21:58:10] asteros: then you have some class that takes the authorization object
[21:58:43] asteros: ChooseAuthorization.call(authorizaiton_object), and it returns ObjectASerializer or ObjectBSerializer
[21:58:54] asteros: and in your controller, you can now do
[21:59:11] asteros: ActiveModel::ArraySerializer.new(Object.all, each_serializer: ChooseAuthorizaiton.call(auth_object))
[21:59:16] asteros: something like that
[22:00:10] asteros: then you don???t use AMS
[22:01:09] asteros: right, what pipework said
[22:02:51] asteros: F__i__L: the point is that you???re doing the authorization on the individual objects
[22:03:05] asteros: ActiveModel::ArraySerializer doesn???t do any sort of serialization
[22:03:13] asteros: all it does it iterate over the collection and apply the each_serializer defined
[22:03:19] asteros: why couldn???t you do the same thing?
[22:03:38] asteros: ChooseAuthorization returns the correct serializer for the authentication level
[22:03:58] asteros: then you would have to have conditional logic inside the serializer
[22:04:10] asteros: there???s no way you???re getting around the fact that *somehwere* needs to make that logic
[22:04:18] asteros: what???s the duplication?
[22:04:27] asteros: you have 4 different sets of attributes
[22:04:39] asteros: what???s the other option?
[22:23:41] asteros: GarlandGala: yes, if you code it, a website can open up your filesystem
[22:24:32] asteros: there was a rails vulnerability a few weeks ago which allowed for enumeration of any file on the filesystem, if it was configured to run with those permissions
[22:25:16] asteros: http://weblog.rubyonrails.org/2014/11/17/Rails-3-2-21-4-0-12-and-4-1-8-have-been-released/
[22:25:27] asteros: well, this vulnerability didn???t let you read the data
[22:25:28] asteros: I would like to announce that Rails 3.2.21, 4.0.12, and 4.1.8 have been released. These releases contain a security fix where the existence of arbitrary files on the file system can be leaked, but the contents of the file will not be leaked.
[22:25:35] asteros: but, if your applicaiton is ocded incorrectly, yes it is possible
[22:32:05] asteros: GarlandGala: sorry, misunderstood your original question, that???s correct
[22:32:18] asteros: though usually server file access is still very bad :)

2014-04-02

[17:13:35] asteros: Hivoltage: the code is always private on heroku
[19:32:29] asteros: phat4life: why wouldn???t all of the orders that haven???t been assigned to a customer just be Order.where(???customer_id is null???)?

2014-02-27

[00:42:30] asteros: bodie_: if you look in the file you just posted, you'll see that it's defined as POST /posts(.:format) posts#create
[00:43:15] asteros: bodie_: it has nothing to do with convention over configuration
[00:43:39] asteros: bodie_: if you don't like that behavior, feel free to redefine that route to POST /posts/new
[00:46:13] asteros: bodie_: IIRC, that is the RESTful way to do this - POSTing to the /resources is creating a new resource. /posts/new is simply a convenience to generate a form
[00:56:27] asteros: why not try resource.user_id = user.id
[00:56:44] asteros: you might be comparing two copies of the same object that aren't the same
[00:58:07] asteros: what are the values of resource.user_id and user.id in that method
[00:59:50] asteros: why don't you add some log statements to the authorizer? it'll be easier to see what resource.user is returning
[01:00:31] asteros: just do p resourece.user_id
[01:00:50] asteros: p user.id; p resource.user_id
[01:04:56] asteros: makerop: what happens if you change it to user.has_role? :contractor || resource.user_id == user.id
[01:05:48] asteros: can I see the logs for that?
[01:06:12] asteros: glaksmono_: there'a s view helper, but this is probably best done on the client
[01:06:29] asteros: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words_to_now
[01:06:57] asteros: makerop: if it's really evaluating to user.has_role? :contractor || 1 == 1, that method is going to return true
[01:07:24] asteros: what if you try resource.user_id == 1
[01:08:31] asteros: could be precedence - then (resource.user == user) should fix
[01:09:52] asteros: log the results of both halves
[01:09:58] asteros: p user.has_role? :contractor
[01:10:01] asteros: p resource.user == user
[01:10:42] asteros: the second one is false?
[01:16:45] asteros: that seems very strange
[01:17:01] asteros: or is lower precedence than ||

2014-02-26

[23:15:27] asteros: is it possible to have some middleware that runs the routes to determine which controller + action a request is going to use without actually calling the action?
[23:20:45] asteros: ah, I found routes.recognize_path
[23:26:05] asteros: grvgr: awesome, works as needed

2014-02-20

[04:49:20] asteros: is anyone familiar with sprockets on rails 3.2? I'm trying to figure out how the asset pipeline calls the compress method

2014-02-02

[01:10:50] asteros: hey all, does anybody know if add_template_helper in the mailers are deprecated?
[01:12:12] asteros: hey all, does anybody know if add_template_helper in the mailers is deprecated?
[01:12:51] asteros: sorry - my IRC client was bugging and i wasn't sure if it was sent out

2014-01-14

[22:39:46] asteros: shinobi_one: you can specify the platform in your gem file
[22:40:37] asteros: shinobi_one: its not perfect but something like this http://stackoverflow.com/questions/7117565/can-bundler-constrain-a-gem-installation-to-a-certain-operating-system
[22:41:28] asteros: shinobi_one: also check out https://github.com/bundler/bundler/issues/663
[22:41:35] asteros: i'm not sure what the current state of that is though

2014-01-13

[19:42:54] asteros: by default, rspec doesn't delete the data - it runs your tests in a transaction
[19:43:07] asteros: so any DB actions within a test are rolled back
[19:43:12] asteros: but data before the test won't be deleted
[19:43:37] asteros: the exception is if you have some sort of database_cleaner up
[19:46:44] asteros: yeah, compiled assets is often the culprit
[19:47:56] asteros: looks like input_html

2013-12-18

[00:19:48] asteros: hey, does anybody know of a better alternative to distance_of_time_in_words?
[00:21:48] asteros: tubbo: somewhat more granular. it displays "about 1 month" when the distance is closer to 2 months
[00:22:20] asteros: AntelopeSalad: awesome, I'll look into that. do you know if moment's distance estimation rounds down by default?
[00:22:40] asteros: tubbo: yep, looks like that's a good option. thanks
[00:24:19] asteros: AntelopeSalad: what do you mean by 2?
[00:24:31] asteros: oh you mean on the client side
[00:26:10] asteros: AntelopeSalad: tubbo, yeah it looks like doing moment is the best option, but according to http://momentjs.com/docs/#/displaying/fromnow/ it looks like i'll need to modify the way it outputs the distance
[00:26:22] asteros: thanks for the tips!

2013-11-26

[23:15:23] asteros: hey guys, quick q - is there a way to prevent duplicate form submission if a user refreshes before the server even processes the request?
[23:15:59] asteros: so not the normal repost pattern
[23:16:23] asteros: was thinking of using a nonce type thing but could you run into a race condition?
[23:29:06] asteros: PrivateAlpha: ah, thanks. any suggestions for that? something like rack::throttle?
[23:33:33] asteros: PrivateAlpha: great, thank you

2013-11-11

[23:27:30] asteros: hey guys, is there an idiomatic way in active record to get all relations scoped to the relation_id but also to fetch the unscoped records?
[23:28:10] asteros: e.g. @parent.children returns all children where parent_id = @parent.id OR nil

2013-10-08

[18:47:31] asteros: Hey guys, quick question - say I have a Site model and a Post model. Posts belong to Sites. what's the best way to set a post as default?
[18:47:41] asteros: I have a default_post column in Site
[18:48:04] asteros: but to get the Site.default_post magic to work, it requires a seemingly hacky belongs_to "default_post", :class_name => "Post"
[18:48:40] asteros: since the foreign key is on the child model
[18:50:45] asteros: lassebunk: ok, thank you!