Activity Graph

Page 1 of 1


[19:20:41] IGnorAND: I want to make the following my default scope: select * from security_id_cards, security_id_request where security_id_cards.request_id=security_id_request.id; How do I do this in rails? default_scope { joins(:security_id_request).where('security_id_cards.request_id = security_id_request.id') } was my guess, but it indicates Can't join to association named 'security_id_request'; perhaps you misspelled it?


[01:05:29] IGnorAND: Boxer has_many fights. I want to create a function that returns his last fight, I have @boxer.fights.order(match_date: :desc).first.match_date, but now I'd like a list of boxers with their last fight date, This however seems to run a query for every boxer when I think it could be done in 1 query. Am I mistaken?
[12:20:36] IGnorAND: tbuehlmann: thanks, I'll try it


[14:35:22] IGnorAND: http://jsonapi-rb.org/guides/getting_started/rails.html - I have a namespaced controller Api::V1::RhOrganizationsController - in my index I have "render jsonapi: RhOrganization.all, class: { RhOrganization: ::SerializableRhOrganization }" which yields a uninitialized constant, my SerializableRhOrganization is in my app/models folder without a namespace. What am I missing?
[14:36:35] IGnorAND: is it because I am inheriting from < JSONAPI::Serializable::Resource
[14:38:09] IGnorAND: nevermind, I'm an idiot :) My filename is incorrect


[15:46:17] IGnorAND: You can make an enum in a model. Can you also connect it to a number?
[15:48:59] IGnorAND: think I found it
[15:55:55] IGnorAND: NL3limin4t0r_afk: I have an external DB with a list of vehicle types, instead of doing an external query I wanted to make an enum with their ids
[15:56:55] IGnorAND: NL3limin4t0r: that's what I did :)
[17:08:22] IGnorAND: @NL3limin4t0r hardcoded enum. I know.
[17:08:49] IGnorAND: @NL3limin4t0r thanks for the warning :)
[19:46:20] IGnorAND: I have an api app, but in my model I have something like author_id. In my display I'd like to see author_name. With the render json it just sends author_id, do we custom build all json for foreign keys?
[23:05:46] IGnorAND: benlieb: odd, should work
[23:07:20] IGnorAND: Not sure, but maybe you missed the belongs_to and has_one in the other models: https://guides.rubyonrails.org/association_basics.html#the-has-one-through-association


[23:33:17] IGnorAND: is devise the way to go for rails api based apps?


[23:51:34] IGnorAND: is there a way to explicitly tell a model not to fetch a column? I know I can specify which columns to select which is the opposite, but takes more 'work'


[03:38:02] IGnorAND: https://codepen.io/anon/pen/JwONdY?&editable=true&editors=101 <- when removing the the first line in the JS, the code breaks. Why does the first JS line break the code?
[03:42:54] IGnorAND: nevermind, seems to be related to vue-resource
[14:24:11] IGnorAND: for correction of pluralization, should I inflect bot the camel case as well as the underscore one? inflect.irregular 'letter_of_good_conduct', 'letters_of_good_conduct', inflect.irregular 'LetterOfGoodConduct', 'LettersOfGoodConduct'


[00:51:38] IGnorAND: anyone know how to resolve webpacker image files in .vue files?
[00:52:17] IGnorAND: I came as far as <%= asset_pack_path 'images/main-logo.png' %> but this doesn't work in .vue


[15:47:36] IGnorAND: Does webpack-dev-server build a file that I can rebuild or something? I get a weird error with my webpacker, No parser and no filepath given, using 'babylon' it seems to be related to stuff I don't use/havent changed such as prettier.


[16:01:57] IGnorAND: Bchewy: try rake routes to see the routes available


[13:47:21] IGnorAND: can we in rails also make vue.erb files and use things like link_to in the vue files?
[14:31:00] IGnorAND: bitcoin.first.address?


[12:52:33] IGnorAND: I'm trying to use vue with webpack, I understand webpack does not expose globals. Is there something that can be done about that?
[13:41:03] IGnorAND: nickjj: what do you mean?
[13:41:48] IGnorAND: nickjj: thanks
[13:42:01] IGnorAND: https://webpack.js.org/plugins/provide-plugin/ Found it
[13:42:04] IGnorAND: lets see if that helps
[13:42:24] IGnorAND: which file do you place this in? application.js?
[13:43:39] IGnorAND: from rails 4 to rails 5 + vue, webpack etc is overwhelming me a little
[13:51:54] IGnorAND: nickjj: well, it seems vue 'works' but my vuetify doesn't unless I do an <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
[13:52:05] IGnorAND: so not sure what's wrong
[14:00:03] IGnorAND: yeah, guess
[14:03:44] IGnorAND: nickjj: the thing is I did not set it up, all I did was rails webpacker:install and rails webpacker:install:vue
[14:04:13] IGnorAND: and with rails things are ussually set up pretty well by default


[16:54:58] IGnorAND: running with webpack, I add <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> in my html and I see vue code, if I comment it out while I have import 'vue/dist/vue.js'; I dont see my vue code
[16:55:17] IGnorAND: I even see the same code in my packs/application.js


[01:17:20] IGnorAND: I have a list of companies with employees. I'm trying to run a to_xml, but which shows employee details per company. It seems my to_xml seems to run a select * from employees where company = 'next id' for every company. This seems to take a while. Is there a faster way to do this?
[10:00:23] IGnorAND: lupine: what does 'that is truely of the devil' mean?
[10:02:27] IGnorAND: havenwood: I'll check the indexes.
[10:07:24] IGnorAND: lupine: the includes makes it 6.5 times faster


[09:52:33] IGnorAND: https://apidock.com/rails/ActiveRecord/QueryMethods/distinct <- based on what does the distinction happen (if I have more columns I want to select)?
[10:13:30] IGnorAND: @tbuehlmann I have a list of requests of people that have an insurance (no list of people). I'd like a list of all unique people with a (in)valid insurance. I was hoping distinct could help
[10:15:46] IGnorAND: select distinct on (person_id), first_name, last_name where expire_date> Date.now or something similar
[10:21:11] IGnorAND: tbuehlmann: I did that' but then things like count start to break


[21:28:58] IGnorAND: https://dpaste.de/EJiw - Anyone know wrong here? it works in irb


[13:05:15] IGnorAND: has joined #RubyOnRails
[21:47:35] IGnorAND: How does one paginate json data? Would something like pagy be able to do that?