adavia

Activity Graph

Page 1 of 5 | Next »

2018-08-21

[15:56:11] adavia: has joined #RubyOnRails
[15:59:33] adavia: Weird issue here. Im trying to open a pdf file on the browser but is being shown in binary text. This is only happening in production.
[16:39:27] adavia: Ping timeout: 252 seconds

2018-03-13

[00:50:12] adavia: has joined #RubyOnRails
[00:51:24] adavia: Isnt this correct to set a default value? Image.create!(params.permit(:file, :imageable_type => "Book"))
[02:41:05] adavia: Ping timeout: 260 seconds

2018-03-08

[15:35:51] adavia: has joined #RubyOnRails
[16:52:53] adavia: Quit: Page closed

2018-03-02

[14:24:09] adavia: has joined #RubyOnRails
[14:25:40] adavia: Hey guys does anyone knows if its possible to load associations on just certain actions using AMS?
[15:28:55] adavia: Ping timeout: 260 seconds

2018-03-01

[00:31:29] adavia: Ping timeout: 260 seconds

2018-02-28

[18:55:55] adavia: has joined #RubyOnRails
[18:59:48] adavia: Using rspec, is there any way i can send raw post data as JSON?, as they are being coerced into a hash in my controller when i try: before { post '/books', params: valid_attributes.to_json, headers: headers }
[19:34:34] adavia: Ping timeout: 260 seconds
[20:29:32] adavia: has joined #RubyOnRails
[20:45:58] adavia: is it possible to send parameters as raw JSON when i do post request using rspec?
[21:42:58] adavia: is it possible to send parameters as raw JSON when i do post request using rspec? By default they are being coerced into a hash
[21:48:50] adavia: Radar: sure, https://gist.github.com/adavia/c0ca1ea77e6e66e12e21e2482f4dbf65
[21:50:14] adavia: Radar: i need to format a response being sent from the client
[21:54:05] adavia: Radar: removing those lines the response looks like Parameters: {"book"=>"{\"title\":\"My example app\" } } and validation always failed
[21:59:07] adavia: Radar: { "Authorization" => "token", "Content-Type" => "application/json" }
[22:02:08] adavia: Radar: im having the problem here JSON.parse(request.params[:book]) as im getting a string in my app but the test ends up sending a hash
[22:08:16] adavia: Radar: The params i get from the client Parameters: {"book"=>"{\"title\":\"My example app\"} } Unpermitted parameter: :book, so maybe validation fails cuz of that
[22:08:32] adavia: Will check that out

2018-02-16

[14:35:42] adavia: has joined #RubyOnRails
[15:06:09] adavia: Ping timeout: 260 seconds
[19:18:25] adavia: has joined #RubyOnRails
[19:23:15] adavia: Anyone using AMS 0.9.x knows why isnt it possible to do something like this https://gist.github.com/adavia/c17ba403e223653eea44f570e255c1b2
[19:42:26] adavia: tycoon177: but still is valid to do something like object.comments.where(created_by: scope)
[19:43:10] adavia: I guess that including an association should always return an array
[19:45:36] adavia: i cannot add a root level property in the json returned though
[19:45:59] adavia: Seems like the only way is creating a custom adapter
[19:55:08] adavia: normalizing data
[19:55:28] adavia: I dont want to use the json api specification
[19:56:00] adavia: I dont need to
[19:57:51] adavia: But i thought it was more flexible in the way you want to structure your data
[19:58:57] adavia: Guess im going back to jbuilder
[20:22:54] adavia: Ping timeout: 260 seconds

2017-07-11

[15:32:05] adavia: has joined #RubyOnRails
[15:35:28] adavia: Is it bad still using jbuilder instead of AMS. Is it probably slower?
[15:38:20] adavia: I feel with AMS you need to stick with any of the premade adapters. jbuilder is more customizable on that
[15:38:45] adavia: Yeah but its a pain
[15:40:01] adavia: Actually AMS was built by one of the ember core teams to fit it needs
[15:40:40] adavia: team members*
[15:43:00] adavia: i found an active-model-normalizr adapter but seems to be unmaintained
[15:44:33] adavia: dionysus69: agree
[15:47:30] adavia: dminuoso: the json api schema deals with a bunch on unnecessary data
[15:50:46] adavia: Using a frontend that deals with redux makes it a bit tedious to work with
[15:53:06] adavia: dminuoso: Need to still dig on that.
[15:56:10] adavia: dminuoso: Oh wait, but your are then normalizing at the end
[15:56:33] adavia: You use json-api-normalizer
[16:00:04] adavia: dminuoso: that makes much more sense
[16:36:52] adavia: has joined #ruby
[16:39:16] adavia: Is there any better way to parse errors with a format like https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[20:28:47] adavia: Is there any better way to parse errors with a format like https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[20:46:20] adavia: Remote host closed the connection

2017-07-10

[02:33:53] adavia: has joined #RubyOnRails
[02:46:37] adavia: Remote host closed the connection
[02:47:06] adavia: has joined #ruby
[03:24:14] adavia: has joined #RubyOnRails
[03:24:40] adavia: IS there any simple way to do this https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[03:34:02] adavia: Quit: Leaving
[03:35:11] adavia: has joined #RubyOnRails
[04:00:27] adavia: sevenseacat, https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[04:01:03] adavia: Just want to parse the association errors
[04:46:25] adavia: Ping timeout: 248 seconds
[17:05:02] adavia: has joined #RubyOnRails
[23:04:53] adavia: Ping timeout: 260 seconds

2017-07-09

[23:00:34] adavia: has joined #ruby

2017-07-08

[01:24:42] adavia: Is there any adapter for AMS like the normalizr library?
[02:04:47] adavia: Does anyone ever used this gem? active_model_normalizr
[02:28:20] adavia: naked penguin?
[08:28:42] adavia: Ping timeout: 240 seconds
[15:15:00] adavia: has joined #RubyOnRails
[15:22:05] adavia: a bit useless how rails 5 decided to show json index errors
[16:23:28] adavia: any way i can change { "questions[0].title": "this is an error message" } to { questions: { 0: { title: "this is an error message" } } }
[18:39:20] adavia: any way i can change { "questions[0].title": "this is an error message" } to { questions: { 0: { title: "this is an error message" } } }
[18:51:38] adavia: thats how rails 5 shows nested errors with index_errors: true which is extremely useless
[18:55:49] adavia: Trying something like https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[19:12:44] adavia: has joined #ruby
[19:13:22] adavia: how can i fix this https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[19:28:00] adavia: elomatreb, how can achieve something like questions: { 0: { title: "This is an error" }, 1: { title: "This is an error" } }
[19:30:49] adavia: Like this https://gist.github.com/adavia/4208c0d71b28bc942f254c4e02ca6b63
[20:16:08] adavia: Ping timeout: 260 seconds

2017-07-07

[03:48:11] adavia: has joined #RubyOnRails
[03:49:05] adavia: Is there any adapter for AMS like the normalizr library?
[04:46:46] adavia: Is there any adapter for AMS like the normalizr library?
[05:06:40] adavia: Ping timeout: 255 seconds
[18:34:06] adavia: has joined #RubyOnRails
[20:02:02] adavia: Is there any adapter for AMS like the normalizr library?

2017-04-05

[16:38:39] adavia: has joined #RubyOnRails
[16:38:57] adavia: has joined #ruby

2017-04-02

[02:41:49] adavia: Ping timeout: 246 seconds
[03:25:50] adavia: has joined #RubyOnRails
[05:16:27] adavia: Ping timeout: 240 seconds
[15:08:39] adavia: has joined #RubyOnRails
[18:26:09] adavia: Any idea how can i deal with this situation? http://stackoverflow.com/questions/43170880/display-filtered-related-data-for-a-survey-in-rails
[18:47:18] adavia: Any idea how can i deal with this situation? http://stackoverflow.com/questions/43170880/display-filtered-related-data-for-a-survey-in-rails
[21:05:57] adavia: Ping timeout: 240 seconds
[21:21:17] adavia: has joined #RubyOnRails

2017-04-01

[16:52:48] adavia: has joined #RubyOnRails
[18:43:52] adavia: Can i update all my associations in the console doing something like Survey.all.each { |s| s.answers.update_all(survey_id: s) }
[19:11:23] adavia: Can i update all my associations in the console doing something like Survey.all.each { |s| s.answers.update_all(survey_id: s) }

2017-03-31

[14:31:03] adavia: has joined #RubyOnRails
[20:38:09] adavia: Lets say i have a model question that has_many answers and answer has_one answer_choice and answer_phone? How can i get all phone answers where question_id is x and choice is x?
[21:13:29] adavia: renegadeandy: i have tried this but not bringing me what i need https://gist.github.com/adavia/8d9b69243e0bd6d365c078e567a8519a
[21:18:25] adavia: renegadeandy: https://gist.github.com/adavia/8d9b69243e0bd6d365c078e567a8519a
[21:23:00] adavia: pwnd_nsfw: for a better performance not really
[21:26:16] adavia: renegadeandy: you are just outputting answers where phone is x. Not really what i want
[23:35:02] adavia: Quit: Leaving

2017-03-30

[04:49:09] adavia: has joined #RubyOnRails
[05:24:15] adavia: damn filter
[05:37:53] adavia: Quit: Leaving
[16:31:01] adavia: has joined #RubyOnRails
[22:00:35] adavia: This might sound odd but can i overwrite an activerecord association param?
[22:06:07] adavia: Radar: lets say i want to filter question.answers by a question_id param im sending via GET
[22:07:30] adavia: Radar: ok that makes sense haha
[22:08:46] adavia: Radar: Nice! Thanks
[23:30:46] adavia: Ping timeout: 260 seconds

2017-03-29

[14:26:00] adavia: has joined #ruby
[14:26:01] adavia: has joined #RubyOnRails
[16:08:23] adavia: So i have this code that exports my survey. I am trying to match each question in the headers with its corresponding answer and it works fine if all answers for each question are present. The problem is when theres no answer present then question headers are not matching correctly. Any suggestion? https://gist.github.com/adavia/ea821e3dd09fba7fa7590c5c69baca2d
[16:46:22] adavia: centrx: if i have 4 questions and i only answer 2 of them then i get ["Foo", "Bar"] which will always match the first and second question header
[16:47:50] adavia: centrx: I need a way to match ["foo", "bar"] with the appropriate question header
[16:52:32] adavia: centrx: i believe i would need something like ["foo", nil, "bar", nil]
[17:09:16] adavia: centrx: no
[17:09:51] adavia: centrx: it returns ["foo", "bar"]
[17:11:42] adavia: centrx: no, it could be an array of 1, 2, 3, 4 entries. Depends what i have answered
[17:14:11] adavia: centrx: ohh yes
[17:15:46] adavia: centrx: but i guess the number of entries returned should be the same number of questions in the header
[17:16:52] adavia: centrx: that match if all answers are returned
[17:17:05] adavia: Otherwise not
[17:23:04] adavia: centrx: check at the end https://gist.github.com/adavia/ea821e3dd09fba7fa7590c5c69baca2d
[17:26:28] adavia: centrx: well thats what im trying to find out how to do it
[17:34:31] adavia: centrx: inside show answers?
[17:35:45] adavia: centrx: well each answer also belongs_to question
[17:40:38] adavia: centrx: i tried this https://gist.github.com/adavia/ea821e3dd09fba7fa7590c5c69baca2d
[17:43:49] adavia: centrx: How should i loop then
[17:46:52] adavia: Thought that was a nested loop
[17:51:12] adavia: will try that
[18:04:34] adavia: centrx: Awesome! That really worked
[18:04:38] adavia: centrx: Thanks
[20:51:15] adavia: can i group like this? @submissions.map { |submission| submission.questions.group(:id) }
[23:26:02] adavia: Quit: Leaving

2017-03-28

[17:48:05] adavia: has joined #RubyOnRails
[17:48:22] adavia: has joined #ruby
[18:06:16] adavia: This is not working as expected but if i have 6 answers then for each existing answer is adding the same amount of nil values to the array https://gist.github.com/adavia/c518cf08cea12f6c05d4c67acdd2d159
[20:02:17] adavia: jhass: https://gist.github.com/adavia/c518cf08cea12f6c05d4c67acdd2d159
[20:04:14] adavia: I guess i tried that
[20:07:37] adavia: i need to output a new array as ["Foo", nil, "Bar"]
[20:09:02] adavia: jhass: in that case ["foo", "bar"]
[20:10:16] adavia: [nil, nil]
[20:11:21] adavia: That should return also [nil, nil]
[20:18:12] adavia: jhass: [["foo", nil], [nil, "bar"]]
[20:21:14] adavia: jhass: Still theres no input like [{answer_open: "foo", answer_image: nil}, {answer_open: nil, answer_image: "bar"}]
[20:22:13] adavia: Yeah sorry i wasnt paying attention
[20:24:04] adavia: jhass: Thats valid.. in that case i should get ["foo"]
[20:24:33] adavia: ["foo", nil] ["foo"]
[20:25:49] adavia: jhass: i want to raplace any blank values with nil
[20:27:15] adavia: jhass: in the rails sense should be present?
[20:32:02] adavia: jhass: the real explanation is to export a csv with blank values in case attributes are not present. Otherwise the headers do not match with my rows lol
[20:33:43] adavia: "answer_open", "answer_image" and for those i need "foo" "bar" or nil, "bar" or nil, "bar"
[20:34:00] adavia: "bar", nil
[21:38:57] adavia: Ping timeout: 240 seconds

2017-03-27

[07:30:46] adavia: Quit: Leaving

2017-03-26

[04:32:22] adavia: Ping timeout: 260 seconds
[04:44:19] adavia: has joined #RubyOnRails
[06:28:17] adavia: Ping timeout: 246 seconds
[06:46:47] adavia: has joined #RubyOnRails
[20:07:53] adavia: Ping timeout: 260 seconds
[20:23:49] adavia: has joined #RubyOnRails

2017-03-25

[03:08:44] adavia: has joined #RubyOnRails
[05:41:56] adavia: Ping timeout: 258 seconds
[14:52:28] adavia: has joined #RubyOnRails

2017-03-10

[14:33:52] adavia: has joined #RubyOnRails
[23:18:51] adavia: Quit: Leaving

2017-03-09

[14:29:33] adavia: has joined #RubyOnRails
[15:44:26] adavia: Im wondering how to do this. Lets say i have a survey which have many questions and each question might have many answers. I want to set up dynamic email notifications based on the question and answer submitted. I'm a bit lost figuring out how to set up all these dynamically
[22:34:59] adavia: Ping timeout: 240 seconds

2016-08-01

[01:11:36] adavia: i get this error "column "messages.created_at" must appear in the GROUP BY clause or be used in an aggregate function" in this query https://gist.github.com/adavia/599b1cbac1112618ecddff1de4b024bf
[01:11:39] adavia: is it related to postgres?
[01:15:47] adavia: wondering how i can order by messages.created_at date then
[01:28:13] adavia: beingjohnm: you meant conversations. But in this case i want to sort conversations by their last message
[01:31:46] adavia: i dont think so
[01:36:05] adavia: beingjohnm: order("max(messages.created_at) DESC") was the trick

2016-07-31

[05:58:15] adavia: Ping timeout: 244 seconds
[14:53:51] adavia: has joined #RubyOnRails
[19:13:18] adavia: i get this error "column "messages.created_at" must appear in the GROUP BY clause or be used in an aggregate function" in this query https://gist.github.com/adavia/599b1cbac1112618ecddff1de4b024bf
[19:13:27] adavia: is it related to postgres?

2016-07-30

[06:30:32] adavia: Ping timeout: 258 seconds
[15:35:35] adavia: has joined #RubyOnRails
[16:27:32] adavia: can i order messages like this? https://gist.github.com/adavia/599b1cbac1112618ecddff1de4b024bf

2016-07-29

[05:32:22] adavia: Ping timeout: 265 seconds
[15:16:03] adavia: has joined #RubyOnRails

2016-07-28

[06:08:44] adavia: Ping timeout: 244 seconds
[15:12:21] adavia: has joined #RubyOnRails

2016-07-27

[05:31:04] adavia: Ping timeout: 264 seconds
[14:49:19] adavia: has joined #RubyOnRails
[18:07:40] adavia: can i render a jbuilder template within a data attribute?
[18:08:29] adavia: matthewd: yes
[18:09:11] adavia: something like render(template: "notifications/index", formats: [:json])
[18:09:47] adavia: well it brings me up an empty array
[18:10:10] adavia: no matter what i have in the jbuilder

2016-07-26

[04:40:06] adavia: Ping timeout: 276 seconds
[14:58:42] adavia: has joined #RubyOnRails
[20:18:13] adavia: what might be causing that when i use polymorphic_path(notification.notifiable) i get "/posts/135" but for images i get "/images/#\u003cImage:0xe0d9194\u003e"
[20:32:55] adavia: matthewd: umm what do you mean
[20:34:56] adavia: matthewd: ahh naa dumb mistake.. i forgot to add the action in my routes file

2016-07-25

[17:28:18] adavia: has joined #RubyOnRails
[17:31:55] adavia: if i do Conversation.includes(:messages).order("messages.created_at") will bring me up all conversations ordered by the most recent message?
[18:54:27] adavia: if i do Conversation.includes(:messages).order("messages.created_at") will bring me up all conversations ordered by the most recent message?
[19:06:51] adavia: sure.. but it still not ordering as expected =/
[19:13:05] adavia: dminuoso: if i have conv1 with messages created_at: 2 days ago and conv2 with messages created_at: 1 day ago i expect to retrieve [con2, conv1] but i still get [conv1, conv2]
[19:14:31] adavia: dminuoso: Conversation.includes(:messages).order("messages.created_at")
[19:15:16] adavia: that would fix it?
[19:24:49] adavia: dminuoso: so this is what you meant order(messages: {created_at: :desc}) ?

2016-07-24

[06:01:32] adavia: Ping timeout: 260 seconds

2016-07-23

[17:29:31] adavia: i have posted the issue here http://stackoverflow.com/questions/38536687/rails-actioncable-subscribe-to-a-channel-after-an-ajax-request
[17:33:59] adavia: tbuehlmann: doing App.Messages would call MessagesChannel#subscribed which in turn should be subscribing as the doc says
[18:15:19] adavia: tbuehlmann: well thats what i am trying to figure it out
[18:21:34] adavia: tbuehlmann: but then how would be the way to subscribe in a scenario like this?
[18:31:59] adavia: tbuehlmann: well that might work. Ill check how to stay DRY with it