Activity Graph

Page 1 of 1


[20:05:04] alexday: Quit: ZNC 1.6.5 -


[12:25:52] alexday: *.net *.split
[12:27:26] alexday: has joined #ruby
[15:01:23] alexday: *.net *.split
[15:03:10] alexday: has joined #ruby


[19:10:30] alexday: has joined #ruby
[19:11:54] alexday: I was reading the well grounded ruby book. there is a operator overloading kind of thing. one class inherits from String and has def +@; upcase; end. what does @ signify


[07:21:07] alexday: has joined #RubyOnRails
[07:22:18] alexday: I am trying to move the database migration stuff as a separate thing. how do I remove the ActiverRecord Migration stuff from rails? except for the config/database.yml ?
[07:26:25] alexday: ok, so I also don't need to worry about schema.rb as well right! actually the problem is eveytiem i need a migration change I have to redeploy the whole app. I am thinking of only using the model's controllers' and then handle the databsae stuff separately. (using sqitch)
[07:34:36] alexday: because its time consuming. plus here the deployment is kindof a mess. there are 16 boxes. and then these guys deploy change one one box at a time. one deploy takes like 2 hours total :P
[07:34:56] alexday: so I am just spiking this idea out.
[08:31:57] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[01:53:20] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[12:15:46] alexday: has joined #RubyOnRails
[12:15:52] alexday: what is this error for?
[12:18:54] alexday: redis conn
[12:21:04] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[13:00:28] alexday: has joined #RubyOnRails
[13:02:22] alexday: I have another question. there is a lib/tasks folder. and there is a Rakefile. and in the Ralefie there is no loading of this directory or require of these files. will bundle exec rake, run these .rake file as well? or only the Rakefile
[13:06:57] alexday: require File.expand_path('../config/application', __FILE__)
[13:06:58] alexday: Rails.application.load_tasks
[13:07:00] alexday: core_client = Gem::Specification.find_by_name 'core-client'
[13:07:02] alexday: load "#{core_client.gem_dir}/lib/tasks/create_mysql_schema_for_ci.rake"
[13:33:27] alexday: it only loads the file doesn't execute the tasks right?
[13:33:57] alexday: I added a puts "Hello" in all of them. they don't get logged though
[13:54:59] alexday: if there is a def self.uuid method then it shouldn't pick it up from securerandom
[13:56:10] alexday: securerandom require'd in your file?
[13:56:30] alexday: maybe gist some cofe
[13:56:35] alexday: s/cofe/code
[14:01:54] alexday: maybe someone overrwote the method in initialzer to mess :D .
[14:02:00] alexday: not sure why
[14:34:15] alexday: save(false)
[14:34:52] alexday: or skip_callbacks=true


[11:01:39] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[06:00:58] alexday: has joined #RubyOnRails
[15:47:21] alexday: has left #RubyOnRails: ("WeeChat 1.9.1")
[19:45:17] alexday: has joined #RubyOnRails


[06:24:25] alexday: I have a ruby question.
[07:16:14] alexday: so I have a file <env>.rb which looks like default.rb and then in the file1.rb file I have to actually render an erb template. So in there erb template there will be something like <%= for @default['..']['..'] .... %> . Once I am able to put the default hash from default.rb into file1.rb's Abc object. I can do the rest. I am stuck here
[07:28:05] alexday: it is a pronoun :P
[07:41:44] alexday: dminuoso: ok, I will try once more. I have a file called production.rb which looks like default.rb. I have to use this hash in default.rb to render an erb template. The code to render that will go inside file.rb. But the problem is since in default.rb there is no intialization being done, when I try to require_relative default.rb or self.instance_eval( "default.rb") it doesn't work because of
[07:41:46] alexday: obvious reasons.
[07:42:05] alexday: I want to know if there is any way(good or bad) to achieve the this thing
[07:47:59] alexday: you mean in default.rb put the variable in a method inside a module?
[07:49:03] alexday: If it is, I can't do that, because its a constraint. If i change that it will break all other things. but can I use metaprogramming to do that in file.rb
[16:48:08] alexday: has left #RubyOnRails: ("WeeChat 1.9.1")


[10:24:50] alexday: has joined #ruby
[10:29:16] alexday: I am having a problem. There is a chef cookbook, where there is an attributes/default.rb and then there is an attributes/development.rb . and then there is a templates folder with .erb file. So I just wanted to render that erb file using the values in the file in the attributes folder. but the problem is in (say) attributes/default.rb its written like force_attributes['foo']['bar']['baz'] = [ 'something' ] ;
[10:29:17] alexday: and when I require_relative "attributes/default.rb" then it says undefined local variable or method `force_override' for main:Object . how do I get across this
[10:51:25] alexday: no one is replying in chef channe;
[11:15:25] alexday: how do I make this work. ruby file1.rb
[11:21:55] alexday: thats the problem. I cannot change that file. :) . I will have to wait for the chef guys to ell me how do they do this. I cannot understand from the codebase, still looking though
[11:26:41] alexday: yeah I understand they are all different, I copy pasted the names from the file where the variables are defined after the first time I got the error :P
[11:27:11] alexday: I also tried with force_attribute , without the @
[11:48:46] alexday:
[12:03:15] alexday: adaedra: nope
[12:03:21] alexday: everyone is offline it seems
[16:47:42] alexday: has left #ruby: ("WeeChat 1.8")


[07:46:28] alexday: so yestarday for the accepts_nested_attributes_for, I had to write a custom validation that would do the validation in the application model rather than tags model. because there were a couple of problems. the uniqueness validations wasn't triggering while creating new_record and while updating if I deleted a key and then added the same key with different name then the update would fail with duplicate
[07:46:30] alexday: key error.
[07:48:34] alexday:
[11:42:15] alexday: I had a quesyion. I have applications has_many configuration. now in after_save of Application, there a loop that calls a Configuration class 2 ice. in the class method there is something like and then and when I do a FactoryGirl.create(:configuration), then in the end it errors out sayng Application has already been taken
[11:42:51] alexday: I am not sure how is this happening
[11:42:55] alexday: any ideas?
[12:07:55] alexday: sevenseacat
[12:08:07] alexday: tell me if anyone needs to see anything more
[12:08:15] alexday: my rails foo is so down.
[12:17:16] alexday: I can;t seem to do FactoryGirl.create(:configuration)
[12:23:07] alexday: yeah. that actually makes sense. when I remove the .save the creation succeeds


[12:05:19] alexday: has joined #RubyOnRails
[12:09:51] alexday: I am having a little problem. I have a polymorphic association. Tag belongs_to :entity, polymorphic: true; validates :name, :entity_id, :entity_type, presence: true. and Application has_many :tags, as: :entity; accepts_nested_attributes_for :tags, reject_if: :all_blank;. Now in the applications controller I have @application.tags = . and in the new.html.erb I have a f.fields_for
[12:09:52] alexday: :tags do |t| ... end . Now when I click on submit in the application new form. it says entity can't be blank. which is justified because entity_id has not been created yet. But how to solve this? I tried to add inverse_of in has_many but its say not possible. Presently I have stripped out tag_attributes from the applications_params and then after creating application I have updated with {
[12:09:54] alexday: tags_attributes: application_params }
[12:11:29] alexday: made a small mistake not @application.tags = only
[13:00:27] alexday: dminuoso sure. the internet went off. posting in a moment
[13:08:25] alexday: dminuoso:
[13:15:04] alexday: I did. but that was long ago. someone said people dont take the name shortCircuit__ seriously. it makes me look like a kid rather than a professional.
[13:24:30] alexday: erm any updates on my code problem?
[13:40:02] alexday: its giving the same error Tags entity can't be blank
[13:40:36] alexday: oh wait. maybe because of validates :key, uniqueness: { scope: [:entity_id, :entity_type] } this ?
[13:43:00] alexday: like in a normal has_many relationship if you have accepts_nested_attributes_for . then one needs to specify inverse_of in the has_many side, so that the parent is saved first I guess before childs are saved
[13:45:48] alexday: ok here it says in the answer to save the parent first
[15:46:06] alexday: I cannot understand one thing. while doing @application.update(tags_attributes: application_params["tags_attributes"]) why is the validates :key, uniqueness: { scope: [:entity_id, :entity_type] } validation not triggered. I mean it should be triggered atleast on the database level, where I have said ` add_index :tags, [:key, :value, :entity_id, :entity_type], unique: true`
[15:47:44] alexday: where as while updating as in PATCH @application.update(application_params) the validation gets triggered when I have a duplicate key
[15:49:09] alexday: I do have validates_associated
[20:59:27] alexday: I have a question. when there is accepts_nested_attributes_for :tags. and I override tags_attributes=(attrs) method. and I do a uniqueness check inside. how do I raise an error?
[21:00:57] alexday: as in not like raise error. like errors[:base] << :taken
[21:06:06] alexday: has this issue been resolved in rails 4?
[21:07:03] alexday: or this


[05:51:55] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[10:12:39] alexday: has joined #RubyOnRails
[10:14:49] alexday: I wanted to ask about a deployment thing. We have a sidekiq.yml with priorities set. But the problem is the one with higher priority has so much load that sometimes the 4 boxes go down. One solution is to manually change the sidekiq.yml in some boxes to process only the highest priority queue. but that is a manual thing. automating that is difficult. Is there any solution to this problem less hacky


[09:07:36] alexday: has joined #ruby
[09:07:36] alexday: has joined #RubyOnRails
[09:07:52] alexday: has left #ruby: ("WeeChat 1.8")
[09:10:04] alexday: I have an werid thing happening. I didn't add any I18n configuration. I had 2 files in locales/ en.yml id.yml . then I18n.available_locales showed :en, :id . then I added :de . and reloaded. available_locales showed :en :id :de . but now that I deleted the file. it still shows :de in list. why
[09:13:06] alexday: I did restart
[09:15:43] alexday: oh ok I think I got it.
[09:17:28] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[07:18:02] alexday: has left #RubyOnRails: ("WeeChat 1.9.1")


[12:18:59] alexday: I have a small problem. in rails 4.2. is there a way to get the error details key when an error is generated by activemodel validations. like :name_or_email_blank this
[12:33:33] alexday: matthewd, that new @details in the activemodel errors in new version of rails, is it possible to do something similar in rails 4.2? One way would be to take the relevant pieces of code from the new code and monkey patch in my codebase. but is their a less intrusive way to do this
[12:44:14] alexday: yeah, so is there a way to get that symbol in the older rails version?
[13:04:55] alexday: I got a gem, but that still does that patching. I guess I will patch as well.


[06:31:41] alexday: when should one use services in rails


[05:22:46] alexday: has joined #RubyOnRails
[10:19:25] alexday: ho gya exam
[10:19:31] alexday: wat da hell


[20:07:01] alexday: has left #RubyOnRails: ()


[18:05:10] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[18:05:16] alexday: has left #ruby: ("WeeChat 1.8")


[07:53:43] alexday: I have a csv file for mobile operators and country codes, which is 77kb in length, I want to get the list of country codes and split a phone number by its country code and send it in user profile response. since its 77kb I am thinking of loading it in memory. but I am not sure how to do it. as in, in config intializer, put the csv file and a class, and load them like Phonelib.country_codes = ..


[05:55:36] alexday: has joined #ruby
[05:55:38] alexday: has joined #RubyOnRails


[07:13:24] alexday: has joined #RubyOnRails
[07:13:38] alexday: I have a question regarding rspec
[07:17:01] alexday: this thing, is it possible to configure this for only one context block? the problem is I have a method, that makes an api request. rspec that connects to a mock server and sends user_id as parameter. but in the spec for another model I haven't mocked the method call of the previous method. so I want to ignore the user_id
[07:17:03] alexday: param only for this test. is it possible?
[07:18:10] alexday: I tried doing, context '....', vcr: { :match_requests_on, :method, request_matchers.uri_without_param(:user_id) }
[13:13:26] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[13:13:34] alexday: has joined #ruby
[13:17:04] alexday: is it possible to create a blank object. what I am trying is, I have this http_req =, http_req.start do |h| h.request(req) end; but if there is a trouble connecting I want to rescue the exception, so that application doesn't exit. but in doing that the other code that uses it will do a response.code == "403", so I was thinking if I can create a response object with
[13:17:28] alexday: is that approach ok
[13:18:23] alexday: the problem is what do I do when I get a connection timeout exception
[13:20:05] alexday: ok, and after catching it returning a 500 was, what I was thinking
[13:20:23] alexday: like return'1.1', '500', 'Connection Error')
[13:23:56] alexday: but after catching the exception, for the api to work I have to return something, right?


[07:10:46] alexday: has joined #RubyOnRails
[07:12:41] alexday: hello. I had a sidekiq question. in the sidekiq redis. I have some dead jobs. I can see them in the ui in <ip>:9494/morgue. but when I do zcount dead 0 -1. it shows integer count 0. where to check for a dead job in a paricular queue and chech the contents!!
[07:36:48] alexday: also what is work.job
[17:14:49] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[17:46:51] alexday: has joined #RubyOnRails
[18:32:47] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[18:38:21] alexday: has joined #RubyOnRails
[18:39:13] alexday: has left #RubyOnRails: ("WeeChat 1.8")
[18:48:12] alexday: has joined #RubyOnRails
[19:11:55] alexday: has left #RubyOnRails: ("WeeChat 1.8")


[15:40:27] alexday: has joined #RubyOnRails
[15:46:42] alexday: hi.. I had a question. requirement is if the first login attempt fails, then show a call me button. Now this state is handled at backend, and is dependent on the number of retries. say that I have a code which says, num_of_retries= login_requests.number_of_retries; <some if else logic> login_requests.update(retries: num_of_retries + 1). now the problem is. we have jruby to support thread. and when I am
[15:46:45] alexday: running a spec that says: prev_num = login_requests.number_of_retries. post :create, bla: bla; login_requests.reload . expect(login_requests.number_of_retries).to eq(prev+1). This test passes locally, but when run in gitlab this fails. either saying exepected 1 got 2 or expected 1 got 3.
[15:46:47] alexday: why is this?
[15:47:13] alexday: is it because of some thread. like say two it blocks run parallely?
[15:47:52] alexday: and then before this post request another post request gets executed? and if so, how do I write the code or test properly
[19:19:00] alexday: has left #RubyOnRails: ("WeeChat 1.8")