Activity Graph

Page 1 of 3 | Next »


[19:13:34] mib_mib: has joined #RubyOnRails
[19:14:12] mib_mib: hi all - i need to create a "light" ecommerce app where we sell 2 or 3 products only - what framekwork do you guys recommend? I see for instance, shopify, or strip checkout or? suggestions welcome?
[19:21:06] mib_mib: what do you mean by that
[19:21:34] mib_mib: the site requires the user to fill out different questions to learn their preferences, and has to suggest products based on that set of suggestions
[19:23:13] mib_mib: Inside well, it would have to stay on the same domain as well, so i guess we could iframe it in
[19:24:25] mib_mib: and why do you recommend using something like that? just because it requires little to no building?
[19:29:47] mib_mib: what if i'm both?
[19:30:15] mib_mib: but of course want to minimize complexity and maximize value
[21:21:03] mib_mib: Remote host closed the connection


[19:16:55] mib_mib: has joined #ruby
[19:17:20] mib_mib: does [1,2,3,4].collect.with_index iterate the array only one time? or twice for both enumerators?
[19:18:26] mib_mib: also, does this differ from say [1,2,3,4].collect {|x| [x,x]}.select {|x,y| x} which does iterate twice correct?
[19:18:45] mib_mib: but could in fact iterate once no?
[19:19:35] mib_mib: is there a way to convert the second one to only iterate once easily? (without rewriting it to an 'each' statement)
[19:19:47] mib_mib: using lazy
[19:46:02] mib_mib: Ping timeout: 250 seconds


[22:06:47] mib_mib: has joined #ruby
[22:07:22] mib_mib: hi all - when using 'pry' console, sometimes when i try to paste some code into it, i get a 'help' screen i.e. "SUMMARY OF LESS COMMANDS" almost like a man page and stuff - why is this happening / how do i prevent it?
[22:08:16] mib_mib: its like the shell or console gets messed up somehwo
[22:33:58] mib_mib: Quit: Page closed


[00:47:19] mib_mib: has joined #ruby
[00:48:22] mib_mib: hi all - i am generating a large json object and writing it to a file - however, this approach seems like it wont scale since i have to have the entire json blob in memory and write it all at once - i was thinking about instead creating a mix of csv/json, i.e. creating one json field per line in a file - is this not recommended?
[00:48:49] mib_mib: this assumes there are no newlines inside of each json
[01:12:44] mib_mib: Ping timeout: 250 seconds


[23:19:52] mib_mib: has joined #ruby
[23:20:34] mib_mib: hi - having trouble with reading a document - i do File.read('somefile').remove_non_ascii.split("\n").collect {|x| x.strip} to parse it into lines
[23:21:03] mib_mib: however, i am getting erro: in `strip`: invalid byte sequence in US-ASCII
[23:21:34] mib_mib: but i already did remove_non_ascii - so why would i be getting an invalid byte sequence if i already encoded it to ascii and replaced all non-ascii?
[23:22:02] mib_mib: ENCODING_OPTIONS = { :invalid => :replace, # Replace invalid byte sequences :undef => :replace, # Replace anything not defined in ASCII :replace => ' ', # Use a blank for those replacements :universal_newline => true # Always break lines with \n } ASCII_ENCODING = Encoding.find('ASCII') class String def remove_non_ascii self.encode(ASCII_ENCODING, ENCODING_OPTIONS) end end
[23:23:00] mib_mib: |2701: nah, i just pasted it =D - i usually monkey patch this in to String class
[23:23:51] mib_mib: |2701: it works, just not the no-op part, since my default encoding is not utf8 but ascii i assume
[23:24:12] mib_mib: arahael: okay, so do I need to do like File.read('somefile','rb') ?
[23:25:55] mib_mib: arahael: you read the docs saying its a no-op but you dont know how to convert it ?
[23:25:59] mib_mib: arahael: i see
[23:33:55] mib_mib: arahael: ah okay that appeared to work, very oddly though
[23:38:20] mib_mib: Ping timeout: 250 seconds


[07:56:48] mib_mib: has joined #RubyOnRails
[07:59:21] mib_mib: hi - with devise, i want to disallow banned users from logging in - in user.rb i overrode active_for_authentication? to check if the user has a banned role - however, where does devise recommend I redirect to logout with error message?
[08:02:46] mib_mib: https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb#L43 - mostly i'm wondering if I should just create a before filter on application_controller to check the user status, or if there is a better way... i.e. more built in way
[08:03:49] mib_mib: or override authenticate_user! method
[08:04:06] mib_mib: right, but it still lets banned users log in
[08:04:24] mib_mib: it lets them authenticate and log in, and then shows an error message while logged in
[08:04:32] mib_mib: i'd prefer to not even authenticate them
[08:04:39] mib_mib: instead just returning an error message
[08:07:20] mib_mib: well it shows its false, but i still log in properly =/
[08:07:30] mib_mib: but then it just shows an error message
[08:07:35] mib_mib: i.e. 'you are not authorized'
[08:10:48] mib_mib: ah it seems to work now....odd....
[08:11:48] mib_mib: maybe a server restart was all it took....
[09:24:18] mib_mib: Ping timeout: 252 seconds


[19:50:26] mib_mib: has joined #ruby
[19:52:57] mib_mib: hi - i am testing som regexes, when i do this /\b>6\.5%\b/i.match(' >6.5% ') it returns nil, why would that be?
[19:54:37] mib_mib: baweaver: okay why not?
[20:07:53] mib_mib: hi - i am testing som regexes, when i do this /\b>6\.5%\b/i.match(' >6.5% ') it returns nil, why would that be?
[20:08:01] mib_mib: does the \b not match the space word boundaries?
[20:08:12] mib_mib: something is up with the '>' symbol i think but i'm not sure what
[20:58:40] mib_mib: Ping timeout: 252 seconds


[20:01:20] mib_mib: has joined #RubyOnRails
[20:01:31] mib_mib: is there any way to pass a scope into an association?
[20:01:49] mib_mib: i.e. has_one :blah, scope: unscoped
[20:02:00] mib_mib: whats the easiest way to unscope an association if not?
[20:14:10] mib_mib: Quit: Page closed


[01:52:39] mib_mib: has joined #RubyOnRails
[01:53:59] mib_mib: hi all - mysql2 driver supports 'streaming' results - is this option available for use with activerecord?
[02:00:24] mib_mib: Ping timeout: 252 seconds


[05:04:24] mib_mib: has joined #RubyOnRails
[05:06:23] mib_mib: hi all - i have a class in lib/services/map_service.rb - i have added config.autoload_paths += %W(#{Rails.root}/lib/services) to application.rb, however i still get the Rails "NameError uninitialized constant" error - what gives here?
[05:07:35] mib_mib: i'm not sure why it can't find it? in console it loads fine
[05:13:38] mib_mib: yes have restarted everything
[05:14:56] mib_mib: It is happening in a resque worker, if that helps at all
[05:17:18] mib_mib: slash_nick: http://pastebin.com/tH4Jr6v5
[05:18:45] mib_mib: sorry i abbreviated it before
[05:18:53] mib_mib: BingMapService
[05:19:01] mib_mib: and so is the file
[05:19:04] mib_mib: everything works properly in console
[05:19:17] mib_mib: i have restarted the resque workers numerous times
[05:20:23] mib_mib: no, its in lib/services
[05:20:34] mib_mib: BingMapService is being called in a Location model
[05:20:58] mib_mib: i see this: https://github.com/resque/resque/wiki/FAQ#how-do-i-ensure-my-rails-classesenvironment-is-loaded
[05:21:01] mib_mib: maybe something ishould try
[05:23:34] mib_mib: is autoloading not good in prod? why?
[05:25:36] mib_mib: how else would i load paths in like lib/services or what not?
[05:25:59] mib_mib: if i want to eager load, should i put both an autoload and an eager load for 'lib/services/' ?
[05:26:22] mib_mib: or, what is recommended then for prod?
[05:28:40] mib_mib: hmmmm this doesn't seem to have solved it
[05:29:01] mib_mib: let me try eager loading instead
[05:30:39] mib_mib: i guess the resque link wouldn't solve it since its just loading activerecord descendents anyway
[06:13:44] mib_mib: hmmmm this is odd - if i only have one resque worker it seems to work proplery, otherwise, if i have 2, the second one isn't eager loading the models properly and just errors
[06:18:43] mib_mib: rvanlieshout: I have a model called Location that uses a class from lib/services/bing_map_service.rb, and i get "uninitialized constant Location::BingMapService" - in one of the workers, but not the other
[06:19:49] mib_mib: rvanlieshout: i tried setting eager load paths, calling the model from resque:setup, running Rails.eager_load! , nothing seems to work
[06:20:23] mib_mib: rvanlieshout: sure, but it should have eager loaded it, or if it didn't, then at least load it when it needed it, instead of just erroring out
[06:26:06] mib_mib: rvanlieshout: yah tried that, not working
[06:26:28] mib_mib: rvanlieshout: i am doing binding.pry in the rake task, before its referenced, and it is not defined, even though its supposed to be eager loading...
[06:26:39] mib_mib: defined?(Location) -> nil
[06:28:10] mib_mib: hmmm it appears that rails doesn't eager load fully in rake tasks i see
[06:28:13] mib_mib: I need to call
[06:28:16] mib_mib: Rails.application.eager_load!
[06:28:19] mib_mib: let me try that
[06:28:55] mib_mib: doing Rails.application.eager_load! didn't work before in the resque:setup task
[06:29:04] mib_mib: will try directly now in the rake task and see
[06:32:41] mib_mib: this is such odd behavior, the rake task is supposed to load a resque with like 20 different tasks, and 19 will fail and 1 will be taken by the single worker
[06:53:28] mib_mib: this is odd - since even in the capistrano messages, it says that its being loaded, and is loaded, but then when you put a job on the queue, it errors
[06:58:10] mib_mib: it appears to be a prod only issue
[07:04:38] mib_mib: slash_me: i think the files themselves are sort of irrelevant
[07:04:40] mib_mib: just their locations
[07:07:29] mib_mib: app/models/location.rb, app/services/bing_map_service.rb, and app/jobs/geocode_locations_job.rb
[07:08:05] mib_mib: slash_nick: i have tried adding require 'bing_map_service' at the top of all the files, to no avail....
[07:08:51] mib_mib: errr yah sorry i meant lib/services/bing_map_service.rb ! My bad...
[07:09:11] mib_mib: the other two are under app/
[07:10:18] mib_mib: The error is: http://pastie.org/private/mia6kiuar0lytfocclugq
[07:11:12] mib_mib: slash_nick: http://pastie.org/private/8lyny1xi6lhsrslay9fhxq
[07:11:43] mib_mib: yah, but calling it from the rails console also has a problem
[07:12:07] mib_mib: The jobs get added to the queue perfectly
[07:12:21] mib_mib: but when the worker touches them, it has that error and the jobs fail
[07:13:12] mib_mib: its in the link
[07:13:28] mib_mib: you need the entire model?
[07:13:44] mib_mib: there are a ton of irrelevant methods
[07:14:05] mib_mib: the second pastie link i sent
[07:14:23] mib_mib: autoload_paths
[07:15:34] mib_mib: http://pastie.org/private/jxf5re8slenguygn8sklba
[07:15:53] mib_mib: this is how it currently is - i dont think i need to load everything in lib/services explicitly but was something i was trying
[07:17:53] mib_mib: something is up with resque / the workers
[07:18:10] mib_mib: even though i'm only running 1 worker, it takes a job
[07:18:17] mib_mib: oh well, nm
[07:18:21] mib_mib: ill just keep digging
[07:18:47] mib_mib: maybe some workers are still running in the background or something
[07:19:02] mib_mib: slash_nick: no
[07:19:34] mib_mib: sevenseacat: I mean, calling Resque.enqueue(GeoLocationsJob, ['some location']) also errors
[07:19:58] mib_mib: slash_nick: If you look at the code, i'm simply calling BingMapService.new inside of Location.geocode!
[07:21:03] mib_mib: sevenseacat: yah Location.first.geocode! works fine
[07:21:32] mib_mib: slash_nick: it was formerly without the two ::, i just added that recently to see if it mattered or not
[07:21:41] mib_mib: slash_nick: which, of course, had no effect =D
[07:22:25] mib_mib: sevenseacat: restarting the workers?
[07:22:32] mib_mib: i'm using capistrano-resque
[07:22:43] mib_mib: i.e. cap production resque:stop / start
[07:22:57] mib_mib: sevenseacat: also, i created a task to unregister all workers explicity
[07:23:09] mib_mib: that runs this: Resque.workers.select{|worker| worker.id.split(':').first}.each(&:unregister_worker)
[07:23:24] mib_mib: it seems to work properly, resque-web shows no workers
[07:23:28] mib_mib: i also restarted redis-server
[07:24:27] mib_mib: sevenseacat: after stopping the workers, ps aux | grep resque shows the workers going away
[07:24:52] mib_mib: ah i see a hung worker
[07:25:07] mib_mib: let me just kill him
[07:25:13] mib_mib: sigh... that could have been it!
[07:25:16] mib_mib: hopefully....
[07:26:37] mib_mib: not sure hwo he escaped me last 5 times lol
[07:26:47] mib_mib: lets see if he was the problem
[07:29:11] mib_mib: slash_nick: sevenseacat 'she' was it!
[07:29:29] mib_mib: all that work, just a hung worker hiding in process space.... thanks a lot!
[08:35:22] mib_mib: Ping timeout: 252 seconds


[03:19:10] mib_mib: has joined #RubyOnRails
[03:19:55] mib_mib: hi - I would like to use activerecord models with Vertica database, but i dont see any well supported projects like this - would it be a lot of work to create activrecord-vertica t adapter?
[03:26:01] mib_mib: How would i see the 'generated sql' for a query that is a 'count', i.e. MyModel.where(some: 'thing').to_sql works, but not MyModel.where(some: 'thing').count.to_sql doesnt (since its evaluuated)
[03:30:24] mib_mib: has joined #ruby
[03:30:37] mib_mib: hi - rails question - How would i see the 'generated sql' for a query that is a 'count', i.e. MyModel.where(some: 'thing').to_sql works, but not MyModel.where(some: 'thing').count.to_sql doesnt (since its evaluuated)
[03:30:46] mib_mib: if anyone knows the 'arel' library...
[03:44:15] mib_mib: Ping timeout: 252 seconds


[15:12:39] mib_mib: has joined #RubyOnRails
[15:13:51] mib_mib: hi - whats recommended for using multiple aws instances behind a loadbalancer? Do you just deploy to them all at the same time? or rolling restart? what about migrations that lock the tables?
[16:28:34] mib_mib: Ping timeout: 252 seconds
[20:44:03] mib_mib: has joined #RubyOnRails
[20:44:25] mib_mib: hi all - if i dont set 'pool' in database.yml - does it default to 5? Or does activerecord not use a connection pool?
[21:30:41] mib_mib: Quit: Page closed
[21:46:21] mib_mib: has joined #RubyOnRails
[21:46:51] mib_mib: Hi all - why when i put a translation in my view like t(:some_missing_string) and go to the url, it doesn't say translation missing, it just says "Some Missing String" - ?
[21:50:37] mib_mib: FailBit: i see that, but then why if i do like <%# flash[:notice] %> where i set flash[:notice] = t(:some_other_missing_string) (in controller)
[21:51:02] mib_mib: FailBit: this renders in the view as: "translation missing: en.hello_world"
[21:51:13] mib_mib: FailBit: i.e. in this case it prepends the translation missing string to it
[21:51:41] mib_mib: FailBit: isn't it odd behavior for the same translate method on the same string to render differently?
[21:52:25] mib_mib: FailBit: depending on wheter the method was called in the view or in a controller?
[21:53:35] mib_mib: FailBit: but dont they both delegate to Il8n.translate method?
[21:54:37] mib_mib: FailBit: i guess they are both wrapping it, but this seems pretty stupid to me
[21:55:21] mib_mib: so settinging like flash[:notice] = t(:some_message) should never happen?
[21:55:28] mib_mib: in the controller?
[21:56:29] mib_mib: FailBit: all i'm saying is that i think its 'reasonable' to expect calling @myvar = t(:some_message) to render the same as calling t(:some_message) in the view
[21:56:36] mib_mib: but it doens't
[21:57:02] mib_mib: yes, and i'm saying i think thats a dumb design decision
[21:57:28] mib_mib: because it has the 'appearance' of calling Il8n.translate directly
[21:57:30] mib_mib: but it doesn't
[21:57:35] mib_mib: i mean, i can call it directly, fine
[21:57:46] mib_mib: but its confusing for sure, and hidden
[21:58:08] mib_mib: that one =D
[21:58:22] mib_mib: oh nice, never new that
[21:58:47] mib_mib: at least, it should be called something different
[21:58:57] mib_mib: pretty_translate
[21:58:58] mib_mib: or something
[21:59:30] mib_mib: anyway - something i would change =D
[21:59:38] mib_mib: thanks for the help though =D
[22:43:51] mib_mib: Quit: Page closed


[01:28:50] mib_mib: has joined #RubyOnRails
[01:29:12] mib_mib: hi is there any way to turn off datetime parsing for a query? its super fucking slow
[02:08:48] mib_mib: Ping timeout: 252 seconds


[20:48:50] mib_mib: has joined #ruby
[20:49:57] mib_mib: hi - using ruby 2.1 - i have a csv file that has empty quoted fields, i.e. a field that is empty is just two quotes ("") instead of just blank - however, the default when reading the csv file seems to read this as two quotes instead of unquoting it - is there a csv option to optionally 'unquote' all fields?
[20:53:34] mib_mib: the field actually is two quotes
[20:53:53] mib_mib: maybe ur right....
[20:54:11] mib_mib: hmmmm i guess i was confused, thanks!
[21:06:49] mib_mib: Ping timeout: 246 seconds


[22:02:50] mib_mib: has joined #RubyOnRails
[22:05:01] mib_mib: hi - i'm using papertrail with a custom model, when i run it in rails console, it works fine, i.e. tracks the version - however, when I run it as a rake task and try to save, i get NameError: uninitialized constant 'SpecialVersions'
[22:05:24] mib_mib: is there some difference of how models are loaded when running rails console vs a rake task?
[22:05:44] mib_mib: i added this to application.rb: config.autoload_paths += %W(#{Rails.root}/models/papertrail_versions)
[22:07:06] mib_mib: this is a simple model that inherits from PaperTrail::Version
[23:25:13] mib_mib: Ping timeout: 246 seconds


[19:05:04] mib_mib: has joined #RubyOnRails
[19:07:38] mib_mib: hi all - i'm using the aws s3 library here: http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/ObjectCollection.html - however, having trouble with AWS s3 listing just objects - when i do bucket.objects.with_prefix(some/prefix/).as_tree.children.select(&:leaf?) - it actually still selects the **folder** object, i.e. the results are[ 'some/prefix/ ', ;some/prefix/key1.blah']
[19:07:56] mib_mib: how do i get it NOT to list the actual **folder** objects?
[19:12:08] mib_mib: rhizome: yah unfortunately that returns it as well
[19:12:41] mib_mib: rhizome: i guess they consider anything below the root bucket a key or something... dunno
[19:13:06] mib_mib: rhizome: i can hack it with just a .select or .reject after getting the keys, but its sort of annoying...
[19:13:44] mib_mib: well, its weird that its considering that a 'leaf' of the tree, versus a branch
[19:14:00] mib_mib: the docs seem to say that it shouldb e considered a branch...
[19:14:09] mib_mib: but the .branch? returns false...
[20:17:07] mib_mib: Ping timeout: 246 seconds


[18:27:40] mib_mib: has joined #RubyOnRails
[18:29:20] mib_mib: hi guys - i have a column that stores a semicolon separate list of ids - like 1;2;3;4;5 ..... now, i am trying to get the has_many association to work properly (ultimately, I want the .includes method to work properly) - does anyone have any good suggestions here?
[18:29:37] mib_mib: the semi-colon separated list of ids are primary keys into another table
[18:31:35] mib_mib: treehug88: i realize i'm abusing it here a little bit - but its sort of for good reason, the table is really large, and I dont want to duplicate rows for each item
[18:32:05] mib_mib: so, there could be 1000 items, i dont want to have 1000 rows (each with their own timestamp, data, etc)
[18:32:21] mib_mib: because then my data is going to explode by a factor of 100 to 1000
[18:34:26] mib_mib: anyway, if there's no way to do waht i want to do so be it, i can do it manually, but would like to use 'includes' if possible...
[18:38:46] mib_mib: all of this logic only applies at a certain data size assumption
[18:39:07] mib_mib: i'm telling you, if i do that, the data size will grow too large.
[18:39:29] mib_mib: sharding the database right now is not an option - and is much more hassle than changing a sql query imho
[18:39:56] mib_mib: waseem_: infinite storage, sure, not infinite ram though.
[18:40:44] mib_mib: it almost have it working, but the has_many ... primary_key: <my method to give ids here> only seems to use the first id instead of all the ids
[18:40:59] mib_mib: i guess i'll dive in and see why..
[22:21:28] mib_mib: Ping timeout: 246 seconds


[21:28:03] mib_mib: has joined #ruby
[21:31:23] mib_mib: has left #ruby: ()
[21:31:41] mib_mib: has joined #ruby
[21:31:52] mib_mib: has left #ruby: ()
[21:31:57] mib_mib: has joined #ruby
[21:32:01] mib_mib: has left #ruby: ()


[21:22:59] mib_mib: does anyone here use codeship?
[21:23:02] mib_mib: has joined #RubyOnRails
[21:40:37] mib_mib: kinduff: for a rails project (connected to mysql) - i need to set a variable in the my.cnf and restart mysql - do you know how i'd go about doing that? codeship doesn't seem to allow sudo
[22:03:52] mib_mib: Ping timeout: 246 seconds
[22:52:27] mib_mib: has joined #RubyOnRails
[22:52:47] mib_mib: do you guys use mutliple monitors? if so, what do you normally have in each monitor? rails server? code? guard tests?
[22:54:15] mib_mib: weaksauce: what docs? rubydocs? rails guides?
[22:55:36] mib_mib: weaksauce: do you have any good programs for switching between screens / shortcuts instead of alt tab?
[23:14:34] mib_mib: Ping timeout: 246 seconds