« Back to channel list

#RubyOnRails - 05 July 2016

« Back 1 day Forward 1 day »
[00:00:22] hahuang61: has joined #RubyOnRails
[00:02:24] daveomcd: has joined #RubyOnRails
[00:03:07] macsteps: has joined #RubyOnRails
[00:06:22] TheMonster: has joined #RubyOnRails
[00:06:28] Oliphaunte: has joined #RubyOnRails
[00:06:44] DoubleMalt: has joined #RubyOnRails
[00:07:23] pyemkey: has joined #RubyOnRails
[00:07:39] der-landgraf: has joined #RubyOnRails
[00:07:47] Sashimi: has joined #RubyOnRails
[00:10:44] chipotle: has joined #RubyOnRails
[00:12:23] vedu: has joined #RubyOnRails
[00:14:46] roshanavand: has joined #RubyOnRails
[00:16:45] upsell5: has joined #RubyOnRails
[00:17:07] bauruine: has joined #RubyOnRails
[00:17:11] Kus: has joined #RubyOnRails
[00:17:14] kevr: has joined #RubyOnRails
[00:18:21] macsteps: has joined #RubyOnRails
[00:21:23] camonz: has joined #RubyOnRails
[00:22:56] camonz: so I got a list of points with an elevation and I want to store em on PostGIS, what's the best way to save the data, XYZ spheric point or X,Y with elevation?
[00:23:14] hive-mind: has joined #RubyOnRails
[00:24:21] Oliphaunte: has joined #RubyOnRails
[00:28:03] baash05: has joined #RubyOnRails
[00:28:11] hive-mind: has joined #RubyOnRails
[00:30:17] Rodya_: has joined #RubyOnRails
[00:32:32] Oliphaunte: has joined #RubyOnRails
[00:34:27] FCser: has joined #RubyOnRails
[00:34:46] asheinfeld: has joined #RubyOnRails
[00:35:06] zacts: has joined #RubyOnRails
[00:37:04] roamingdog: has joined #RubyOnRails
[00:40:38] lupine: well, what are you trying to do with the data?
[00:44:23] Ayey_: has joined #RubyOnRails
[00:48:40] Oliphaunte: has joined #RubyOnRails
[00:49:34] triptec: has joined #RubyOnRails
[00:54:58] blackmesa: has joined #RubyOnRails
[01:00:50] jenrzzz: has joined #RubyOnRails
[01:01:29] rhett: has joined #RubyOnRails
[01:02:34] daffy_duck_3: has joined #RubyOnRails
[01:02:42] chipotle: has joined #RubyOnRails
[01:08:34] quazimodo: has joined #RubyOnRails
[01:10:08] C0D3JUNKIE: has joined #RubyOnRails
[01:10:51] roamingdog: has joined #RubyOnRails
[01:14:53] chipotle_: has joined #RubyOnRails
[01:18:18] Rodya_: has joined #RubyOnRails
[01:21:38] pur3eval: can anyone help?? im getting this error and i dont know how to fix it: "Server was unable to process request. ---> The parameter 'addresses' cannot be an empty string.
[01:21:38] pur3eval: Parameter name: addresses"
[01:22:26] Rodya_: has joined #RubyOnRails
[01:23:13] der-landgraf: has joined #RubyOnRails
[01:29:50] chipotle: has joined #RubyOnRails
[01:30:01] fryguy: pur3eval: show some code
[01:30:05] eljimmy: has joined #RubyOnRails
[01:30:59] ekinmur: has joined #RubyOnRails
[01:33:38] roamingdog: has joined #RubyOnRails
[01:34:08] Oliphaunte: has joined #RubyOnRails
[01:35:22] dc4: has joined #RubyOnRails
[01:39:04] baash05: has joined #RubyOnRails
[01:39:32] superlou: has joined #RubyOnRails
[01:43:47] macsteps: has joined #RubyOnRails
[01:44:34] macsteps: has joined #RubyOnRails
[01:44:45] Ayey_: has joined #RubyOnRails
[01:51:36] benlieb: has joined #RubyOnRails
[01:53:13] PlasmaStar: has joined #RubyOnRails
[01:55:28] eljimador: has joined #RubyOnRails
[02:00:34] Ropeney: has joined #RubyOnRails
[02:01:08] roamingdog: has joined #RubyOnRails
[02:01:11] hahuang61: has joined #RubyOnRails
[02:01:24] rafaelfranca: has joined #RubyOnRails
[02:01:50] kevr: has joined #RubyOnRails
[02:01:53] roamingdog: has joined #RubyOnRails
[02:02:21] Rodya_: has joined #RubyOnRails
[02:04:22] benlieb: has joined #RubyOnRails
[02:12:14] blackmesa: has joined #RubyOnRails
[02:14:21] jishankai: has joined #RubyOnRails
[02:14:45] dc4: has joined #RubyOnRails
[02:16:44] macsteps: has joined #RubyOnRails
[02:17:40] Rodya_: has joined #RubyOnRails
[02:18:48] jenrzzz: has joined #RubyOnRails
[02:23:16] pontiki: has joined #RubyOnRails
[02:26:27] sevenseacat: has joined #RubyOnRails
[02:35:35] Rodya_: has joined #RubyOnRails
[02:38:25] Oliphaunte: has joined #RubyOnRails
[02:46:25] Ayey_: has joined #RubyOnRails
[02:48:05] pur3eval: fryguy: wsdl = @wsdl_link
[02:48:05] pur3eval: driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
[02:48:05] pur3eval: driver.getSellerRequest(
[02:48:05] pur3eval: :request_type => request_type,
[02:48:05] pur3eval: :seller_id => Session.car_id,
[02:48:06] pur3eval: :user_id => Session.user_id,
[02:48:06] pur3eval: :user_ip => request.env['REMOTE_ADDR'],
[02:48:06] pur3eval: :notify_email => seller.email
[02:48:20] pur3eval: ah. dunno how to make it in one line
[02:48:31] pontiki: pur3eval: !gist
[02:48:31] helpa: pur3eval: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[02:48:35] pur3eval: "Server was unable to process request. ---> The parameter 'addresses' cannot be an empty string.
[02:48:45] pur3eval: ah ok thanks
[02:50:23] pur3eval: https://gist.github.com/ivan-om/b103f8afd762e9be26cbe64ac8bb80be
[02:50:45] fryguy: pur3eval: gonna guess that your wsdl makes address required
[02:51:31] pur3eval: "addresses" is not in my wsdl anywhere.
[02:53:24] fryguy: show the stack trace
[02:54:30] roamingdog: has joined #RubyOnRails
[03:01:32] pur3eval: error.inspect shows the exception but error.backtrace is just blank?? this is going to iis when you call driver.getSellerRequest
[03:02:37] pur3eval: \n---------- error.inspect ----------\n #<SOAP::FaultError: Server was unable to process request. ---> The parameter 'addresses' cannot be an empty string.
[03:02:50] alfiemax: has joined #RubyOnRails
[03:03:10] Oliphaunte: has joined #RubyOnRails
[03:03:53] zacts: has joined #RubyOnRails
[03:04:26] chipotle: has joined #RubyOnRails
[03:05:18] zacts: has joined #RubyOnRails
[03:12:21] calmchaos: has joined #RubyOnRails
[03:13:03] blackmesa: has joined #RubyOnRails
[03:13:29] justrohu: has joined #RubyOnRails
[03:13:45] roamingdog: has joined #RubyOnRails
[03:16:07] fryguy: pur3eval: looks like a server side error
[03:16:20] fryguy: nothing to do directly with your ruby code
[03:16:27] fryguy: try reviewing the documenation for the api you are using
[03:17:58] pur3eval: yes i see that there may be an error with the server code. i am reviewing the code right now.
[03:18:53] xlegoman: has joined #RubyOnRails
[03:22:24] pur3eval: OUT or INOUT argument 1 for routine seller_staging.procGetSellRequestCount is not a variable or NEW pseudo-variable in BEFORE trigger
[03:27:16] eserror: has joined #RubyOnRails
[03:28:20] roamingdog: has joined #RubyOnRails
[03:41:56] Psyko: has joined #RubyOnRails
[03:46:10] chipotle: has joined #RubyOnRails
[03:46:49] Ayey_: has joined #RubyOnRails
[03:50:10] rafaelfranca: has joined #RubyOnRails
[03:50:22] pyemkey: has joined #RubyOnRails
[03:53:48] gwesley: has joined #RubyOnRails
[03:54:17] jgpawletko: has joined #RubyOnRails
[04:01:32] the_drow: has joined #RubyOnRails
[04:03:11] hahuang61: has joined #RubyOnRails
[04:03:32] rafaelfranca: has joined #RubyOnRails
[04:05:07] yfeldblum: has joined #RubyOnRails
[04:10:29] Rodya_: has joined #RubyOnRails
[04:15:04] blackmesa: has joined #RubyOnRails
[04:15:28] dminuoso: has joined #RubyOnRails
[04:17:20] kareeoleez: has joined #RubyOnRails
[04:17:26] kareeoleez: anyone please ? http://stackoverflow.com/questions/38178772/scheduling-with-clockwork-delayed-job-activejob-to-run-every-5-minutes-round
[04:21:02] PotatoChipz: has joined #RubyOnRails
[04:21:30] dionysus69: has joined #RubyOnRails
[04:29:11] Oliphaunte: has joined #RubyOnRails
[04:30:27] Rodya_: has joined #RubyOnRails
[04:31:30] pawnbox: has joined #RubyOnRails
[04:33:21] Devalo: has joined #RubyOnRails
[04:36:23] chopin: has joined #RubyOnRails
[04:38:18] chopin: has joined #RubyOnRails
[04:47:07] ur5us: has joined #RubyOnRails
[04:47:59] ur5us: has joined #RubyOnRails
[04:48:12] pvertenten: has joined #RubyOnRails
[04:49:35] alfiemax: has joined #RubyOnRails
[04:51:47] zacts: has joined #RubyOnRails
[04:54:17] pawnbox: has joined #RubyOnRails
[04:55:11] Psyko: hi im installing thredded, still new to rails and exploring, followed the instructions in thredded's github but i have this error, and i cant seem to find answers hope you guys can help me out thanks, heres the gist https://gist.github.com/anonymous/c2bf36bbeb984ec8462db1b9a176e54c
[04:56:33] zacts: has joined #RubyOnRails
[05:03:41] baash05: has joined #RubyOnRails
[05:08:56] mytrile: has joined #RubyOnRails
[05:11:13] pvertenten: has joined #RubyOnRails
[05:14:29] alfiemax: what am i doing wrong here : Event.last.reservations.where(request_status: :pending)
[05:14:55] alfiemax: request_status is defined as an enum in my reservation model
[05:14:56] alfiemax: enum request_status: [:pending, :cancelled, :accepted, :rejected]
[05:15:49] blackmesa: has joined #RubyOnRails
[05:16:56] sevenseacat: depends. whats going wrong?
[05:18:11] roelof: has joined #RubyOnRails
[05:18:42] hahuang61: has joined #RubyOnRails
[05:18:46] roelof: how can I make the message of name be included in the json output of the create function : https://gist.github.com/rwobben/df949f502ed4bec009dc573d5b5dd76a
[05:18:55] l4v2: has joined #RubyOnRails
[05:19:19] alfiemax: sevenseacat, this is the query fired
[05:19:20] alfiemax: Reservation Load (0.4ms) SELECT "reservations".* FROM "reservations" WHERE "reservations"."event_id" = $1 AND "reservations"."request_status" = $2 [["event_id", 4], ["request_status", nil]]
[05:19:35] alfiemax: specifically, ["request_status", nil]
[05:19:43] JoshGlzBrk: has joined #RubyOnRails
[05:20:14] zacts: has joined #RubyOnRails
[05:20:17] alfiemax: i believe i'm doing correctly as per the rails docs regarding active record enum
[05:20:23] sevenseacat: right, this is important information when asking a question :)
[05:20:44] alfiemax: sorry, i got caught up and couldn't complete the question
[05:21:04] sevenseacat: if you want to use a `where` like that, I believe you need to get the ordinal of the enum option, ie. where(request_status: request_statuses[:pending])
[05:21:10] sevenseacat: or you can just use the `pending` scope
[05:21:23] alfiemax: pending scope??
[05:21:26] alfiemax: its default?
[05:21:41] sevenseacat: Rails adds a scope for each value in the enum
[05:21:48] alfiemax: damn,... i missed that
[05:21:49] sevenseacat: so you can do something like Reservation.pending
[05:23:42] Oliphaunte: has joined #RubyOnRails
[05:24:45] alfiemax: sevenseacat, one more question
[05:24:55] alfiemax: can i use a scope in a has_many relation?
[05:25:01] rvanlieshout: has joined #RubyOnRails
[05:25:15] sevenseacat: try it and see
[05:26:02] alfiemax: but i have no clue how to change this to use a scope
[05:26:03] alfiemax: has_many :accepted_reserved_guests, -> { where(reservations: { request_status: 2 }) }, through: :reservations, source: :guest
[05:26:34] sevenseacat: ok, thats a much better question
[05:27:07] sevenseacat: you may want to merge the association with the scope, ie. -> { merge(Reservation.pending) }
[05:27:34] sevenseacat: or Reservation.accepted
[05:28:26] alfiemax: awesome.. :)
[05:28:33] alfiemax: that's cool
[05:28:35] alfiemax: thanks alot
[05:28:49] alfiemax: any way i can use OR there ?
[05:28:58] pawnbox: has joined #RubyOnRails
[05:29:05] alfiemax: like accepted or pending?
[05:29:26] sevenseacat: you may want to write a custom scope on the Reservatioon model, and merge with that
[05:29:43] alfiemax: ok, that works
[05:30:13] pvertenten_: has joined #RubyOnRails
[05:31:53] siaw23: has joined #RubyOnRails
[05:34:02] JoshGlzBrk: has joined #RubyOnRails
[05:39:13] cgfbee: has joined #RubyOnRails
[05:41:48] conta: has joined #RubyOnRails
[05:42:38] pawnbox: has joined #RubyOnRails
[05:47:45] roelof: how can I make the message of name be included in the json output of the create function : https://gist.github.com/rwobben/df949f502ed4bec009dc573d5b5dd76a
[05:48:31] Ayey_: has joined #RubyOnRails
[05:49:15] dminuoso: has joined #RubyOnRails
[05:49:21] roelof: I thought this could work : render json: {{ errors: @account.errors},{messages: @account.messages}} status: 422 but I see then a error message on the , part
[05:52:03] spion: has joined #RubyOnRails
[05:55:16] arBmind: has joined #RubyOnRails
[05:55:17] alfiemax: roelof, you don't have a key
[05:56:29] alfiemax: it should be like :
[05:56:30] alfiemax: render json: { errors: @account.errors, messages: @account.messages, status: 422}
[05:56:47] User458764: has joined #RubyOnRails
[05:57:20] User458764: has joined #RubyOnRails
[05:59:57] pawnbox: has joined #RubyOnRails
[06:00:13] xlegoman: has joined #RubyOnRails
[06:00:30] Macaveli: has joined #RubyOnRails
[06:03:25] Sashimi: has joined #RubyOnRails
[06:04:19] yardenbar: has joined #RubyOnRails
[06:04:29] roelof: alfiemax: thanks, still a problem : "#<NoMethodError: undefined method `message' for #<Account:0x00000004459828>>",
[06:04:50] roelof: I try to include this : validates :name, format: {with: /[a-zA-Z]/, message: 'Ongeldige invoer\n'}
[06:06:32] triptec: has joined #RubyOnRails
[06:07:30] the_drow: has joined #RubyOnRails
[06:08:47] sevenseacat: seems straightforward
[06:10:23] roelof: oke, then I think I have to go back to the first grade. I do not see it
[06:11:07] duncannz: has joined #RubyOnRails
[06:11:48] srinidhi: has joined #RubyOnRails
[06:14:40] sevenseacat: roelof: so what's the full error? you've been asked that enough times now
[06:15:32] roelof: sorry: full error : "#<NameError: undefined local variable or method `message' for #<AccountController:0x00000004b6e578>>",
[06:15:52] roelof: so message is not known in the controller. only in the model.
[06:16:12] roelof: maybe make a @message in the model
[06:16:21] sevenseacat: thats not the full error, with backtrace.
[06:16:34] sevenseacat: roelof: !debug
[06:16:34] helpa: roelof: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[06:17:44] roelof: sevenseacat: moment, I can find it on the output of postman
[06:17:59] sevenseacat: postman has nothing to do with an error in a rails controller
[06:18:34] roelof: I think you are looking for something like this : https://gist.github.com/rwobben/d3aebe5f3c1fde93d37877de3f6678c9
[06:18:35] blackmesa: has joined #RubyOnRails
[06:18:35] aganov: has joined #RubyOnRails
[06:20:04] roelof: rails did not provide a backtrace
[06:20:07] sevenseacat: roelof: so how would you actually debug the error, given that backtrace?
[06:20:41] jenrzzz: has joined #RubyOnRails
[06:20:41] jenrzzz: has joined #RubyOnRails
[06:21:08] roelof: I would look into the controller, the first sentence says there is the error
[06:21:34] roelof: and this : "#<NameError: undefined local variable or method `message' fo says message cannot be found
[06:21:39] meinside: has joined #RubyOnRails
[06:21:49] roelof: I know where the error is, only not how to solve it
[06:24:01] sevenseacat: no, what is on the line of the error message
[06:24:18] sevenseacat: you don't know where the error message is, because making a @message has nothing to do with it
[06:24:18] emilkarl: has joined #RubyOnRails
[06:24:46] roelof: the error is in this line : render json: { errors: @account.errors, messages: message, status: 422}
[06:24:57] roelof: and there message is not known
[06:25:50] sevenseacat: so what do you expect that code to do?
[06:26:01] roelof: I try to make messsage to have the content of the message of this line : validates :name, format: {with: /[a-zA-Z]/, message: 'Ongeldige invoer\n'}
[06:26:49] dminuoso: has joined #RubyOnRails
[06:26:52] roelof: so that if someone enters something like this <script> . the message "not valid input" is shown on the json output
[06:28:49] roelof: I mean if someone enters <script> .... </script> on the name part , the message is shown on the json output
[06:29:11] sevenseacat: so what makes that message special, why is it separate from all the other errors?
[06:30:13] roelof: because it's a custom validating error that I provide
[06:30:23] der-landgraf: has joined #RubyOnRails
[06:30:43] roelof: Otherwise there is no validating error , or the regex is not working well :(
[06:34:25] zacts: has joined #RubyOnRails
[06:35:19] der-landgraf: has joined #RubyOnRails
[06:35:52] dminuoso: roelof: Don't use <script> tags. The few justifications to have them are exotic enough to ignore them.
[06:37:50] asif8q: has joined #RubyOnRails
[06:38:36] roelof: dminuoso: Im not using them. I try to make it work that the name part only can contain a string and nothing else
[06:38:57] roelof: that is why I use the regex [a-zA-Z]
[06:40:25] Devalo: has joined #RubyOnRails
[06:41:38] roelof: but I think I took a dead end road
[06:42:54] alfiemax: any way to generate random alpha numeric password using secure random?
[06:43:53] alfiemax: i think hex can be used
[06:44:04] triptec_: has joined #RubyOnRails
[06:44:05] sevenseacat: go for it then.
[06:45:08] roelof: Is there a way I can validate input on a json api so it accepts only strings. not list or hashes ?
[06:46:41] mytrile: roelof: what about adding JSON schema and validate it with something like https://github.com/ruby-json-schema/json-schema
[06:48:36] pawnbox_: has joined #RubyOnRails
[06:49:08] roelof: mytrile: that could also be a solution. I will experiment with that
[06:49:09] etiago: has joined #RubyOnRails
[06:49:36] Ayey_: has joined #RubyOnRails
[06:51:50] dionysus69: has joined #RubyOnRails
[06:54:15] ur5us: has joined #RubyOnRails
[06:54:16] dminuoso: has joined #RubyOnRails
[06:59:13] Pazician: has joined #RubyOnRails
[07:00:35] jenrzzz: has joined #RubyOnRails
[07:03:08] brazenbraden: has joined #RubyOnRails
[07:08:27] alevy: has joined #RubyOnRails
[07:09:11] mark_66: has joined #RubyOnRails
[07:10:41] calmchaos: has joined #RubyOnRails
[07:11:31] darutoko: has joined #RubyOnRails
[07:11:38] Oliphaunte: has joined #RubyOnRails
[07:11:46] calmchaos: has joined #RubyOnRails
[07:13:58] pawnbox: has joined #RubyOnRails
[07:14:27] calmchaos: has joined #RubyOnRails
[07:14:49] helpa: has joined #RubyOnRails
[07:16:34] mattp_: has joined #RubyOnRails
[07:18:01] calmchaos: has joined #RubyOnRails
[07:18:39] skyjumper: has joined #RubyOnRails
[07:18:42] Coldblackice_: has joined #RubyOnRails
[07:19:05] calmchaos: has joined #RubyOnRails
[07:19:14] Ikri: has joined #RubyOnRails
[07:19:22] blackmesa: has joined #RubyOnRails
[07:19:52] Paradox: has joined #RubyOnRails
[07:20:09] alfiemax: has joined #RubyOnRails
[07:20:14] calmchaos: has joined #RubyOnRails
[07:20:59] AmiMoench: has joined #RubyOnRails
[07:21:17] calmchaos: has joined #RubyOnRails
[07:21:26] triptec: has joined #RubyOnRails
[07:21:30] deecross: has joined #RubyOnRails
[07:22:22] baweaver: has joined #RubyOnRails
[07:22:26] calmchaos: has joined #RubyOnRails
[07:22:44] brainslug: has joined #RubyOnRails
[07:23:26] eya: has joined #RubyOnRails
[07:24:44] calmchaos: has joined #RubyOnRails
[07:25:43] Thai_: has joined #RubyOnRails
[07:25:50] calmchaos: has joined #RubyOnRails
[07:25:52] ianconnolly: has joined #RubyOnRails
[07:27:29] finnnnnnnnnnn: has joined #RubyOnRails
[07:28:10] antgel: has joined #RubyOnRails
[07:30:09] jkprg_: has joined #RubyOnRails
[07:31:48] hahuang61: has joined #RubyOnRails
[07:33:09] blackmesa: has joined #RubyOnRails
[07:34:37] quazimodo: has joined #RubyOnRails
[07:37:48] camonz: has joined #RubyOnRails
[07:40:32] deecross: has joined #RubyOnRails
[07:44:57] ngw: has joined #RubyOnRails
[07:45:52] Hyuk: has joined #RubyOnRails
[07:49:39] calmchaos: has joined #RubyOnRails
[07:53:47] dc4: has joined #RubyOnRails
[07:57:19] marr: has joined #RubyOnRails
[07:58:03] roshanavand: has joined #RubyOnRails
[07:58:05] baash05: Question.. I want to make records in a given table immutable.. Updating a record will not result in an update but instead create a new record..
[07:58:31] rvanlieshout: baash05: you want to keep history of those records?
[07:58:31] baash05: Acutally I just answered my own question. :)
[07:58:43] rvanlieshout: you might want to look at paper_trail
[07:58:50] rvanlieshout: although it does edit the record
[07:59:09] baash05: can't query papertrail.. if the old record is requested.
[07:59:59] baash05: Really.. I didn't know it could be accessed through active record.
[08:00:29] rvanlieshout: you can reify a version-entry
[08:00:49] baash05: so User.where(slug: 'dave', version: 23).first
[08:00:53] baash05: that would work?
[08:01:22] rvanlieshout: not exactly that
[08:01:54] baash05: I was stoked... Now not so much :)
[08:03:17] zel: has joined #RubyOnRails
[08:03:57] artto: has joined #RubyOnRails
[08:03:58] flopsec: has joined #RubyOnRails
[08:04:41] baash05: I think I have a way to do it though. In the before_save method I'm going to clone the record that's in the db, and save the current record with version = where(name: name).count and the new data.
[08:06:23] baash05: I might have to override the update_attributes method to accomplish this.. because I'm not sure the before_save method would do the job.
[08:07:03] tvw: has joined #RubyOnRails
[08:07:09] jkprg: has joined #RubyOnRails
[08:08:48] rvanlieshout: what's wrong with having it in a separate table
[08:08:54] rvanlieshout: and just use a different query method?
[08:10:40] rvanlieshout: it would also make querying for current versions easier
[08:11:48] calmchaos: has joined #RubyOnRails
[08:17:07] the_drow: has joined #RubyOnRails
[08:19:38] emilkarl: has joined #RubyOnRails
[08:20:22] snowy: has joined #RubyOnRails
[08:20:30] jenrzzz: has joined #RubyOnRails
[08:25:50] artto: has joined #RubyOnRails
[08:26:15] der-landgraf: has joined #RubyOnRails
[08:26:57] alfiemax: has joined #RubyOnRails
[08:31:33] Ergo: has joined #RubyOnRails
[08:33:01] calmchaos: has joined #RubyOnRails
[08:37:13] roshanavand: has joined #RubyOnRails
[08:37:25] pyemkey: has joined #RubyOnRails
[08:39:46] upsell5: has joined #RubyOnRails
[08:44:13] phredus_: has joined #RubyOnRails
[08:44:45] kitsuneyo: has joined #RubyOnRails
[08:45:47] phredus: has joined #RubyOnRails
[08:50:10] eya: has joined #RubyOnRails
[08:51:02] nettoweb: has joined #RubyOnRails
[08:51:14] morfin: has joined #RubyOnRails
[08:51:20] Ayey_: has joined #RubyOnRails
[08:53:55] jxs_: has joined #RubyOnRails
[08:55:20] Silthias: has joined #RubyOnRails
[08:57:33] the_drow: has joined #RubyOnRails
[08:59:19] AimlessRAven: has joined #RubyOnRails
[08:59:38] AimlessRAven: = "#{@post.likes.count} Users like this post" how to pluralize this when 1 user like to show User, when more or 0 to show users
[08:59:39] Oliphaunte: has joined #RubyOnRails
[09:00:34] dminuoso: AimlessRaven: Have you even bothered to google "rails pluralize" ?
[09:00:45] dminuoso: If not, this is me telling you to google.
[09:01:01] Davey: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[09:03:11] morfin: i guess DI in Rails is not usable?
[09:03:37] jhass: I wish pluralize wasn't a thing and people had to use i18n's pluralization support...
[09:04:20] dminuoso: jhass: Don't utter i18n while he or she is around, it might do more harm than good.
[09:05:25] arup_r: has joined #RubyOnRails
[09:05:38] Silthias: Morning Guys, I'm still at the beginning stages or learning rails and trying to build a system up that lets me upload a CSV and insert it into a model after some data manipulation. Don't suppose anyone knows of a decent tutorial or guide that would be a good starting point for working from do they? I have the base models setup for creation via the interface and filling in the fields, but not sure how to link that into a csv impor
[09:06:03] finnnnnnnnnnn: i18n's pluralization support - I had no idea. That’s awseom
[09:06:13] finnnnnnnnnnn: (better than my spelling)
[09:06:46] finnnnnnnnnnn: Silthias: there’s a railscast on working with csvs
[09:07:08] finnnnnnnnnnn: railscasts.com/episodes/362-exporting-csv-and-excel
[09:07:08] finnnnnnnnnnn: and railscasts.com/episodes/396-importing-csv-and-excel
[09:07:17] Silthias: cool, I'll have a look. Thanks
[09:07:20] finnnnnnnnnnn: maybe a little dated but it may help
[09:07:33] Silthias: It's a starting point atleast, cheers
[09:07:43] cgfbee: has joined #RubyOnRails
[09:08:00] jhass: dminuoso: btw little tip: https://en.wikipedia.org/wiki/Singular_they ;)
[09:08:23] yfeldblum: has joined #RubyOnRails
[09:09:34] zarubin: has joined #RubyOnRails
[09:09:44] Circuit8: has joined #RubyOnRails
[09:11:15] blackhuey: has joined #RubyOnRails
[09:11:40] dminuoso: jhass: Interesting.
[09:11:50] artto: has joined #RubyOnRails
[09:12:52] jhass: it gets natural pretty fast, I hardly think about it anymore
[09:13:46] arBmind: has joined #RubyOnRails
[09:16:14] fenn1: has joined #RubyOnRails
[09:18:04] dminuoso: jhass: See I much prefer gender neutral pronouns are handled in German literature. A simple introductionary remark that for simplicity "he" shall be used, without any gender-specific meaning.
[09:18:39] dminuoso: Rather than trying to come up with an alternative pronoun when there should not be gender specific pronouns in the first place.
[09:19:34] dminuoso: It is surprising that this usage of "they" was not covered in English class back in school.
[09:19:52] jhass: ah I disagree but we get too offtopic, would love to see you in one of the offtopic channels ;)
[09:19:52] fenn1: I have a question about jbuilder: is it possible to have an array with a partial inside of a partial? Because the generated json seems to take into account only the second partial call
[09:20:21] pawnbox: has joined #RubyOnRails
[09:24:17] fenn1: here is a pastie that explains my problem: http://pastie.org/10899195, there is no department name is the json
[09:26:02] finnnnnnnnnnn: what’s the best way to shallow copy a hash?
[09:26:25] finnnnnnnnnnn: (doesn’t have to be “the best way”)
[09:27:00] dminuoso: finnnnnnnnnnn: dup/clone
[09:27:20] finnnnnnnnnnn: dminuoso: cool, thanks
[09:27:33] dminuoso: finnnnnnnnnnn: Note that this applies to any object (that hasn't somehow overridden these methods)
[09:28:47] jhass: dminuoso: no chance? ;)
[09:30:47] naftilos76: has joined #RubyOnRails
[09:31:40] mark_66: has joined #RubyOnRails
[09:33:21] pawnbox: has joined #RubyOnRails
[09:35:03] Sashimi: has joined #RubyOnRails
[09:35:57] artto_: has joined #RubyOnRails
[09:36:35] srinidhi: has joined #RubyOnRails
[09:40:17] artto: has joined #RubyOnRails
[09:40:38] jsrn: has joined #RubyOnRails
[09:41:13] calmchaos: has joined #RubyOnRails
[09:41:50] binaryplease1: has joined #RubyOnRails
[09:43:57] fenn1: nevermind, found the problem, there was no key name for the json.array!
[09:45:32] Devalo: has joined #RubyOnRails
[09:46:00] Pazician: has joined #RubyOnRails
[09:46:41] alfiemax: i'm building an api app and i would like to have the integer values of enums used to be passed as the json response
[09:46:46] alfiemax: i.e by default
[09:47:15] alfiemax: will i have to manually get the integer value and pass it in?
[09:47:35] alfiemax: because by default as_json method passes the string value
[09:48:12] bruce_lee: has joined #RubyOnRails
[09:48:34] rvanlieshout: why would want to communicate the integer values?
[09:48:42] blackmesa: has joined #RubyOnRails
[09:48:43] lexileo: has joined #RubyOnRails
[09:48:44] rvanlieshout: and if so, why are you even using an enum then?
[09:49:11] alfiemax: because the ios dev team wants me to give then the integer value, so that they don't have to do string comparison
[09:49:30] alfiemax: i'm using enum so that i don't have to store string in the db
[09:49:43] jkprg: has joined #RubyOnRails
[09:50:42] pawnbox: has joined #RubyOnRails
[09:52:23] Ayey_: has joined #RubyOnRails
[09:53:21] xcesariox: has joined #RubyOnRails
[09:54:07] sevenseacat: so they would just have to convert the integers back to a string representation anyway
[09:54:08] Oliphaunte: has joined #RubyOnRails
[09:54:14] sevenseacat: which means there's a chance of them getting out of sync
[09:54:22] xpl0iter: has joined #RubyOnRails
[09:54:26] sevenseacat: if their strings are different from your strings
[09:54:38] sevenseacat: not a good idea
[09:54:50] xpl0iter: Hi Ij my rails app, when I click on the submit button(which uses ajax), it is posting twice. So I guess I have included some js file twice in this. Is there anyway I can find out which one is causing the problem?
[09:54:57] alfiemax: so, what should i tell them?
[09:55:05] artto: has joined #RubyOnRails
[09:55:16] rvanlieshout: xpl0iter: added the click event twice?
[09:55:18] sevenseacat: whatever you want
[09:55:18] alfiemax: that it's not a good idea because there is a chance of error ?
[09:55:25] sevenseacat: they're your team
[09:56:41] xpl0iter: rvanlieshout, I don't see it. :( But the funny part is, if I click on it after a page reload, it only posts once. But then I click on any other page(I use will_paginate) to goto next page(page 2) and then click on this submit button, its getting posted twice
[09:56:43] alfiemax: actually not .. :) the ios dev has been outsourced
[09:57:46] jkprg: has joined #RubyOnRails
[09:57:53] jgt: has joined #RubyOnRails
[09:58:35] dminuoso: xpl0iter: Are you using turbolinks?
[09:59:03] dminuoso: xpl0iter: Also, please gist your related javascript assets.
[09:59:27] xpl0iter: dminuoso, yes I am using turbolinks
[09:59:45] dminuoso: xpl0iter: Do you know exactly what you are doing?
[09:59:58] ferr: has joined #RubyOnRails
[10:00:05] xpl0iter: dminuoso, turbolinks came with the rails them I purchased, so no.. :(
[10:00:10] dminuoso: xpl0iter: Turn it off.
[10:00:31] dminuoso: If you dont understand it and do anything non-trivial with events, you need to know exactly what you are doing.
[10:00:32] xpl0iter: dminuoso, Ok, let em try. Thanks.
[10:00:37] dminuoso: And keep it off.
[10:01:07] dminuoso: I estimate a 87,4% chance that it will "magically" solve your problem.
[10:01:17] xpl0iter: dminuoso, Because if came with the theme, I thought it might be something related to to the effects and stuff.
[10:01:44] xpl0iter: dminuoso, :D good enough. Thanks. I think there will be many things, I need to turn off before proceeding further then.
[10:01:47] alebatt: has joined #RubyOnRails
[10:02:27] alebatt: Did someone already use a gem like mongoid-tree or ancestor ?
[10:02:39] dminuoso: xpl0iter: Turbolinks is an absolutely amazing feature, don't get me wrong. But it completely changes the way the DOM behaves or even what events fired under what circumstances - so you really need to understand it in order to not fall into traps.
[10:04:22] xpl0iter: dminuoso, ok thanks a lot. Its working now. Really appreciate it. I will read more about it and see. Thanks for the tip.
[10:04:42] dminuoso: Where is my cookie?
[10:07:34] finnnnnnnnnnn_: has joined #RubyOnRails
[10:08:33] Palsson: has joined #RubyOnRails
[10:08:48] flashpoi_: has joined #RubyOnRails
[10:09:56] dminuoso: sevenseacat: We should have a bot that automatically detects JavaScript related questions and automatically replies with a "Have you turned off turbolinks?" question. :o)
[10:10:33] workmad3: has joined #RubyOnRails
[10:12:58] artto_: has joined #RubyOnRails
[10:13:45] xpl0iter: dminuoso, sorry. Here is your cookie: http://www.cookiesociety.com/choc-cookie.png. Seriously though, thanks a lot.
[10:15:09] andromedian: has joined #RubyOnRails
[10:15:16] xcesariox: sevenseacat : ain't there a BOT in here?
[10:15:28] Jasaka|NA: has joined #RubyOnRails
[10:15:30] helpa: Nom nom. Thanks, sevenseacat!
[10:15:44] jhass: dminuoso: https://github.com/radar/railsbot/compare
[10:15:53] andromedian: I have a link inside a view and I want to show this link in specific pages what method shall I use?
[10:16:14] xcesariox: sevenseacat : it doesn't reply to my command.
[10:16:22] xcesariox: sevenseacat : only you have access to it?
[10:16:27] sevenseacat: you do not have bot access.
[10:16:38] xcesariox: sevenseacat : i thought so too.
[10:16:59] xcesariox: sevenseacat : then what can the public do with the BOT without having access?
[10:17:12] arup_r: if I upload all my images and docs to s3 using carrierwave and fog, all works. But the url from s3 looks like a mess, can I alias the url to something else? What settings or things I need to read up for this?
[10:17:17] cgfbee: has joined #RubyOnRails
[10:18:18] jhass: andromedian: only add the link to those specific pages?
[10:18:58] andromedian: jhass, but let's say that this view is rendered in application.html.erb
[10:19:23] andromedian: which is called everywhere and inside that view I want the link to be shown only on 10pages out of 100
[10:19:35] jhass: well then it probably shouldn't be there
[10:19:36] andromedian: is there an easy way to do that or what is the recommended way
[10:19:46] kareeoleez: has joined #RubyOnRails
[10:19:50] jhass: you might want yield(:foo) and content_for(:foo)
[10:20:05] Hyuk: has joined #RubyOnRails
[10:21:23] jhass: andromedian: but solutions like if current_page?(...) can be sensible in rare situations. Or there might be other conditions like user_signed_in? usable, it's all too vague to give a real recommendation
[10:21:48] andromedian: Cool thanks again
[10:26:40] lxsameer: has joined #RubyOnRails
[10:26:46] artto: has joined #RubyOnRails
[10:26:47] njero: has joined #RubyOnRails
[10:30:22] artto: has joined #RubyOnRails
[10:31:26] sarink: has joined #RubyOnRails
[10:32:24] diegoviola: has joined #RubyOnRails
[10:33:20] nettoweb: has joined #RubyOnRails
[10:35:24] artto: has joined #RubyOnRails
[10:37:29] artto_: has joined #RubyOnRails
[10:37:32] andywww: has joined #RubyOnRails
[10:37:46] jgt: has joined #RubyOnRails
[10:38:14] andywww: i find myself building arrays to pass back a lot, is there a more elegant way of building this than what i have here?
[10:38:15] andywww: https://gist.github.com/anonymous/6093095b3a429ff025ddacf59c0e30a5
[10:38:47] dminuoso: andywww: Not without seeing the entire class
[10:39:11] srinidhi: has joined #RubyOnRails
[10:39:26] andywww: https://gist.github.com/anonymous/8d3c02a7c2494447de7d07bf9d43598a
[10:39:32] andywww: i’ve not written the methods yet
[10:39:41] andywww: but its more the:
[10:39:50] andywww: ret = []; return ret
[10:40:02] dminuoso: andywww: I still dont see how tweet_contains_vimeo_links for example works.
[10:40:15] andywww: i’ve not written the methods yet
[10:40:28] andywww: but i mean the building and returning of the array
[10:40:37] dminuoso: andywww: Look at all these tweet_containts_XYZ and try to extract a common pattern.
[10:40:45] sevenseacat: i would presume that video_links would just return an empty array if there are none
[10:40:53] sevenseacat: removing the need for the conditional
[10:41:17] andywww: that could work
[10:41:37] DaniG2k: has joined #RubyOnRails
[10:41:40] sevenseacat: [video_links, whatever_links, blah, blah].flatten
[10:42:19] DaniG2k: does anyone know how to change the default semanticui font? I'm using the semantic-ui-sass gem and would just like to edit the defaults but cannot seem to understand how
[10:43:15] andywww: thats tidier yeah, thanks
[10:43:29] ur5us: has joined #RubyOnRails
[10:44:55] dtzuzu: has joined #RubyOnRails
[10:45:18] andywww: has left #RubyOnRails: ()
[10:45:21] sevenseacat: DaniG2k: define your own after importing semantic-ui, because it doesnt let you specify one
[10:45:28] sevenseacat: it doesnt include the theming support of the original library
[10:45:34] sevenseacat: https://github.com/doabit/semantic-ui-sass/blob/master/app/assets/stylesheets/semantic-ui/globals/_site.scss
[10:45:51] jhass: btw .flatten is rarely what you actually want, most people think of .flatten(1) or [*a, *b, *c] rather
[10:46:12] raz: has anyone had any success with vcr + webmock + excon? i'm travelling various github issues and am just wtf'ing that this still seems to be unfixed (with excon being one of the most popular http libraries :/ )
[10:46:18] sevenseacat: jhass: right, even better :)
[10:46:34] DaniG2k: sevenseacat: ah right so pure css overwrite
[10:46:35] sevenseacat: what is 'this'?
[10:46:42] DaniG2k: that's not very nice :(
[10:46:51] raz: sevenseacat: it's not recording cassettes for me. are you saying it just works for you?
[10:47:21] sevenseacat: raz: you may have to be more specific about your problem
[10:47:25] raz: sevenseacat: could you kindly share me your output of 'gem list excon vcr webmock'? :)
[10:47:27] sevenseacat: ie. code, gem versions, etc.
[10:48:16] raz: sevenseacat: all gems on the latest version. VCR configured via config.hook_into :excon - nothing special really. but it simply doesn't record cassettes. there are various github issues documenting this problem as well.
[10:48:44] RedNifre: has joined #RubyOnRails
[10:48:54] dminuoso: Why is tab completion into rails classes so unbelievably slow? Is it triggering the autoloading mechanism somehow, causing it to load my rails application every time?
[10:48:59] dminuoso: With pry I mean.
[10:49:01] sevenseacat: that doesnt really answer the question
[10:49:18] raz: sevenseacat: pardon hook_into :webmock above (been trying various things)
[10:49:36] raz: sevenseacat: what question you mean?
[10:49:52] sevenseacat: you need to provide debugging information of your problem
[10:49:54] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[10:50:13] M-shine: has joined #RubyOnRails
[10:51:01] raz: ok sorry
[10:51:30] raz: so, vcr recognizes the excon requests, logs '[excon] Identified request type (recordable) for [get ...' - but does not actually record anything (no yml file is created)
[10:52:21] raz: that is with hook_into :excon
[10:52:30] raz: with hook_into: webmock - it doesn't seem to even recognize the requests at all
[10:52:47] artto: has joined #RubyOnRails
[10:52:47] sevenseacat: fantastic. can we see any part of your code and gem versions now?
[10:53:44] Ayey_: has joined #RubyOnRails
[10:54:08] raz: webmock (2.1.0), vcr (3.0.3), excon (0.50.1)
[10:55:00] nettoweb: has joined #RubyOnRails
[10:55:55] AimlessRAven: has joined #RubyOnRails
[10:56:01] AimlessRAven: how to define variable in partial
[10:57:30] AimlessRAven: and check if partial locals exist variable
[10:57:32] AimlessRAven: to hide 1 filed
[10:57:35] AimlessRAven: if not to show it
[10:59:26] jhass: AimlessRaven: in the partial do <% hide_foo_field ||= false %> ... <% if hide_foo_field %>. When you render the template do render "foo", locals: {hide_foo_field: true}
[10:59:45] jhass: well, unless hide_foo_field rather I guess
[11:00:03] roelof: has joined #RubyOnRails
[11:01:05] roelof: if I make a json validation scheme like this ; https://github.com/ruby-json-schema/json-schema what is the right place to put it.
[11:01:25] roelof: In the model or a helper function or in support ?
[11:04:44] emilkarl: has joined #RubyOnRails
[11:05:32] deecross: has joined #RubyOnRails
[11:05:55] AimlessRAven: jhass: tnx is your suggestion is liek some_local = default_value if local_assigns[:some_local].nil?
[11:06:16] jhass: AimlessRaven: no, my suggestion is what I wrote
[11:06:30] AimlessRAven: but how to do it with this pattern
[11:06:30] AimlessRAven: some_local = default_value if local_assigns[:some_local].nil?
[11:06:43] jhass: I find that pattern ugly and see no reason for it
[11:07:01] GodFather: has joined #RubyOnRails
[11:07:04] jhass: a simple ||= does it
[11:07:15] AimlessRAven: yes but my boss whant it with this pattern
[11:07:24] AimlessRAven: just tell me for example how would be looks like with it
[11:07:36] jhass: ask your boss then
[11:07:54] jhass: I'm not here to make the convoluted ideas of your boss work
[11:08:01] AimlessRAven: jhass: oks men
[11:08:21] PotatoChipz: has joined #RubyOnRails
[11:09:40] AzaToth: has joined #RubyOnRails
[11:11:36] xpl0iter: So I have edit action(using ajax). After editing, when I hover over the paginate links, it has the id of the edited resource appended to it. Can someone please give me a clue on why this happens?
[11:12:01] sevenseacat: xpl0iter: let us get our crystal balls
[11:12:24] jhass: mine says your death grandgrandmother is bored and edits them in
[11:12:41] sevenseacat: xpl0iter: seriously, you have to give us *something*
[11:13:48] xpl0iter: sevenseacat, lol, sorry. this is my edit and update actions: http://pastie.org/private/rgxob1s96bsb8l1wffq
[11:14:10] sevenseacat: thats got nothing to do with links in views
[11:15:17] xpl0iter: sevenseacat, I am using will_paginate. This is the view: http://pastie.org/private/t2ew5gl5ogvtsiy9ywoq
[11:15:45] sevenseacat: and what HTML does that generate?
[11:16:12] rodfersou: has joined #RubyOnRails
[11:17:11] xpl0iter: sevenseacat, http://pastie.org/private/1ndvwllsu5xulfdoof6g
[11:17:42] sevenseacat: now, what do you say appears on hover?
[11:17:44] xpl0iter: sevenseacat, this only happens after I edit something. I am using ajax for editing and updating the view
[11:17:57] sevenseacat: uh... what does editing have to do with pagination
[11:18:15] sevenseacat: and what does editing do to the links?
[11:18:39] xpl0iter: sevenseacat, before editing the links are: http://127.0.0.1:3000/segments?page=2. But after editing and the view updation, its like this: http://127.0.0.1:3000/segments/5e6d1ebd-9615-487f-a190-6b03c8fb2b41?page=2
[11:18:45] sevenseacat: its like layers, we'll get to the problem eventually
[11:19:23] sarink: has joined #RubyOnRails
[11:19:23] sevenseacat: so what code do you have changing the links?
[11:20:09] GodFather: has joined #RubyOnRails
[11:20:46] xpl0iter: line 9 in http://pastie.org/private/rgxob1s96bsb8l1wffq
[11:21:01] sevenseacat: thats not setting links
[11:21:19] finnnnnnnnnnn: has joined #RubyOnRails
[11:21:24] sevenseacat: what does your update action do? does it render a view? does it execute some js?
[11:22:01] jenrzzz: has joined #RubyOnRails
[11:22:27] xpl0iter: sevenseacat, Its executes js to render a partial. The partial is this: http://pastie.org/private/waw20klormp4fygozpuyw
[11:23:17] sevenseacat: right, so will_paginate works by appending `page` params to the current URL, and the URL for your update action looks like /segments/whatever
[11:25:09] sevenseacat: you need to customize the call to will_paginate to specify what URL should be used on the links https://github.com/mislav/will_paginate/wiki/API-documentation
[11:26:00] jhass: namely the params parameter from the looks of it
[11:26:08] xpl0iter: sevenseacat, thats super helpful. Thanks for pin pointing the issue.
[11:26:22] kitsuneyo: has joined #RubyOnRails
[11:26:25] sevenseacat: we got there in the end!
[11:26:31] JamieD: has joined #RubyOnRails
[11:26:57] xpl0iter: yes :) Really appreciate it.
[11:28:00] pvertenten: has joined #RubyOnRails
[11:32:41] roelof: if I make a json validation scheme like this ; https://github.com/ruby-json-schema/json-schema what is the right place to put it.
[11:36:52] jhass: roelof: it depends on where/how you use it, how you define it and in either case I haven't observed a real community standard yet
[11:37:17] Pumukel: has joined #RubyOnRails
[11:39:13] roelof: I want to use it as a validation for a create action. so instead of using user.save I want to use JSON::Validator.validate so I can check if the json input is only contains what I want to contain
[11:39:21] roelof: jhass ^^^
[11:40:31] Velizar: has joined #RubyOnRails
[11:41:38] artto: has joined #RubyOnRails
[11:41:38] jgt: has joined #RubyOnRails
[11:41:47] jhass: but do you want to define the schema in json or as a ruby hash?
[11:42:20] jhass: and isn't your question where to save said ruby hash or json file?
[11:43:05] roelof: a ruby hash, just like the example of the github page
[11:43:51] roelof: no, my question is where to save the json validation scheme? in the model or somewhere else ?
[11:44:07] jhass: I don't follow
[11:44:34] roelof: I want to use the gem im talking about
[11:44:47] jhass: "isn't your question where to save said ruby hash" "my question is where to save the json validation scheme"
[11:44:54] jhass: this is the same thing to me
[11:44:56] roelof: there is how I can make a json validation scheme, right ?
[11:45:38] roelof: oke, then we have a miscommunication, im sorry
[11:45:55] roelof: but it seems be both mean the same
[11:46:06] calmchaos: has joined #RubyOnRails
[11:46:34] roelof: my feeling says in the model
[11:46:36] jhass: I would probably write small focused classes
[11:46:55] ldnunes: has joined #RubyOnRails
[11:47:55] roelof: oke, and then in the helpers or in the support directory ?
[11:48:03] brazenbraden: does config.assets.quiet exist in rails 4.2? or is it new in 5?
[11:48:10] jhass: "the support directory"?
[11:48:52] jhass: class CreateFoo; SCHEMA = {...}; def initialize(params); @params = params; end; def save; validate_params; Model.create!(@params); end; ...
[11:49:19] jhass: possibly some module to extract redundant code to
[11:49:40] roelof: sorry, im confusing myself, support is only when using rspec
[11:49:49] roelof: so it will be in app/helpers
[11:50:19] finnnnnnnnnnn: has joined #RubyOnRails
[11:51:22] roelof: jhass : oke, and then use the json:validator in the create action of the controlller ?
[11:51:42] jhass: in the service class
[11:51:50] jhass: that's what it's there for
[11:52:00] jhass: wrapping the custom validation
[11:52:14] roelof: oke, what do I then put in the controller action(create)
[11:52:20] jhass: and I wouldn't use app/helpers, that's for view helpers by convention
[11:52:37] roelof: Service classes are totally new to me
[11:53:34] jhass: foo = CreateFoo.new(params); if foo.save; ... else; render json: foo.errors; end for example
[11:55:18] artto: has joined #RubyOnRails
[11:55:21] roelof: oke, I will try to make that idea work. Thanks for the pointers
[11:55:47] blackmesa: has joined #RubyOnRails
[11:58:25] artto_: has joined #RubyOnRails
[11:59:56] roelof: jhass : and then put in into app/services ?
[12:00:29] jhass: that's one common convention for such kind of classes, yeah
[12:02:01] roelof: thanks, I think and hope I can finally make my idea work
[12:02:23] fenn1: has joined #RubyOnRails
[12:02:27] RedNifre: has left #RubyOnRails: ("WeeChat 1.4")
[12:05:28] artto: has joined #RubyOnRails
[12:09:15] JamieD: has joined #RubyOnRails
[12:09:22] andromedian: is there a better way to write this? ads_targeting_what == ['for-sale']
[12:09:37] umdstu: has joined #RubyOnRails
[12:12:24] artto_: has joined #RubyOnRails
[12:19:13] calmchaos: has joined #RubyOnRails
[12:23:05] flashpoint9: has joined #RubyOnRails
[12:23:40] benlieb: has joined #RubyOnRails
[12:24:30] jkprg: has joined #RubyOnRails
[12:25:32] kitsuneyo: has joined #RubyOnRails
[12:30:20] Oliphaunte: has joined #RubyOnRails
[12:32:25] alebatt: has joined #RubyOnRails
[12:37:33] fenn1: has joined #RubyOnRails
[12:42:55] emilkarl: has joined #RubyOnRails
[12:44:44] fermonkus: has joined #RubyOnRails
[12:49:08] fmcgeough: has joined #RubyOnRails
[12:50:00] khelair: has joined #RubyOnRails
[12:50:22] khelair: Good morning, everyone (or associated time of day in your piece of the world)
[12:51:07] khelair: I just branched out from a tutorial (Skoglund's on youtube) and I'm trying to start up my own trial project here (rails 4)
[12:51:44] khelair: Not sure what I'm doing wrong here, but I created my new rails project, configured database.yml, set up a database and the applicable user, and now I'm trying to create my initial database migration
[12:52:27] khelair: unfortunately any time that I run (from within the project directory) 'rails generate x' (with x being anything, it appears), the command hangs, apparently waiting for input from 'gets'
[12:52:50] khelair: for instance, the last command that I ran was rails generate migration UserConfig
[12:53:00] pawnbox: has joined #RubyOnRails
[12:53:42] khelair: I get no return feedback at all, except telling me to run 'gem pristine --all', and then when I finally ^C out of it, I get the following error at the top of my stacktrace: /var/lib/gems/2.0.0/gems/spring-1.7.2/lib/spring/client/run.rb:117:in `gets': Interrupt
[12:54:10] khelair: I didn't have any behavior like this when I was going through the tutorial; not sure what I should be doing here, can anybody point me in the right direction, possibly? TIA
[12:54:15] qejk: has joined #RubyOnRails
[12:55:24] Ayey_: has joined #RubyOnRails
[12:57:32] pawnbox: has joined #RubyOnRails
[12:57:56] blackmesa: has joined #RubyOnRails
[13:01:16] fgo: has joined #RubyOnRails
[13:03:22] artto: has joined #RubyOnRails
[13:03:34] jgpawletko: has left #RubyOnRails: ()
[13:04:35] deecross: has joined #RubyOnRails
[13:05:46] ramortegui: has joined #RubyOnRails
[13:08:15] GodFather: has joined #RubyOnRails
[13:09:02] sarink: has joined #RubyOnRails
[13:10:38] jgt1: has joined #RubyOnRails
[13:10:45] sarink: has joined #RubyOnRails
[13:12:06] aegis3121: has joined #RubyOnRails
[13:13:19] pvertenten: has joined #RubyOnRails
[13:15:11] diegoviola: has joined #RubyOnRails
[13:15:12] srinidhi: has joined #RubyOnRails
[13:15:21] fox_mulder_cp: can some help me - i want start from ruby shell script, but when run command from rails c - seems ok, all variables passed to script properly. by when i try pass this command from resque task variables stayed as variable names, not values. gist here https://gist.github.com/foxmuldercp/cfaf26dc3706c4b194f2ec8e3f3a8453
[13:17:44] JamieD: has joined #RubyOnRails
[13:19:25] artto_: has joined #RubyOnRails
[13:19:38] ekinmur: has joined #RubyOnRails
[13:20:45] kies: has joined #RubyOnRails
[13:21:37] jkprg: has joined #RubyOnRails
[13:23:00] quazimodo: has joined #RubyOnRails
[13:23:03] kroltan: has joined #RubyOnRails
[13:24:23] jenrzzz: has joined #RubyOnRails
[13:25:32] kroltan: Hello! I'm trying to use Rails with PostgreSQL (so I can deploy to Heroku). But I'm hitting an impediment on my local machine: The database works fine in the server, but I can't use the "rails console" command for anything that interacts with the database. It gives a Postgres error "role <my computer username> does not exist"
[13:26:33] Circuit8: Is it an anti-pattern to have controllers which have no associated view or model, which perform a series of actions via AJAX?
[13:26:37] kroltan: Which is technically true, but I would expect it to use the role configured on my database.yml
[13:28:24] artto: has joined #RubyOnRails
[13:31:31] fryguy: kroltan: it does use database.yml
[13:33:40] kroltan: fryguy, then why does it try to use a different user than configured in yml?
[13:33:51] fryguy: kroltan: show your database.yml
[13:34:38] kroltan: http://pastebin.com/hjBJLM4d
[13:35:09] kroltan: The environment variables are properly set
[13:35:25] finnnnnnnnnnn_: has joined #RubyOnRails
[13:35:58] fryguy: how are you starting rails console with those environment variables set?
[13:36:13] superlou: has joined #RubyOnRails
[13:36:13] kroltan: export ...; export ...; rails c
[13:36:35] kroltan: (omitted for brevity)
[13:37:15] fryguy: and if you put the username hardcoded in the database.yml does the behavior change?
[13:38:02] kroltan: yes, it works
[13:38:37] asheinfeld: has joined #RubyOnRails
[13:39:12] fryguy: kroltan: try typing `env` at a command line and reviewing that the environment variables are getting set how you expect
[13:40:37] fryguy: show the output of `env | grep POSTGRES_USERNAME`
[13:41:02] kroltan: POSTGRES_USERNAME=rd_segments
[13:41:56] flashpoint9: has joined #RubyOnRails
[13:42:03] goeast: has joined #RubyOnRails
[13:42:25] fryguy: what version of rails are you using?
[13:42:38] alfiemax: has joined #RubyOnRails
[13:44:06] kroltan: I forced Spring to stop then tried again
[13:44:08] blackmesa: has joined #RubyOnRails
[13:44:08] kroltan: now it works
[13:44:44] calmchaos: has joined #RubyOnRails
[13:45:44] kroltan: thanks fryguy
[13:45:59] flashpoint9: has joined #RubyOnRails
[13:46:58] Devalo: has joined #RubyOnRails
[13:47:22] dionysus69: is it true that paperclip doesn't support variable number of image uploads?
[13:50:28] kroltan_: has joined #RubyOnRails
[13:53:09] sergio_101: has joined #RubyOnRails
[13:54:14] k13nox: has joined #RubyOnRails
[13:54:52] rafaelfranca: has joined #RubyOnRails
[13:54:52] rafaelfranca: has joined #RubyOnRails
[13:55:48] patrick_star: has joined #RubyOnRails
[13:56:13] daffy_duck: has joined #RubyOnRails
[13:57:42] k13nox: Hi, in Rails 5, i have ActionCable proxy by nginx, and when i disabled Wifi, the disconnect in ActionCable::Connection::Base didn't trigged.
[13:58:29] Oliphaunte: has joined #RubyOnRails
[14:01:33] finnnnnnnnnnn: has joined #RubyOnRails
[14:03:02] jhack: has joined #RubyOnRails
[14:05:14] comrad: has joined #RubyOnRails
[14:06:02] eserror: has joined #RubyOnRails
[14:08:41] pawnbox: has joined #RubyOnRails
[14:09:54] marr: has joined #RubyOnRails
[14:11:31] kitsuneyo: has joined #RubyOnRails
[14:18:16] snowy: has joined #RubyOnRails
[14:18:55] asheinfeld: has joined #RubyOnRails
[14:19:28] shinnya: has joined #RubyOnRails
[14:20:14] chouhoulis: has joined #RubyOnRails
[14:22:14] pawnbox: has joined #RubyOnRails
[14:22:56] jhass: if you cut your wifi it's basically up to your router whether it just drops packets or sends a TCP RST after a timeout
[14:23:06] openstruct: has joined #RubyOnRails
[14:24:59] artto: has joined #RubyOnRails
[14:26:28] JakFrist: has joined #RubyOnRails
[14:27:58] k13nox: The ping message with actioncable, trigger the disconnect if the client cut wifi or lose connection ?
[14:29:53] finnnnnnnnnnn: has joined #RubyOnRails
[14:31:24] eljimmy: has joined #RubyOnRails
[14:33:22] dc4: has joined #RubyOnRails
[14:33:37] the_drow: What's the best way to validate Plain Old Ruby Objects?
[14:33:50] yonahw: has joined #RubyOnRails
[14:33:55] helpa: "Best" and "better" are subjective. Try to use a different term.
[14:34:09] jhass: validate is rather vague too
[14:35:53] calmchaos: has joined #RubyOnRails
[14:36:13] artto: has joined #RubyOnRails
[14:36:31] xcesariox: has joined #RubyOnRails
[14:36:59] rubyonrailed: has joined #RubyOnRails
[14:38:28] l4v2: has joined #RubyOnRails
[14:38:40] jishankai: has joined #RubyOnRails
[14:38:59] urkle: has joined #RubyOnRails
[14:42:14] polishdub: has joined #RubyOnRails
[14:42:25] artto: has joined #RubyOnRails
[14:44:03] dminuoso: has joined #RubyOnRails
[14:45:15] artto: has joined #RubyOnRails
[14:47:31] sar1nk: has joined #RubyOnRails
[14:51:41] baweaver: has joined #RubyOnRails
[14:54:11] baweaver: has joined #RubyOnRails
[14:55:20] calmchaos: has joined #RubyOnRails
[14:55:28] kies: has joined #RubyOnRails
[14:56:22] SteenJobs: has joined #RubyOnRails
[14:56:58] SteenJobs: is it unwise to increase client_max_body_size in my nginx.conf? we allow for video uploads and nginx is preventing those uploads
[14:57:24] Ayey_: has joined #RubyOnRails
[15:02:04] allcentury: has joined #RubyOnRails
[15:03:05] aegis3121: has joined #RubyOnRails
[15:07:10] SteenJobs: has joined #RubyOnRails
[15:07:27] prithaj: has joined #RubyOnRails
[15:09:01] kevr: has joined #RubyOnRails
[15:09:30] artto: has joined #RubyOnRails
[15:10:51] jhass: ACTION coughs nginx
[15:10:58] jhass: ACTION adds a #
[15:11:12] RedNifre: has joined #RubyOnRails
[15:12:13] jhack: has joined #RubyOnRails
[15:12:44] redondos: has left #RubyOnRails: ()
[15:13:46] bga57: has joined #RubyOnRails
[15:13:47] RedNifre: Not sure if this is the right channel, but I have this rails app that speaks http, it binds to 127.0.0.3000 and I have this relayd TLS accelerator that makes it accessible over the internet through https... The problem is that whenever I click a link in the web interface it will try to open a http link which will fail. I guess this is a setting in RoR, but I'm not sure. Can I tell that RoR app to use
[15:13:49] RedNifre: https for every own url it displays in the browser?
[15:15:15] jhass: RedNifre: can you have your proxy set X-Forwarded-Proto: https ?
[15:15:49] JamieD: has joined #RubyOnRails
[15:16:41] RedNifre: jhass maybe... what does that mean? Will it edit the html on the fly? Or will it redirect any incoming link to https?
[15:16:47] RedNifre: (I'm new to all this)
[15:17:02] jhass: neither at all
[15:17:12] jhass: it would add a HTTP header to the HTTP request
[15:18:22] jhass: having it redirect all http requests to https is probably a good idea too, but separate from this issue
[15:19:57] jkprg: has joined #RubyOnRails
[15:20:06] pyemkey: has joined #RubyOnRails
[15:21:54] existensil: has joined #RubyOnRails
[15:26:34] AndrewIsHere: has joined #RubyOnRails
[15:27:58] cschneid_: has joined #RubyOnRails
[15:29:57] disgrntld: has joined #RubyOnRails
[15:31:23] eserror: has joined #RubyOnRails
[15:38:08] utal: has joined #RubyOnRails
[15:40:39] roshanavand: has joined #RubyOnRails
[15:40:57] ngw: has joined #RubyOnRails
[15:42:11] chopin: has joined #RubyOnRails
[15:44:13] yos7ph: has joined #RubyOnRails
[15:45:36] RedNifre: jhass okay, but what exactly does X-Forwarded-Proto: https do in this context?
[15:45:46] jahbrews1i: has joined #RubyOnRails
[15:47:30] dminuoso: has joined #RubyOnRails
[15:48:22] jhass: RedNifre: it tells the Rails app that the original protocol before the proxy was https
[15:48:30] Devalo: has joined #RubyOnRails
[15:50:24] theRoUS: has joined #RubyOnRails
[15:50:59] macsteps: has joined #RubyOnRails
[15:51:15] RedNifre: jhass ah, that's neat. Is this specific to rails or will that work with most apps?
[15:51:30] jhass: I think it's a fairly common thing
[15:52:31] basex: has joined #RubyOnRails
[15:54:14] Devalo: has joined #RubyOnRails
[15:54:16] basex: I have a question: I’m using activerecord in a sinatra app and with the upgrade to activerecord 5 I’m unable to load ActiveRecord::QueryCache as a middleware. Any idea how to load this now?
[15:54:40] Zackio: has joined #RubyOnRails
[15:54:45] one_zero: has joined #RubyOnRails
[15:55:00] utal: has joined #RubyOnRails
[15:56:52] basex: my configuration was similar to this https://gist.github.com/robhurring/712114
[15:58:17] Ayey_: has joined #RubyOnRails
[15:59:45] whathappens: has joined #RubyOnRails
[16:00:00] finnnnnnnnnnn: has joined #RubyOnRails
[16:00:26] whathappens: has joined #RubyOnRails
[16:00:59] utal: has joined #RubyOnRails
[16:03:42] ja: has joined #RubyOnRails
[16:05:57] roshanavand: has joined #RubyOnRails
[16:08:36] lupine: has joined #RubyOnRails
[16:09:02] Coldblackice_: has joined #RubyOnRails
[16:09:13] aegis3121: has joined #RubyOnRails
[16:11:17] kevr: has joined #RubyOnRails
[16:11:19] RedNifre: jhass Thank you very much, this solved my problem :)
[16:12:33] zacts: has joined #RubyOnRails
[16:13:25] macsteps: has joined #RubyOnRails
[16:14:59] greenhat|: jhass: ensure you have `config.force_ssl = true` in your production config.
[16:16:45] zave: has joined #RubyOnRails
[16:18:02] dgynn: has joined #RubyOnRails
[16:18:31] rakm: has joined #RubyOnRails
[16:18:42] jhass: greenhat_: wasn't my question ;)
[16:19:01] jhass: personally I prefer enforcement at the reverse proxy
[16:21:10] guest56: has joined #RubyOnRails
[16:23:02] greenhat|: force_ssl also makes sure your session cookies are marked as secure, and enables the strict-transport-security header.
[16:23:37] greenhat|: That's trickier to do at the proxy.
[16:24:23] Devalo: has joined #RubyOnRails
[16:25:05] greenhat|: And, perhaps confusingly, force_ssl doesn't require your rails app server to be running over https. It is happy as long as the x-forwarded-proto header is set to https by your proxy.
[16:26:33] jkprg: has joined #RubyOnRails
[16:26:37] dminuoso: jhass: I fully agree with you. TLS termination has to occur there anyway, so it makes sense it also sense the HSTS header for example.
[16:27:13] dminuoso: Besides I trust nginx more to enforce things like TLS than Rails fiddling around with it.
[16:28:02] macsteps: has joined #RubyOnRails
[16:31:39] manfrin_: has joined #RubyOnRails
[16:32:32] chopin: has joined #RubyOnRails
[16:37:52] blackmesa: has joined #RubyOnRails
[16:39:12] jishankai: has joined #RubyOnRails
[16:41:10] greenhat|: The problem with configuring nginx or whatever to do the things rails does for you is you are coupling your app nginx. If you ever want to move it to some other tls terminator you need to remember to port all that configuration over.
[16:41:43] greenhat|: If you can. The new server might not support all that, and then you need to move it to rails anyway. But if you know you'll be on nginx forever it is fine.
[16:44:15] workmad3: has joined #RubyOnRails
[16:44:37] CrossFit_Jesus: jhass, could you look at this batch create function and tell me if i did that correctly? or anyone else is welcome. http://pastie.org/10899556
[16:45:57] manfrin_: has joined #RubyOnRails
[16:48:40] AndrewIsHere: has joined #RubyOnRails
[16:49:19] SteenJobs: has joined #RubyOnRails
[16:49:52] kitsuneyo: has joined #RubyOnRails
[16:50:25] kitsuneyo: so turbolinks 5 huh
[16:53:05] whathappens: has joined #RubyOnRails
[16:54:09] kitsuneyo: i guess it's better to wait for now?
[16:55:51] rogue_koder: has joined #RubyOnRails
[16:56:50] dionysus69: has joined #RubyOnRails
[16:57:30] SteenJobs: jhass: haha just saw your response :D
[16:57:44] SteenJobs: i simply figured if there were any caveats, it would be bec of the rails app and nothing to do with nginx itself
[16:57:56] SteenJobs: because why would nginx care about the file upload size if the rails app doesn’t care
[16:59:40] upsell5: has joined #RubyOnRails
[17:02:02] eserror: has joined #RubyOnRails
[17:04:05] Silthias: has joined #RubyOnRails
[17:04:20] Bira: has joined #RubyOnRails
[17:04:33] tw1sted: has joined #RubyOnRails
[17:05:52] aegis3121: has joined #RubyOnRails
[17:07:40] whathappens: has joined #RubyOnRails
[17:07:59] macsteps: has joined #RubyOnRails
[17:09:53] IFrank00: has joined #RubyOnRails
[17:10:02] IFrank004: has joined #RubyOnRails
[17:13:01] zacts: has joined #RubyOnRails
[17:13:21] flashpoint9: has joined #RubyOnRails
[17:13:41] IFrank00: Hi im having this problem on my form in the new action https://gist.github.com/Frank004/00a7fb90e6179922bdef517ed2c29681
[17:14:24] IFrank00: undefined method `surveys_path' for Class Did you mean? survey_path
[17:15:18] dminuoso: IFrank00: please include your form
[17:17:31] mostlybadfly: has joined #RubyOnRails
[17:17:54] dminuoso: IFrank00: Is that the actual error message you get? It feels like you stripped the entire stack trace and line numbers from it.
[17:18:11] utal: has joined #RubyOnRails
[17:18:30] IFrank00: ill add the trace form the terminal too
[17:18:40] dminuoso: IFrank00: And the fact that you just changed the content of your view.html.erb suggests that you are not simply copy and pasting, but modifying the conent.
[17:18:46] dminuoso: I will not help you debug code that is not real.
[17:20:18] cnk: has joined #RubyOnRails
[17:21:21] IFrank00: im coping and pasting the only thing strip out was the html content
[17:23:26] IFrank00: dminuoso, I add the code for the form just as it is in my code
[17:23:53] IFrank00: I include the html and all
[17:25:53] jenrzzz: has joined #RubyOnRails
[17:27:29] sypheren: has joined #RubyOnRails
[17:29:21] jeremymarc: has joined #RubyOnRails
[17:30:37] drim: is that possible include a module only for one instance of a class?
[17:31:04] JamieD: has joined #RubyOnRails
[17:31:42] fmcgeough: has joined #RubyOnRails
[17:32:03] fryguy: drim: might want to check out eigenclasses
[17:33:09] artto: has joined #RubyOnRails
[17:33:14] pixelhandler: has joined #RubyOnRails
[17:33:38] n90b0jjf: has joined #RubyOnRails
[17:35:12] cnk: drim: you can totally do that in Ruby. But it may run afoul of the Rails autoloading stuff - at least in dev and test
[17:35:53] dminuoso: cnk: Why should it?
[17:36:23] cnk: I don't know that it will - but I would be cautious
[17:36:27] dminuoso: drim: Every object has a singleton class attached to it. In fact you often work with singleton classes when defining what you call "class methods".
[17:37:06] dminuoso: drim: (Usually by opening the singleotn class using "class self << " or defining it on it by "def self.foo")
[17:37:13] baweaver: has joined #RubyOnRails
[17:37:25] dminuoso: cnk: Autoloading has nothing to do with where you include a module.
[17:37:45] cnk: yes you are right
[17:37:49] drim: I have a class method called for_affiliate which dynamically include a module. I called it like this Device.for_affiliate. The problem is if I do Device without for_affiliate, I don't want to have the module included
[17:38:09] dminuoso: drim: Can you gist some actual code?
[17:39:28] drim: https://gist.github.com/jeremymarc/72fd9afb423a46217c0cd3ff7aa9601c
[17:40:13] dminuoso: drim: is Affiliate.current.root_device_type a module?
[17:40:27] utal: has joined #RubyOnRails
[17:40:58] drim: the problem is, once it has been included, if I just do Device it's still included
[17:41:36] drim: and I don't want that because its dynamic, so Iam getting an error when 2 differents modules are getting included because they are defining the same enum
[17:41:46] JoshGlzBrk: has joined #RubyOnRails
[17:42:46] dminuoso: drim: Don't include it on the class, but your instances singleton_class.
[17:43:10] drim: can I define that in the module?
[17:43:15] ldnunes: has joined #RubyOnRails
[17:44:11] Devalo: has joined #RubyOnRails
[17:44:21] whathappens: has joined #RubyOnRails
[17:44:37] dminuoso: drim: https://eval.in/600900
[17:45:01] dminuoso: There you go, a module included just for a single object instance.
[17:45:38] drim: cool thanks a lot gonna look at this
[17:45:39] dminuoso: drim: Note though, if you can't come up with yourself, chances are this is not what you want to do.
[17:47:33] hck89: has joined #RubyOnRails
[17:47:42] IFrank00: has joined #RubyOnRails
[17:47:55] IFrank004: has joined #RubyOnRails
[17:47:58] drim: come up with yourself?
[17:48:24] GodFather_: has joined #RubyOnRails
[17:48:39] Oliphaunte: has joined #RubyOnRails
[17:49:06] drim: dminuoso > problem with that is I cant' do Device.for_affiliate.scope1.scope2 etc
[17:49:29] drim: because my module define scopes also
[17:49:41] dminuoso: defines scopes?
[17:50:13] drim: yes my module defines scopes let me show you
[17:50:36] dminuoso: modules have methods and constants.
[17:50:50] bougyman: has left #RubyOnRails: ()
[17:51:20] jhack: has joined #RubyOnRails
[17:51:34] drim: https://gist.github.com/jeremymarc/72fd9afb423a46217c0cd3ff7aa9601c
[17:51:48] drim: this is one of the module that can be included
[17:52:22] GodFather: has joined #RubyOnRails
[17:52:27] drim: so I was thinking of using it like Device.for_affiliate.scope1
[17:54:08] deecross: has joined #RubyOnRails
[17:54:12] weckl: has joined #RubyOnRails
[17:56:50] jgt1: has joined #RubyOnRails
[17:57:40] drim: maybe I should create differents models instead of using modules if it's not possible
[17:59:45] jhack: has joined #RubyOnRails
[18:04:39] jhack: has joined #RubyOnRails
[18:04:40] hck89: has joined #RubyOnRails
[18:05:19] benlieb: has joined #RubyOnRails
[18:06:43] the_drow: has joined #RubyOnRails
[18:07:43] weaksauce: has joined #RubyOnRails
[18:07:43] blackmesa: has joined #RubyOnRails
[18:09:18] JamieD: has joined #RubyOnRails
[18:09:56] arup_r: has joined #RubyOnRails
[18:09:59] calmchaos: has joined #RubyOnRails
[18:11:14] arup_r: Hi I am using carrierwave and fog to upload s3. All is good till now. But I am getting some weird file name as u see https://gist.github.com/aruprakshit/b3d3a04998fe7c9dbb02cee6c75106ec. That is due to https://github.com/carrierwaveuploader/carrierwave/blob/0.10-stable/lib/carrierwave/storage/fog.rb#L340-L344 . Any idea what method should i call to get the actual uploaded file name?
[18:11:17] Ergo: has joined #RubyOnRails
[18:13:49] yfeldblum: has joined #RubyOnRails
[18:13:52] SteenJobs: has joined #RubyOnRails
[18:14:50] calmchaos: has joined #RubyOnRails
[18:15:09] moei: has joined #RubyOnRails
[18:17:46] cnk: arup_r: do you mean the original name from before it was uploaded?
[18:17:48] sneakers: has joined #RubyOnRails
[18:18:37] arup_r: if I go to aws console, I see the original name there exist. But Fog seems have no API to get that or may be I don't know the method name
[18:18:44] cnk: I think it is in your database as 'identifier'
[18:19:43] arup_r: cnk: added some more inspect result https://gist.github.com/aruprakshit/b3d3a04998fe7c9dbb02cee6c75106ec
[18:19:56] hahuang61: has joined #RubyOnRails
[18:20:16] calmchaos: has joined #RubyOnRails
[18:20:17] cnk: you are down in the fog stuff
[18:20:27] arup_r: cnk: identifier means column name?
[18:20:32] cnk: I bet it was stored on upload
[18:20:36] triptec: has joined #RubyOnRails
[18:20:48] cnk: it's a method name but it is very likely a column name on your model
[18:21:07] arup_r: cnk: my column name is also file. so the call is .file.file
[18:22:11] cnk: you know what the next question is, right?
[18:22:24] cnk: please show your models
[18:23:11] flashpoint9: has joined #RubyOnRails
[18:23:13] arup_r: InspectorTool::Attachment.last.file.class # => => InspectorTool::FileUploader and pry(main)> InspectorTool::Attachment.last.file.file.class # => CarrierWave::Storage::Fog::File ok showing my model
[18:23:45] Aherin: has joined #RubyOnRails
[18:23:53] arup_r: added the model https://gist.github.com/aruprakshit/b3d3a04998fe7c9dbb02cee6c75106ec cnk
[18:25:43] qejk: has joined #RubyOnRails
[18:26:35] sarink: has joined #RubyOnRails
[18:26:59] cnk: try InspectorTool::Attachment.file_identifier
[18:27:18] cnk: see the last part of the ActiveRecord docs here: https://github.com/carrierwaveuploader/carrierwave
[18:27:38] arup_r: NoMethodError: undefined method `file_identifier' for #<Class:0x007f8f822332a0>
[18:28:32] fermonkus: has joined #RubyOnRails
[18:28:39] cnk: So what was the answer?
[18:29:06] arup_r: [36] pry(main)> InspectorTool::Attachment.last.file_identifier # => "arup_profile.jpeg"
[18:29:24] cnk: excellent
[18:29:25] arup_r: all the way magic.. haha :p
[18:29:36] arup_r: cnk: thank you
[18:29:44] cnk: you are welcome
[18:30:12] arup_r: this was working, and once I added fog that piece is broken. but anyway now it is fixed.
[18:33:57] tyul: has joined #RubyOnRails
[18:34:37] tycoon177: has joined #RubyOnRails
[18:36:39] arup_r: has joined #RubyOnRails
[18:37:07] tyul: What is the best way to model something like a user's address book, in which a user has many addresses but one of them was chosen as the main address. There are many kind of things that have this pattern and I need to work with something similar. When I had to do that in a company I worked before, a guy said that it was a bad idea to put a foreign key on the user table to one of the addresses because would give a "lock" when delet
[18:37:48] emilkarl: has joined #RubyOnRails
[18:38:15] artto: has joined #RubyOnRails
[18:38:41] tyul: he said it was better to use a boolean "default" field. But the problem is that more than one address can have default true which is a bad thing
[18:39:12] tyul: but we didn't use rails at the time, so I would like to know what is the best way to deal with this pattern using rails
[18:39:42] tycoon177: Hello, I am trying to add an attribute to a rails model. I am using rails 3.2.13 and rspec version 3.2.1. I created a migration and added the new attribute to the attr_accessible line, but when I run my feature spec for the page that uses it, it says that the new attribute is an undefined method. It is just a checkbox tag on a form for the model. Is there
[18:39:42] tycoon177: anything that might cause this?
[18:39:56] dminuoso: tycoon177: Gist please, and include the full (!) stack trace.
[18:40:03] dminuoso: And the offending code.
[18:40:32] tycoon177: dminuoso: it'll be just a minute, but sure :)
[18:41:02] calmchaos: has joined #RubyOnRails
[18:41:30] aegis3121: has joined #RubyOnRails
[18:41:46] flashpoint9: has joined #RubyOnRails
[18:42:55] Aherin: has joined #RubyOnRails
[18:42:58] macsteps: has joined #RubyOnRails
[18:43:33] arup_r: tyul: User has_many address, so Address model will have a user_id column, and also primary boolean field, it solves the problem I think
[18:45:49] dminuoso: tyul: or just have a boolean "primary" flag, and make a composite unique index on the primary key and the primary flag on your address book.
[18:46:02] tycoon177: dminuoso: I had to cut a lot out because it's work, but I got all of the parts including the "feature" attribute https://gist.github.com/BenMcH/8ff8bb6e0cf76d324538eab470729269
[18:46:03] dminuoso: tyul: I think that is the cleanest method.
[18:46:44] dc4: has joined #RubyOnRails
[18:47:03] dminuoso: tyul: Did you run the migration in the same environment as your server?
[18:47:08] dminuoso: Errr tycoon177!
[18:47:11] fermonkus: To go off tyul's question, I've got a similar situation in that I have users that join Clubs, which is done through a Membership model (user_clubs)... I was planning on just adding a "home_club" attribute to the Memberships model to indicate the user's main Club. Sensible?
[18:47:16] dminuoso: ty<tab> did not yield the expected result.
[18:47:49] fermonkus: "home_club" being boolean
[18:48:05] dminuoso: fermonkus: Yes. Just enforce data integrity with a composite unique index.
[18:48:07] sarink: has joined #RubyOnRails
[18:48:33] fermonkus: dminuoso: thanks, will look into that!
[18:49:40] Ayey_: has joined #RubyOnRails
[18:50:03] dminuoso: tycoon177: The problem is if you use a foreign key on your user table, is that it makes it unclear how the relationship works. While it is true that "a user has one primary address", I think the more correct way is saying "a user has many addresses, one of which can be primary"
[18:50:07] sarink: has joined #RubyOnRails
[18:50:35] arup_r: dminuoso: I am not getting your idea :) You mean not need to put the user_id in the Address column?
[18:50:41] tycoon177: dminuoso: I think you wanted tyul :P And yeah, i'm 99.9% sure I ran my migration on development
[18:50:57] sarink: has joined #RubyOnRails
[18:50:58] arup_r: help me also to understand what you are saying, so that I can use it in my projects when time comes
[18:50:58] tycoon177: I didnt run it on test
[18:51:41] arup_r: i knew test migration is automatice.. may be I am wrong.
[18:52:35] dminuoso: tycoon177: you dont have to.
[18:52:40] dminuoso: arup_r: No you are correct.
[18:53:03] sar1nk: has joined #RubyOnRails
[18:53:07] dminuoso: tycoon177: did you restart the server?
[18:53:15] arup_r: ok, then what that composite key is for..?
[18:53:31] arup_r: ok got it
[18:53:36] arup_r: that is *index*
[18:53:41] arup_r: makes sense
[18:53:43] dminuoso: arup_r: to enforce that a user cannot have two primary addresses.
[18:54:00] dminuoso: It does not make sense datawise - so its a good idea to enforce <integrity> in your database.
[18:54:11] pyemkey: has joined #RubyOnRails
[18:54:37] tycoon177: dminuoso: I forgot to run the migration on test. it's working now. we have to run rake db:test:prepare on our rails stack at work for whatever reason. It's working now. Thank you so much
[18:54:49] dminuoso: tycoon177: You shouldn't have to run the migration on test.
[18:55:18] theod: has joined #RubyOnRails
[18:55:19] dminuoso: tycoon177: Next time I recommend using pry, that way you can interactively inspect the objects where an error occurs.
[18:55:27] dminuoso: Its much better than people here trying to guess what might be wrong. :_
[18:56:58] Devalo: has joined #RubyOnRails
[18:57:11] tycoon177: dminuoso: is there a way to use that with rspec? :P And I don't know why we have to run rake db:test:prepare, but we do for it to work. My guess is it's because we're still on an old version of rails..almost 2 major releases behind. Or because we use a sql server activerecord driver
[18:57:54] dminuoso: tycoon177: Sure.
[18:58:06] dminuoso: tycoon177: RSpec is just Ruby, you can binding.pry when running rspec just fine.
[18:58:43] blackmesa: has joined #RubyOnRails
[18:58:53] jgt1: has joined #RubyOnRails
[18:59:04] tycoon177: thanks for telling me about pry! I am going to look into it dminuoso
[18:59:06] JamieD: has joined #RubyOnRails
[18:59:56] hahuang61: has joined #RubyOnRails
[19:00:11] roshanavand: has joined #RubyOnRails
[19:00:53] roshanavand: has joined #RubyOnRails
[19:04:11] fox_mulder_cp: has joined #RubyOnRails
[19:07:37] zeroreg: has joined #RubyOnRails
[19:09:46] srinidhi: has joined #RubyOnRails
[19:15:17] banisterfiend: has joined #RubyOnRails
[19:15:59] jgt1: has joined #RubyOnRails
[19:17:01] Dimik: has joined #RubyOnRails
[19:17:25] roamingdog: has joined #RubyOnRails
[19:19:24] tycoon177: has left #RubyOnRails: ()
[19:21:16] DoubleMalt: has joined #RubyOnRails
[19:21:33] IFrank00: has joined #RubyOnRails
[19:21:34] IFrank004: has joined #RubyOnRails
[19:23:12] upsell5: has joined #RubyOnRails
[19:26:14] chipotle_: has joined #RubyOnRails
[19:26:38] JamieD: has joined #RubyOnRails
[19:26:40] blackmesa: has joined #RubyOnRails
[19:26:56] Meow-J: has joined #RubyOnRails
[19:27:38] chipotle_: has joined #RubyOnRails
[19:28:18] mrodrigues: has joined #RubyOnRails
[19:28:55] Devalo: has joined #RubyOnRails
[19:29:20] jahbrews1i: has joined #RubyOnRails
[19:33:14] pyemkey: has joined #RubyOnRails
[19:33:26] [Butch]: has joined #RubyOnRails
[19:33:55] orolo: has joined #RubyOnRails
[19:40:23] deecross: has joined #RubyOnRails
[19:42:32] calmchaos: has joined #RubyOnRails
[19:44:22] calmchaos: has joined #RubyOnRails
[19:45:18] IFrank00: has joined #RubyOnRails
[19:45:18] IFrank004: has joined #RubyOnRails
[19:46:06] sarink: has joined #RubyOnRails
[19:49:21] SteenJobs: has joined #RubyOnRails
[19:51:13] mostlybadfly: has joined #RubyOnRails
[19:52:31] whathappens: has joined #RubyOnRails
[19:58:00] jimoro: has joined #RubyOnRails
[20:00:58] Silthias: has joined #RubyOnRails
[20:01:52] aegis3121: has joined #RubyOnRails
[20:02:54] DoubleMalt: has joined #RubyOnRails
[20:02:56] Oliphaunte: has joined #RubyOnRails
[20:03:58] fermonku1: has joined #RubyOnRails
[20:04:47] zacts: has joined #RubyOnRails
[20:12:31] diegoviola: has joined #RubyOnRails
[20:12:47] fl4sh_: Given the following: 3 models, User, RecipeCollection and Recipe. RecipeCollection belongs to User and every Recipe belongs to RecipeCollcetion. Now I want to retrieve all recipes for a given user. has_many :recipes, through: :recipe_collections won't do, however, User.respond_to?(:recipes) is false. Any idea on how to achieve what I want?
[20:14:31] zeroreg: RecipeCollection should belong_to User and belong_to Recipe
[20:14:31] GodFather: has joined #RubyOnRails
[20:15:16] zeroreg: RecipeCollection should have recipe_id and user_id, then you can say a user has_many :recipe_collections and has_many :recipes, through: :recipe_collections
[20:15:37] zeroreg: I think that's what your question meant.
[20:17:18] Devalo: has joined #RubyOnRails
[20:17:47] fl4sh_: Well, kinda. The problem is, that this solution doesn't really resemble the 'real' associations between the objects. A recipe collection has many recipes, it doesn't belong to one
[20:17:59] matthewd: > has_many :recipes, through: :recipe_collections won't do, however, User.respond_to?(:recipes) is false
[20:18:06] matthewd: I have no idea what that means
[20:18:07] fl4sh_: The question is more like 'can I have a relation, that gives me has_manys of my has_manys'
[20:18:08] KensoDev: has joined #RubyOnRails
[20:18:12] zeroreg: Err, actually I think I misunderstood. You could try doing using Array.map.
[20:18:54] zeroreg: ....my javascript is leaking.
[20:19:23] matthewd: "won't do" what? "however," = "but", or "because"?
[20:20:56] zeroreg: ah, fl4sh. I believe you need to write a method on your User model that gets an array of the User's recipe collections, then maps all of that recipe collection's recipes into a flat array.
[20:21:05] fl4sh_: Meh, this evening: Proper comma positioning in English. has_many ... won't do (= doesn't do), because User.recipes doesn't work (i.e. User does not have that method)
[20:21:18] fl4sh_: The however was more or less a linking word
[20:21:28] kevr: has joined #RubyOnRails
[20:21:33] fl4sh_: Meh, 9h shifts + 5h sleep don't improve grammar...
[20:22:10] matthewd: fl4sh_: Okay, that's how I first read it, but.. I don't follow the logic
[20:22:12] fl4sh_: zeroreg, that's what I was thinking about. Yet I thought there was a more fancy way with AR associations rather than loading all the data and breaking it down in ruby
[20:22:44] zeroreg: Trying to think. There might be something built into AR since the last time I needed to do something like this.
[20:22:51] matthewd: fl4sh_: That has_many through is exactly what you want
[20:23:22] zeroreg: I think he's saying that he can't use RecipeCollections as a join table for some reason or another.
[20:23:54] fl4sh_: Exactly, I cannot use it, because it doesn't have a recipe_id in it or belongs_to recipe
[20:24:27] zeroreg: You could always write your own SQL to grab all the recipe IDs and then use Recipe.where(id: ids)
[20:24:30] matthewd: Umm... false?
[20:25:06] pixelhandler: has joined #RubyOnRails
[20:25:56] matthewd: zeroreg: The first step after "I can't use [obvious solution] because [unsubstantiated reason]" is not to find a hackful alternative
[20:26:22] zeroreg: Eh, I'm just trying to answer the question.
[20:26:50] matthewd: fl4sh_: Can you rephrase as by showing an Actual Error that demonstrates why the hm:t isn't working for you? Because.. it should.
[20:27:46] fl4sh_: Sec, let me reload everything again to make sure it's not just model reloading in development that screwed something up
[20:28:25] fl4sh_: Well, problem solved. It works as expected, just like you said
[20:28:50] fl4sh_: Love spending hours searching an error in some code and get it working after restarting the rails console
[20:28:58] fl4sh_: Sorry for the time wasted >.<
[20:28:59] [Butch]: has joined #RubyOnRails
[20:29:16] matthewd: Sorry reloading bit you :/
[20:29:25] matthewd: It also, is supposed to just work :)
[20:29:36] pawnbox: has joined #RubyOnRails
[20:29:48] fl4sh_: Well, the only thing I can tell is that the exact same code worked after restarting x)
[20:29:49] zeroreg: I thought he was saying it wouldn't work because of some business logic to do with RecipeCollections.
[20:30:03] fl4sh_: Well that's what I thought was the problem
[20:30:04] zeroreg: Glad it works!
[20:31:20] fl4sh_: ty and sorry again. Yes I actually thought it was a problem in businesslogic. But apperently the next time I edit a file and save it, and something doesn't work as expected, I'm gonna restart everything before considering I did something wrong or asking here *sigh*
[20:32:54] matthewd: fl4sh_: No worries. I'd focus more on: if something doesn't work as expected, ask about *that* before asking for alternatives
[20:33:18] matthewd: fl4sh_: Mostly because it's confusing/hard to come up with alternatives for things that should work, without understanding why they're not ;)
[20:35:56] pixelhandler: has joined #RubyOnRails
[20:36:00] l4v2: has joined #RubyOnRails
[20:38:16] ur5us: has joined #RubyOnRails
[20:38:30] macsteps: has joined #RubyOnRails
[20:41:09] Axsuul: has joined #RubyOnRails
[20:41:14] KnownSyntax_: has joined #RubyOnRails
[20:41:14] KnownSyntax_: has joined #RubyOnRails
[20:46:13] Sashimi: has joined #RubyOnRails
[20:46:37] sarink: has joined #RubyOnRails
[20:46:57] Papierkorb: Within a respond_to block, does the path extension/suffix or an Accept header take precedence?
[20:47:55] triptec: has joined #RubyOnRails
[20:48:17] yfeldblum: has joined #RubyOnRails
[20:48:18] meoblast001: has joined #RubyOnRails
[20:48:29] sar1nk: has joined #RubyOnRails
[20:52:36] pixelhandler: has joined #RubyOnRails
[20:54:00] whathappens: has joined #RubyOnRails
[20:55:27] Darmani: has joined #RubyOnRails
[20:58:37] hck89: has joined #RubyOnRails
[21:02:14] shinnya: has joined #RubyOnRails
[21:02:44] jstransky: has joined #RubyOnRails
[21:06:04] Darmani: Hey guys, I think my migrations are off. Could someone take a look?
[21:06:13] Darmani: https://gist.github.com/mfifth/899ef3f7b3feb42658f9aa16c104a387
[21:06:14] workmad3: has joined #RubyOnRails
[21:06:31] matthewd: Papierkorb: That seems easy to check, but I think you'll find an explicit format in the URL beats a hint in the header
[21:07:03] Papierkorb: matthewd: Don't have a rails app at hand, and didn't want to install gems for some minutes
[21:07:48] Kyno: has joined #RubyOnRails
[21:07:59] Darmani: idk if a shirt should belong to an order? I don't think it should cause then every shirt created needs to have an order attached to it right?
[21:08:03] Darmani: I don't think that's correct...
[21:08:07] matthewd: Darmani: !guys but yes, that does seem off
[21:08:07] helpa: Darmani: We're not all guys here - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[21:08:32] Darmani: matthewd: LOL seriously?
[21:10:55] matt_d: SJW spotted
[21:11:07] whathappens: has joined #RubyOnRails
[21:11:15] Darmani: matthewd: My favorite part about what you just said is that you have it preset to tell people that. Like you honestly felt the need to correct me.
[21:11:20] Darmani: That's too funny.
[21:11:33] Darmani: No but for real if someone could take a look I'd appreciate it.
[21:12:05] matthewd: If you're not interested in the channel rules, I'm not interested in helping
[21:12:16] pixelhandler: has joined #RubyOnRails
[21:12:25] Darmani: matthewd: Lol is that a channel rule?! Really?
[21:13:13] Darmani: holy shit it is!
[21:13:19] Darmani: I had no idea.
[21:13:58] asdf123: has joined #RubyOnRails
[21:14:25] asdf123: if i create an @ variable, is it stored as part of the session and can cause a cookie overflow?
[21:14:55] asdf123: doing session.inspect shows my @ variable
[21:14:58] jhack: has joined #RubyOnRails
[21:15:07] asdf123: but i can't seem to find anywhere where it's placed in the session
[21:15:32] matthewd: asdf123: Is something that *contains* it being placed in the session, perhaps?
[21:15:43] matthewd: asdf123: !gist the inspect output?
[21:15:43] helpa: asdf123: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[21:16:17] asdf123: i can't put the output; company data is used.
[21:16:21] Darmani: https://gist.github.com/mfifth/899ef3f7b3feb42658f9aa16c104a387
[21:16:24] Darmani: ACTION coughs
[21:16:32] whathappens: has joined #RubyOnRails
[21:16:56] asdf123: but session.inspect will show just the session and not any instance variables right
[21:17:20] jgt1: has joined #RubyOnRails
[21:19:07] matt_d: Darmani: sorry, I was too busy walking around stressed out after seeing you being attacked by an SJW policy. Yeah, let me take a look.
[21:20:01] Darmani: matt_d: You're fine. We should all take a deep breath lol
[21:23:27] asdf123: are instance variables for controllers placed in a session?
[21:23:38] asdf123: action_controller.instance -> controller
[21:23:39] matthewd: asdf123: Still no.
[21:23:53] matthewd: (unless you're doing something to make it happen)
[21:23:53] asdf123: action_controller.instance is in my sessions.inspect
[21:23:56] asdf123: and contains my @ variable
[21:24:53] kevr: has joined #RubyOnRails
[21:24:54] jenrzzz: has joined #RubyOnRails
[21:24:54] jenrzzz: has joined #RubyOnRails
[21:25:05] matthewd: asdf123: Oh, are you looking at the env? The session might have a transient reference to that, which would in turn reference many things.
[21:25:31] asdf123: i'm unsure
[21:25:37] asdf123: but would that throw me out of the 4kb limit?
[21:25:42] DoubleMalt: has joined #RubyOnRails
[21:26:01] lupine: ACTION notes this "SJW policy" is company policy both where he works now, and where he'll be working next
[21:26:18] matthewd: asdf123: No, it won't
[21:26:19] asdf123: i can't diagnose the cookie overflow -- but does the exception occur immediately or after the page / controller finishes?
[21:26:28] asdf123: the logs give a 200 OK then the overflow happens
[21:26:58] Darmani: ACTION pats lupine on the back
[21:27:09] lupine: eh, I'm a big supporter of it
[21:27:37] baweaver: Let's keep those topics over on #ruby-offtopic.
[21:27:40] rafaelfranca: has joined #RubyOnRails
[21:27:42] jhack: has joined #RubyOnRails
[21:27:42] matt_d: lupine: it's out of control.
[21:27:53] Darmani: baweaver: Oh now you chime in.
[21:27:54] baweaver: and keep this for rails issues.
[21:28:00] baweaver: I just got back
[21:28:10] Darmani: Well now that you're back...
[21:28:15] Darmani: baweaver: https://gist.github.com/mfifth/899ef3f7b3feb42658f9aa16c104a387
[21:29:08] DoubleMalt: has joined #RubyOnRails
[21:30:04] deecross: has joined #RubyOnRails
[21:30:25] bruce_lee: has joined #RubyOnRails
[21:30:28] openstruct: has joined #RubyOnRails
[21:31:12] baweaver: Shirt doesn't have an order_id
[21:31:13] eljimmy: has joined #RubyOnRails
[21:31:43] Darmani: baweaver: But then every shirt has to belong to an order? Even if an order hasn't been placed yet... o.o
[21:32:01] baweaver: then put an order_id on a shirt.
[21:32:28] Darmani: baweaver: So I need to create a fake order to hold all my shirts?
[21:32:42] baweaver: unless you required it for some reason.
[21:33:20] Darmani: baweaver: o.o
[21:33:21] rafaelfranca: has joined #RubyOnRails
[21:33:23] Darmani: I need to think about that.
[21:33:25] Darmani: But thanks.
[21:33:32] tyul: hey guys I am trying to model an address book where one of the addresses can be the default one, is this a good approach? https://gist.github.com/tiagofumo/b1792a7ab2f26686c4e16f614befb26d
[21:35:17] baweaver: Darmani / matt_d / lupine: Feel free to continue that topic on #ruby-offtopic, but let's keep the meta out of this channel.
[21:36:32] asdf123: matthewd: so there is no size limit to @ variables?
[21:36:36] jgt1: has joined #RubyOnRails
[21:37:07] asdf123: matthewd: how can i see if session.inspect is printing environment variables? (obviously it is, but i guess we should find out if that's even the problem)
[21:37:12] baweaver: well, memory
[21:37:45] baweaver: tyul: thinking that a callback to set the address_id to a default address would work.
[21:37:57] matt_d: baweaver: it's cool, but thanks.
[21:39:02] matthewd: asdf123: Can you reproduce it with less sensitive data in the inspect, or even just trim the parts that matter out? In general we prefer not to work with half-censored data, but for the purposes of just seeing the structure, it should be fine
[21:39:16] pvertenten: has left #RubyOnRails: ()
[21:40:48] asdf123: all i can really say is that the instance variables are somehow part of the session (session.inspect) as part of the value, for the key "active_controller.instance"
[21:41:07] asdf123: so somehow the controller is part of the session
[21:41:16] asdf123: it's definitely not being added by me.
[21:41:20] ur5us: has joined #RubyOnRails
[21:41:22] Darmani: matt_d, baweaver: Fixed. Thanks guys.
[21:42:03] matt_d: Darmani: any time. welcome to rails
[21:42:29] Darmani: matt_d: wat. I come here all the time o.O
[21:43:46] matt_d: Darmani: my mistake.
[21:44:04] Darmani: matt_d: no worries :p
[21:44:36] baweaver: about that long
[21:44:48] Darmani: baweaver: holy shit that's so cool!
[21:44:51] Darmani: It's been that long???
[21:45:19] baweaver: since the logger first saw you at least.
[21:45:34] Radar: has joined #RubyOnRails
[21:45:45] Darmani: baweaver: Back then I was just getting into Ruby... Didn't really know what Rails was or if I should even get into it haha
[21:46:13] Radar: has joined #RubyOnRails
[21:46:58] basex: has joined #RubyOnRails
[21:49:07] sarink: has joined #RubyOnRails
[21:49:18] dagelf: has joined #RubyOnRails
[21:49:23] zacts: has joined #RubyOnRails
[21:52:57] basex: I’m using activerecord in a sinatra app and with the upgrade to activerecord 5 I’m unable to load ActiveRecord::QueryCache as a middleware. Any idea how to load this now? my configuration is similar to this https://gist.github.com/robhurring/712114
[21:54:26] matthewd: basex: Use the ActionDispatch::Executor middleware (or, if you don't want to depend on AD, your own equivalent -- it's a simple invocation of ActiveSupport::Executor)
[21:55:17] basex: I just do: ActiveRecord::QueryCache.install_executor_hooks; ActiveRecord::Base.connection.enable_query_cache! and then: use ActiveSupport::Executor ?
[21:56:21] matthewd: ActionDispatch::Executor is the middleware -- but it lives in the actionpack gem
[21:57:31] matthewd: So, it depends whether you're okay with depending on the actionpack gem
[21:58:21] matthewd: If you'd rather not, you can just make your own; it's very simple: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/executor.rb
[21:58:38] basex: no problem: use ActiveSupport::Executor, ActiveRecord::QueryCache ?
[21:58:49] upsell5: has joined #RubyOnRails
[21:59:14] basex: I will make a test here
[22:00:16] pyemkey: has joined #RubyOnRails
[22:03:53] shilon: has joined #RubyOnRails
[22:03:54] braincrash: has joined #RubyOnRails
[22:04:37] eljimmy: has joined #RubyOnRails
[22:06:38] fermonkus: has joined #RubyOnRails
[22:09:18] ziggy: has joined #RubyOnRails
[22:10:15] cd-rum: has joined #RubyOnRails
[22:12:08] cd-rum_: has joined #RubyOnRails
[22:13:59] calmchaos: has joined #RubyOnRails
[22:16:05] dc4: has joined #RubyOnRails
[22:16:28] matthewd: basex: !rule12
[22:16:28] helpa: basex: Do not PM members of the channel without first asking if that is OK.
[22:16:59] basex: matthewd: sorry
[22:17:17] matthewd: No worries; we just prefer to keep things in-channel, where other people may benefit
[22:17:22] basex: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/executor.rb calls run!
[22:17:28] basex: but the query cache class only have “run” https://github.com/rails/rails/blob/master/activerecord/lib/active_record/query_cache.rb
[22:18:09] matthewd: Yeah; you don't want to invoke the QueryCache directly
[22:18:21] matthewd: install_executor_hooks will add it to the list of things to be called by the AS::Executor
[22:18:31] matthewd: That's the thing you call run! on
[22:19:22] matthewd: Technically, if you *only* care about the query cache, I guess you could call that run/complete directly
[22:19:25] chouhoul_: has joined #RubyOnRails
[22:19:32] matthewd: .. and deal with clear_active_connections yourself
[22:19:56] matthewd: But the intention is that you invoke the generic executor system, and it takes care of anything that has registered itself
[22:20:04] basex: ok I will probably make a middleware, was just trying to see if there was a more standard way
[22:20:38] matthewd: Executor's run! and complete! are public API, so they're your best bet in that regard
[22:21:10] matthewd: These QueryCache methods aren't explicitly undocumented, but I didn't specifically intend to make them public. I'll probably nodoc them.
[22:23:44] basex: the documentation here needs an update http://guides.rubyonrails.org/rails_on_rack.html
[22:23:51] basex: shows ActiveRecord::QueryCache as a middleware
[22:24:47] matthewd: Ah, yeah, ConnectionManagement too. Will fix, thanks.
[22:25:05] rubyonrailed: has joined #RubyOnRails
[22:25:59] jahbrewski: has joined #RubyOnRails
[22:27:31] JoshGlzBrk: has joined #RubyOnRails
[22:28:48] rafaelfranca: has joined #RubyOnRails
[22:29:37] capin: afternoon, anyone know why the following validation is not stopping a 2 digit zipcode from passing, `validates :zipcode, numericality: { greater_than_or_equal_to: 5 }` ...this validation line is in my `order.rb` model file
[22:29:57] pawnbox: has joined #RubyOnRails
[22:30:03] Rodya_: has joined #RubyOnRails
[22:30:43] alfiemax: capin, 2 digit zipcode would be any number greater than or equal to 10
[22:31:01] alfiemax: so any 2 digit number is valid as per the validation
[22:31:37] capin: alfiemax: if a user inputs a 2 digit zipcode, i thought with that validation line it would return an error :l
[22:31:39] alfiemax: i think you are looking for a length validation and not value
[22:31:53] capin: ahhh thanks
[22:32:18] pur3eval_: has joined #RubyOnRails
[22:32:37] pur3eval: has joined #RubyOnRails
[22:33:42] siaw23: has joined #RubyOnRails
[22:35:30] Radar: what alfiemax said
[22:35:56] kevr: has joined #RubyOnRails
[22:36:15] matthewd: Also, <generic warning about not treating zip codes/phone numbers/etc as being too number-like>
[22:36:54] basex: matthewd: on the documentation http://guides.rubyonrails.org/rails_on_rack.html shows: “use ActionDispatch::Executor”, if I try this I get “wrong number of arguments (given 1, expected 2)”, needs an executor on the second argument
[22:37:26] basex: just trying to make sense of this executor system
[22:37:38] matthewd: Gah, more oops
[22:37:50] matthewd: Pass it ActiveSupport::Executor as the argument
[22:38:54] fp-: has joined #RubyOnRails
[22:38:56] matthewd: For a more complex usage, you could subclass it, and then pass that ("your own executor") in instead, as well as having AR install itself to that
[22:39:00] JakFrist: has joined #RubyOnRails
[22:39:47] matthewd: (Rails' default stack does that, to nominally isolate the "application" from the supporting libraries)
[22:39:54] basex: worked like a charm
[22:39:58] basex: :) finally
[22:40:00] fp-: Rails 5 is doing some kind of really strange caching of a module/concern I have that sets a default scope based on Thread.current. Does anyone have any advice of where I can investigate? It's like it's caching the module for some reason and calling the default_scope regardless of whether it should (based on presence of account_id in Thread.current)
[22:40:56] basex: in case some needs: ActiveSupport.on_load(:active_record) { ActiveRecord::QueryCache.install_executor_hooks }
[22:40:59] basex: and then ActiveRecord::Base.connection.enable_query_cache!
[22:41:09] basex: for the middleware: use ActionDispatch::Executor, ActiveSupport::Executor
[22:41:17] matthewd: fp-: We're definitely gonna need code for that. What you're doing sounds.. interesting.
[22:42:00] jishankai: has joined #RubyOnRails
[22:42:25] matthewd: basex: I'm not sure you need the enable_query_cache
[22:42:32] matthewd: basex: But either way, working is good :)
[22:43:29] basex: thanks for the help, that last part of the argument of the ActionDispatch::Executor was the part missing for me
[22:44:39] matthewd: And thank you for persevering.. not many people other than me have touched that stuff yet
[22:45:07] macsteps: has joined #RubyOnRails
[22:47:14] Rodya_: has joined #RubyOnRails
[22:49:53] fp-: i keep tweaking things and it just seems that default_scope within a Concern is just not working
[22:50:14] fp-: I have default_scope { raise 'wtf' } and it never calls
[22:50:46] pawnbox: has joined #RubyOnRails
[22:50:52] jstransky: has joined #RubyOnRails
[22:52:01] fp-: if I move it out of default_scope into the included() block, it calls
[22:54:45] JoshGlzBrk: has joined #RubyOnRails
[22:55:07] basex: has joined #RubyOnRails
[22:58:03] rafaelfranca: has joined #RubyOnRails
[23:01:18] pyemkey: has joined #RubyOnRails
[23:02:13] Rodya_: has joined #RubyOnRails
[23:03:55] kitsuneyo: has joined #RubyOnRails
[23:04:39] SteenJobs: has joined #RubyOnRails
[23:08:18] pvertenten: has joined #RubyOnRails
[23:08:54] fp-: yeah even in the console, I can't get a concern to set a default_scope in Rails 5
[23:10:12] Radar: default scope considered dangerous
[23:10:36] Radar: source: I wrote a gem which depends on liberal default_scope usage and 90% of the issues are because of default_scope
[23:10:51] dalbusch1t: has joined #RubyOnRails
[23:11:28] helpa: fp-: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[23:11:35] matthewd: But also, what Radar said.
[23:11:53] alfiemax: Radar, agree, most of the times it does cause some trouble in debugging
[23:12:16] Radar: Favour explicitness over default_scope implicitness :+1
[23:12:17] alfiemax: but, then why isn't it made available to the public api ?
[23:12:32] alfiemax: i meant "is it"
[23:12:53] nettoweb: has joined #RubyOnRails
[23:13:41] Radar: alfiemax: If Rails hid all the dangerous methods from the public API then there would not be very much left.
[23:14:09] Radar: maybe render, all, where + find
[23:14:20] lupine: plus, you know, ruby. everything is public really
[23:14:43] Radar: Yeah, just use `send` if the method isn't public. Its the code equivalent of reaching across the table to grab the sauce (and then spilling it everywhere)
[23:15:18] alfiemax: send can be used to call private methods too??
[23:15:19] hahuang61: has joined #RubyOnRails
[23:15:22] alfiemax: didn't know that
[23:17:13] lupine: if send doesn't work, use __send__
[23:17:36] lupine: or some variant of eval
[23:17:53] eljimador: has joined #RubyOnRails
[23:18:00] lupine: we could do with stripping protected and private out of the language, they're barely even hints
[23:18:24] fp-: ok it looks like in Rails 5, you have to define default scopes as def self.default_scope
[23:18:40] fp-: the previous method is no longer working for me at least
[23:19:39] fp-: default_scope { with_account } # does nothign
[23:19:50] Radar: [09:10:11] <Radar> default scope considered dangerous
[23:19:56] Radar: ACTION makes loud alarm sounds
[23:19:58] fp-: def self.default_scope() with_account; end # works
[23:20:45] zacts: has joined #RubyOnRails
[23:21:49] arooni-mobile: has joined #RubyOnRails
[23:22:24] braincrash: has joined #RubyOnRails
[23:22:44] flashpoint9: has joined #RubyOnRails
[23:26:58] nettoweb: has joined #RubyOnRails
[23:29:09] siaw23: has joined #RubyOnRails
[23:33:51] Hobogrammer: has joined #RubyOnRails
[23:34:51] chouhoulis: has joined #RubyOnRails
[23:39:08] rubyonrailed: has joined #RubyOnRails
[23:45:10] arooni-mobile: has joined #RubyOnRails
[23:46:16] upsell5: has joined #RubyOnRails
[23:46:32] allcentury: has joined #RubyOnRails
[23:47:23] comm64x: has joined #RubyOnRails
[23:48:09] ponzii: has joined #RubyOnRails
[23:49:06] ponzii: Newish to Rails, I get the impression validations are tied to database objects but what if I just want to validate a form field which will not be stored in the database?
[23:49:56] lupine: ponzii: you can use ActiveModel validations with non-database-persisted objects
[23:49:57] fryguy: make a model object that isn't tied to the database (see ActiveModel), or just do the validation in the controller. Or consider making a form object.
[23:50:22] lupine: comes up a lot with wizards
[23:50:27] lupine: (or druids, as gnome used to call them)
[23:50:44] comm64x: hello everyone, I'm still a little new to rails and am trying to wrap my head around associations. I've read through the guides and what tutorials I can find and I think I'm getting it. Maybe I just need some validation, haha get it -- validation. Anyway. I'm working on a blog application where I want to have three different types of post -- articles, page posts, and project posts. What would be the b
[23:50:50] comm64x: est way to go about this?
[23:50:58] sarink: has joined #RubyOnRails
[23:52:35] basex: has joined #RubyOnRails
[23:53:35] comm64x: Currently I have three models (article, page, and project) inside a post module. Outside the module is a post_type module.
[23:54:13] AndrewIsHere: has joined #RubyOnRails
[23:54:23] arooni-mobile: has joined #RubyOnRails
[23:54:29] AndrewIsHere: has joined #RubyOnRails
[23:54:49] JoshGlzBrk: has joined #RubyOnRails
[23:55:28] comm64x: I imagine a post would have a post_type which could be one of the three...so there are many post_types. An article would have one post type, same with the page and project.
[23:55:39] dblessing: has joined #RubyOnRails
[23:56:10] comm64x: would a post_type belong_to an article|page|project
[23:56:58] comm64x: typo....outside the post module is a post_type model
[23:57:54] triptec: has joined #RubyOnRails