IGnorAND

Activity Graph

Page 1 of 1

2019-02-22

[00:12:16] IGnorAND: does a job require a 'cron thing'?
[11:04:00] IGnorAND: @havenwood no problem :)
[11:04:44] IGnorAND: @havenwood, I also , solved my previous question with the help of shared knowledge :) In my controller I have a resource, id = request.path.split('/')[3,4] @addressable = resource.singularize.classify.constantize.find(id)
[13:24:17] IGnorAND: @blackmesa if you use nodejs, I dont think you need to specify something in boot.rb
[13:32:49] IGnorAND: blackmesa: odd
[13:32:57] IGnorAND: do a forgot fbsd commands
[13:33:03] IGnorAND: ports install npm
[13:33:20] IGnorAND: I believe that was how you install on fbsd
[13:33:25] IGnorAND: haven't touched it in so long
[13:37:32] IGnorAND: blackmesa: did that work?
[13:38:20] IGnorAND: Config it again as if you were to use therubyracer. Then remove therubyracer gem from your gemfile, do a bundle install, do a port install of 'npm'
[13:57:20] IGnorAND: blackmesa: can you run npm -v in shell on your bsd box?
[14:13:50] IGnorAND: blackmesa: https://gist.github.com/nuheluxulu/48e38f3bdc5abf037f62120cf31142a9 This is in my nginx config file
[14:14:12] IGnorAND: blackmesa: I use yarn as well, but I installed npm on my server
[14:15:59] IGnorAND: I did a npm with the package manager and then a npm install yarn -g
[14:16:22] IGnorAND: blackmesa: np, we're here to help each other
[14:16:59] IGnorAND: I used capistrano, been looking into looking what mina is. You're the xth person to tell me about mina
[14:20:54] IGnorAND: well, I just recently got back into programming
[14:21:00] IGnorAND: thinking its a better way to win my bread
[14:21:08] IGnorAND: not sure if I am jumping in a big black hole
[14:23:25] IGnorAND: Haha, thanks :)
[14:23:31] IGnorAND: I'll be bugging you for help too :P
[14:28:55] IGnorAND: well, I need more help on philosphical level I think
[14:29:39] IGnorAND: Like, I am currently trying to build (yet another) HRM application. I have a model Person.
[14:31:17] IGnorAND: I am a believe that the database should be full of facts and the user interface has information (things derived from facts). So the database has a day_of_birth for a person, never an age (this is obvious). But I see that people often have a field like boolean:is_employee. I'd rather have a table with employments with a start_date and end_date
[14:32:20] IGnorAND: so if end_date is null or end_date in the past, the person is an employee. Instead of reading a boolean field
[14:33:41] IGnorAND: why would you add the boolean active? It would cause inconsistencies. People would 'forget' to alter the boolean
[14:34:25] IGnorAND: If you 'want' a boolean with active I would do a create VIEW in the DB making sure the active boolean gets re-evaluated everytime
[14:35:31] IGnorAND: Anyway, I have a list of People now. I'd like to add InCaseofEmergency contact. Not sure if I should add it to the Person or the Employment.
[14:37:14] IGnorAND: yeah, I suppose it makes sense as even if the person is no longer employed the ICE shouldn't disappear
[14:44:56] IGnorAND: I wonder if ICE should also be a polymorphic as you would most likely have a ICE for a company as well ^,^

2019-02-21

[18:10:13] IGnorAND: When doing Company.includes(:addresses).first in console, shouldn't you see the sub-objects as well (in this case all addresses)?
[18:13:07] IGnorAND: Inside: why would one run that instead of Company.first.addresses then?
[18:14:06] IGnorAND: I onderstand complexity and order of magnitude if that's what you're asking
[18:16:25] IGnorAND: Inside: thanks, that clears it up. So I'll save when I do a for loop on companies
[18:17:09] IGnorAND: no bullet gem
[18:23:52] IGnorAND: Inside: I have a related question.
[18:23:58] IGnorAND: I have a list of employees
[18:24:08] IGnorAND: they have an insurance with expiration date
[18:26:09] IGnorAND: a certificate with expiration date
[18:26:41] IGnorAND: I now would like to list my employees with their different expiration dates
[18:26:51] IGnorAND: this would probably then qualify for the n+1 rule
[18:30:06] IGnorAND: My question: how would the index query be like?
[18:31:36] IGnorAND: For the insurance I'd like a "select DISTINCT on insurance, ordering it by exp date"
[18:31:58] IGnorAND: my solution for now was to create a view in my db and create a 'seperate model' for this view
[18:41:25] IGnorAND: dionysus70: well, not exactly learn, but I liked this writeup: https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one After that I tried checking what I did wrong with http://www.betterspecs.org/
[18:43:48] IGnorAND: dionysus70: try the scotch.io one. It is more related to API writing with rails though
[18:43:57] IGnorAND: are you doing the view side with rails as well?
[18:47:35] IGnorAND: dionysus70: I recently started with vuejs. I like writing complex forms in there better
[18:48:26] IGnorAND: Well, I'm no star programmer yet either :)
[18:49:09] IGnorAND: dionysus70: Well, start making a simple app :)
[18:54:25] IGnorAND: @dionysus70 I started with vuejs. I think overall I spend more time as well, but it gets prettier, more responsive and such
[22:00:47] IGnorAND: with polymorphic models like addressable, how do I figure out what to show in the index? @addressable = Company.find(params[:company_id]) or @addressable = Person.find(params[:person_id]), do I do a does param exist?
[22:02:49] IGnorAND: @havenwood /api/v1/companies/:company_id/addresses vs /api/v1/people/:person_id/addresses all come down to the same controller right
[22:03:27] IGnorAND: so for index I do a if(params.has_key?(:company_id) else if (params.has_key?(:person_id)?
[22:03:51] IGnorAND: and everytime I add adressable I modify the if statement again?

2019-02-16

[11:35:22] IGnorAND: never tried non ascii chars in irb

2019-02-15

[17:55:54] IGnorAND: I see pick is something in ruby 6. I have however been using first. Is there a difference between .limit(1) and .first
[22:30:40] IGnorAND: havenwood: cool, thanks. so there should be no performance penelty for me. i have a default scope with an orde
[22:39:44] IGnorAND: is it possible to create a migration for a view - https://stackoverflow.com/questions/4503632/ruby-on-rails-activerecord-sql-view-into-schema

2019-02-11

[22:01:57] IGnorAND: anyone know a rails api app which I can study? Most 'examples' I see seem to just expose the database tables. Hardly seems like an api. Obviously you can work, but then 'fat' models make no sense as most logic almost goes to the view

2019-02-09

[12:20:18] IGnorAND: Does rails sent out headers on a 304?

2019-02-08

[13:47:34] IGnorAND: Anyone use https://github.com/lynndylanhurley/devise_token_auth? I don't seem to be getting a access-token on a new request. Am I missing something in my controller?
[13:51:42] IGnorAND: Nevermind, found it. I need include DeviseTokenAuth::Concerns::SetUserByToken
[21:22:23] IGnorAND: I think rails is sending a content didnt change but I need the headers to get sent. Is there a way to force that?
[21:33:00] IGnorAND: havenwood: I made a --api app in rails. When logging in with my vuejs app I seem to get an authentication token. When doing subsecquent requests I do not. With Curl, postman etc it seems to act as expected. Not sure where to look where its going wrong. Expecting maybe puma decides to just get the data from cache and not send the header

2019-02-05

2019-02-04

[14:41:10] IGnorAND: @liya active?
[17:42:14] IGnorAND: @liya cause it looks like the channel is a bit dead :)
[17:46:39] IGnorAND: I have a model which has several has_many relationships. I'd like a view with the list of the primary model with a SELECT DISTINCT order by created of all the submodels. Is this a normal thing to do? It seems easier to create a view in the DB and a 'seperate' model for this view.
[17:48:23] IGnorAND: Employee has_many DriverLicense, many HealthInsurance etc. They all have an expiration date. I'd like to see when someone has a expired driverlicense, insurance etc
[19:16:45] IGnorAND: @syndikate Doesn't https://github.com/fxn/zeitwerk#motivation anwser your question?
[20:01:05] IGnorAND: ACTION wonders what a mounted API is
[20:05:22] IGnorAND: ow cool, I just barely made one rack app with an api :)
[20:24:08] IGnorAND: I have a model which has several has_many relationships. I'd like a view with the list of the primary model with a SELECT DISTINCT order by created of all the submodels. Is this a normal thing to do? It seems easier to create a view in the DB and a 'seperate' model for this view.
[20:24:14] IGnorAND: Employee has_many DriverLicense, many HealthInsurance etc. They all have an expiration date. I'd like to see when someone has a expired driverlicense, insurance etc

2019-02-02

[18:43:48] IGnorAND: has joined #ruby
[18:55:34] IGnorAND: Hi, I have a factory (factory bot) which creates a Gender, and one which Person which belongs_to such a gender. In my factory I did association :gender, factory: :gender, but now I have several male/female 'genders'
[19:00:47] IGnorAND: How do I do something like find or create with the gender

2019-01-29

[16:27:14] IGnorAND: Is it possible to edit a model (by means of a form, PUT via js or something) without allowing one to edit a certain field?
[16:30:32] IGnorAND: aah, I think I figured it out, use a params.require(:model).permit() for the update

2019-01-26

[16:58:04] IGnorAND: @thoraxe I believe pagy was recommended
[17:05:28] IGnorAND: I believe pagy replaced willpaginate and kaminari - https://github.com/ddnexus/pagy
[17:05:41] IGnorAND: well, someone recommended it to me and it seemed great

2019-01-24

[11:23:43] IGnorAND: I'm trying to use database_cleaner to delete my db for the tests, is there a way to do rake db:seed RAILS_ENV=test after the db has been cleaned?
[11:29:14] IGnorAND: I think I found it. I can run Rails.application.load_seed in my Rspec.configure in config.before(:suite) do
[15:03:02] IGnorAND: param is missing or the value is empty: customer <- is there a way to see the params which go in my test?
[15:03:19] IGnorAND: The controller works fine as I can perform the tasks with http
[15:06:01] IGnorAND: I think I need to add the Content-Type: application/json; charset=utf-8
[15:43:05] IGnorAND: Anyone know why I am getting missing params: https://gist.github.com/nuheluxulu/d9ad244687f45beacaaf6c691bb7bfe9#file-customers_spec-rb-L4
[15:48:00] IGnorAND: @fox_mulder_cp did you see the console version
[15:48:28] IGnorAND: https://gist.github.com/nuheluxulu/d9ad244687f45beacaaf6c691bb7bfe9#file-console-L1
[15:55:12] IGnorAND: @fox_mulder_cp is there a way to see what the rspec environment sends to my server so I can see what's going wrong?
[15:56:54] IGnorAND: And a good way to see what I described would be?
[15:59:19] IGnorAND: @fox_mulder_cp https://gist.github.com/nuheluxulu/d9ad244687f45beacaaf6c691bb7bfe9#file-diff_rspec-rb-L3 this gives a different error, but not sure if I made it better, that's why I'd like to see what rspec sends
[16:07:07] IGnorAND: @blackmesa have you been able to send text?
[16:08:14] IGnorAND: blackmesa: through parameters
[16:08:25] IGnorAND: my 'curl' seems to work fine.
[16:08:32] IGnorAND: it's my rspec that seems to fail
[16:09:18] IGnorAND: blackmesa: https://gist.github.com/nuheluxulu/d9ad244687f45beacaaf6c691bb7bfe9#file-console-L1 <- https://httpie.org/ is my curl.
[16:10:00] IGnorAND: @blackmesa https://httpie.org/doc#file-upload-forms seems to upload files
[16:14:53] IGnorAND: aah, ok :) sorry can't help you. I seem to need to learn much more first :(
[16:15:16] IGnorAND: @blackmesa my http post works, so no need for the -F, its my rspec that breaks
[16:18:26] IGnorAND: @blackmesa https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one <- I made a new project and did this step by step, but this is API only, and this seems to work without the wrapping
[16:18:57] IGnorAND: @blackmesa I also tried it like that: https://gist.github.com/nuheluxulu/d9ad244687f45beacaaf6c691bb7bfe9#file-diff_rspec-rb-L6
[18:40:41] IGnorAND: @blackmesa I am trying to switch to vuejs
[18:40:51] IGnorAND: makes it a lot better to oversee the code
[18:43:23] IGnorAND: @blackmesa that's what I am trying yeah. I have 1 project I'm trying to do as two seperate servers, and 1 where I'm trying to display the vuejs in the same rails server
[18:45:09] IGnorAND: @blackmesa I wrote in it years ago, am trying to catch up again
[18:45:36] IGnorAND: I'm thinking there is more value in creating solutions as a programmer
[18:49:02] IGnorAND: I havent used that
[19:12:08] IGnorAND: @blackmesa so why did you pick minitest instead of the others?

2019-01-18

[18:43:22] IGnorAND: https://devise-token-auth.gitbook.io/devise-token-auth/usage Anyone know how to create a user? The schema only seems to have an 'encrypted_password' field. Even something like User.create!({:email => "foo@bar.com", :encrypted_password => "HardPassword"}) seems to fail

2019-01-17

[00:15:09] IGnorAND: default_scope { joins('INNER JOIN security_id_request ON security_id_cards.request_id = security_id_request.id') } <- how can I make this into an include?
[01:32:06] IGnorAND: nevermind, I figured it out, it's based on the has_many and belongs to relationship
[01:34:34] IGnorAND: I thought the includes allowed me to eager load the stuff. But it seems I still get 2 seperate select statements
[02:23:16] IGnorAND: did you import it in the main.js?
[02:24:05] IGnorAND: thoraxe: in vuejs it's main.js
[02:24:12] IGnorAND: Dont recall what it should be in rails
[02:24:19] IGnorAND: guessing application.js or something
[02:26:15] IGnorAND: I just recently started with webpacker etc, fought a lot with it, dropped it for vuejs + rails --api, so I dont remember much
[02:26:29] IGnorAND: let me check if I have an old project
[02:27:35] IGnorAND: in my layouts/application.html.erb I have a <%= javascript_pack_tag 'application' %>
[02:27:48] IGnorAND: in that application.js is where I placed my imports
[02:31:31] IGnorAND: that sounds good

2019-01-15

[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?

2019-01-11

[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

2019-01-10

[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

2019-01-08

[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

2019-01-06

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

2019-01-02

[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'

2018-12-31

[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'

2018-12-30

[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

2018-12-29

[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.

2018-12-28

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

2018-12-26

[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?

2018-12-23

[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

2018-12-22

[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

2018-12-20

[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

2018-12-18

[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

2018-12-16

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

2018-12-15

[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?