#RubyOnRails - 24 April 2017
« Back 1 day Forward 1 day »
[01:18:06] cerulean: can anyone recommend me a CMS for rails5 honestly i tried spina and mexican couch and didnt like it much
[01:22:37] cerulean: im looking at nesta, its sinatra, but i agree with you. should i use drupal? this isnt for a serious software project its for a personal website
[03:15:36] havenwood: mroutis: The award is no more. It has been discontinued. You can watch patch RailsConf award videos to learn more about historical awards.
[03:29:58] mroutis: reading the rails doctrine, it talks about "convention over configuration", but how this "conventions" are decided and by who? does scaffolding represent this conventions?
[04:27:31] Radar: mroutis: Hi :) The conventions are decided by the Rails core team and have been formed over at least a decade.
[04:28:08] Radar: mroutis: scaffolding isn't necessarily a convention... more of a feature. I think of conventions more like that every Rails app has the app's code in the "app" directory and database config is in a file called config/database.yml (usually)
[04:39:19] dminuoso: Though scaffolding makes use of certain conventions, such as that an action will by default render a template with the same name.
[04:40:48] dminuoso: Radar: By the way, I have finally found the final nail in the coffin for why AMS is ultimately superior.
[06:40:50] hadricus: Having an issue on OSX with rbenv and brew, where Sidekiq is being loaded twice (apparently). Wondering how to find a cause. https://gist.github.com/nmanzi/73beb4ef6457b16fc9c7e5451c8e867f
[06:42:28] dminuoso: hadricus: The fastest (and dirtiest) way would be to to open your sidekiq-4.2.10/lib/sidekiq/version.rb and modify it to log the output of Kernel#caller
[07:17:53] morfin: i need to wait till all tasks before D finish and only then process D, but after D goes news tasks E,F,G which should be always processed after D
[07:55:49] alaing: I'm building a gem and would like to include some js/css so far I've created a single css under my gems vendor/assets/stylesheets/_my_date_fields.scss and then in my app i try importing it into my application.css.scss using @import 'my_date_fields' but my application cannot find the file
[10:27:44] donnib: i have this https://github.com/komagata/fastclick-rails which i have added as per instructions, in my erb file i added new FastClick(document.body); as per instructions (at least that's how i read them) but i get the error FastClick is not defined. any ideas what i am doing wrong ?
[11:53:30] mauro1254: Hi folks! Is there a page with a list of middleware I can include in a Controller extending ActionController::API in order add functionalities back? I need to use helpers in jbuilder templates, but it seems they are not available.
[11:59:33] universa1: mauro1254: you can list the middleware stack.. compare it to a default rails app
[12:18:39] dminuoso: mauro1254: Though adding middleware blindly seems a bit silly. Is there something in particular you are looking for?
[12:20:00] mauro1254: I probably need to include modules in the controller extending ActionController::API
[12:20:28] dminuoso: mauro1254: The Rack (this should give you a hint already) middlewares basically allow special treatment of requests.
[12:20:36] mauro1254: Something similar to https://stackoverflow.com/questions/14752935/how-to-use-view-helpers-with-rails-api-gem
[12:20:43] dminuoso: mauro1254: It's comparable with the componse() function from functional programming.
[12:21:12] mauro1254: dminuoso : is there a documentation about ActionController::API? I would like to know what to include in order to bring features back.
[12:21:41] dminuoso: mauro1254: http://edgeguides.rubyonrails.org/api_app.html#choosing-controller-modules
[12:21:54] dminuoso: Im looking at that currently to figure out what module would introduce helpers to templates.
[12:30:46] dminuoso: mauro1254: By then chosing the JSON:API adpater I can just start describing models and passing control over what fields and relationships are needed to the client. It's pretty cool.
[12:39:06] pavelz: hi I am getting deprecation warning on sprockets and it directs me to https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors but where do I put that code? does not work if placed in initalizer file
[12:57:08] universa1: and again, unless you load a custom(written by yourself) sprockets extension inside your app, this code is not going inside an initializer.
[12:57:45] dminuoso: https://gist.github.com/pavelz/cc45cc8d68bf1b361e3c0cf4f0acf833#file-gistfile1-txt-L3
[13:01:57] dminuoso: pavelz: ^- what he means to say is: fork the repository, commit your change, make a pull request.
[13:02:43] dminuoso: While you are at it you might want to check the origial repos issues and commits whether this is possibly being addressed already.
[13:03:49] pavelz: well Old sprockets were deprecated and i wonder what I would do, this link was given in the warning code how to get rid of those warnings: https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
[13:04:35] universa1: pavelz: first step: figure out which gem is triggering the deprecation warning...
[14:19:43] pavelz: trying to joust with spring , suspend not working figured out that guard-rspec gem interferes with spring singnal handing.
[15:17:12] beauby: dminuoso: "why AMS is ultimately superior" - superior to what? (Also, if you do json:api, you should check out http://jsonapi-rb.org )
[15:29:44] GeorgesLeYeti: Here I want to select the 1st " (the one before my) and the 3rd " (the one before is)
[15:30:29] GeorgesLeYeti: Btw I don't want to select the space " because the sentence could be hello"my name " is ...
[15:35:08] dminuoso: morfin: It was really stupid in the beginning because I kept handwriting all these jbuilder templates to create horribly nested respones, and then in my redux layer I completely normalized it again..
[15:35:26] dminuoso: And I ended up with custom implementations of things that were already part of the JSON:API spec..
[15:35:34] ravster: morfin: Do you use jsonapi with activemodelserializer or with something else? I tried it for a little bit on a new project but found it too clunky so I went back to Oat::HAL.
[15:36:37] ravster: dminuoso: Maybe I'm just too used to oat-hal; I used it for >2 years on a previous project.
[15:36:55] dminuoso: ravster: Fair enough. I think this is actually a good point, a lot of libraries are quite usable.
[15:42:42] ravster: https://github.com/rails-api/active_model_serializers recommends using its built-in JSONAPI output mode
[15:43:31] beauby: dminuoso: Agreed that doing json:api with jbuilder is unnecessary pain. AMS is awfully slow though
[15:45:54] morfin: you basically create app/resources where put your resources(all relations are grabbed from models) then define route like jsonapi_resources :hotels(creates REST methods unless only used)
[15:59:35] catphish: kind of a feature request / point for discussion: a way to destroy an object in such a way that all dependencies are recursively removed with delete_all
[16:00:02] catphish: sometimes i want to remove an object, and all its children recursively, with absolutely no regard for the consequences
[16:05:07] catphish: dependent: :destroy does several things, it actually gets every child object and runs destroy on it, this is usually fine, but for very large trees of objects it can take a long time
[16:06:09] catphish: i just wondered if there might be a faster way to do it, like a delete_all_recursive
[16:06:39] catphish: but i realise there's got to be a lot of recursion still, a lot of state in the ruby app
[16:07:40] beauby: catphish: Depending on what you're doing, if you only acess your tree through its root, you could just delete the root, and periodically run a job that deletes unrooted elements
[16:08:16] catphish: i suppose i could just look at every object, follow it up the tree and delete it if it's orphaned
[16:08:41] catphish: in fact i could just look at every object and delete it if its immediate parent is missing
[16:09:31] dminuoso: catphish | kind of a feature request / point for discussion: a way to destroy an object in such a way that all dependencies are recursively removed with delete_all
[16:09:45] ravster: also, that method requires that your DB tables don't use foreign-key verification.
[16:10:26] catphish: dminuoso: yes, the database might be able to help, i've actually never used db foreign keys
[16:11:55] catphish: rails has always handles dependencies perfectly, i've never had any cause to delegate it to the database
[16:12:48] catphish: well, not forcefully, you can choose to call delete instead of destroy and leave something orphaned
[16:12:51] ravster: catphish: Never used mariadb, but it probably supports foreign-keys. I highly recommend them, even if rails handles the associations. I find comfort in having relationships enforced at the DB-level instead of only at the application level. ymmv
[16:13:23] catphish: ravster: yeah, it makes sense, i was just never taught to do it that way i guess
[16:13:44] catphish: this would certainly solve my problem anyway, letting the database cascade the delete
[16:14:02] dminuoso: catphish: You miss the point. The purpose of database constraints is to enforce something you assume.
[16:14:04] ravster: catphish: thats fine. I didn't know about foreign-keys for a long time either. Then the inconsistencies bit me in the ass.
[16:14:22] dminuoso: catphish: Because if at some point your database gets inconsistent you have a real problem on your hands.
[16:14:43] dminuoso: You can't reason about the database anymore. It's one of the reasons I dislike polymorphic associations so much.
[16:14:47] catphish: dminuoso: i've honestly never had a problem with it, using destroy properly, rails keeps track of everyhting as it should
[16:15:17] dminuoso: catphish: Add a foreign key. It still works, except the database suddenly makes a *guarantee* out of a *contract*
[16:18:06] dminuoso: catphish: A very trivial scenario where rails cant protect you from: 2 concurrent threads. One thread receives an update to apple.bag = Bag.find_by(name: "Blue bag"); apple.save!; and the other thread receives a statement Bag.find_by(name: "Blue bag").destroy!
[16:18:15] dminuoso: catphish: Suddenly your database is screwed up. Rails could not protect you from this.
[16:20:08] dminuoso: catphish: So suddenly you start introducing highly expensive and highly exclusive locks for absolutely no reason?
[16:22:06] dminuoso: catphish: I could come up with more scenarios that could shred the database even with excessive locking.
[16:23:08] dminuoso: But then again Im a conservative bastard with poor temper that likes to pick on newcomers.
[16:23:15] catphish: if it even mentioned in the manual? http://guides.rubyonrails.org/association_basics.html
[16:23:54] dminuoso: catphish: I suppose one problem with the foreign_key bit is that a lot of things in the tutorials are based on "getting things done quickly"
[16:25:03] catphish: nah, i'm good, i just wanted to justify my non-use of it in the face of your abuse :P
[16:29:33] dminuoso: catphish: Thats why i lock myself into one particular engine and start using specific features.
[19:52:39] mordof: does anyone know if ActionController::Parameters decided not to allow & on purpose? or if there's any harm in adding it
[20:18:36] pavelz: i've had some sort of trouble with is in 4.2.8 but after disabling guard-rspec it started functiononing properly. w/stock rails5 suspend does not disengage from the the terminal
[20:19:12] pavelz: ctrl-z suppose to suspend the program and it should cease interacting w/termianl.
[20:19:35] mordof: i get dropped to a normal terminal - but not sure if it would still output logs to it
[20:20:06] pavelz: https://www.google.de/search?q=rails5+spring+suspend+ctrl-z&oq=rails5+spring+suspend+ctrl-z+&aqs=chrome..69i57.9719j0j7&sourceid=chrome&ie=UTF-8#q=rails+5+spring+suspend+ctrl-z+console+does+not+work
[20:21:47] pavelz: and can't even kill the spring either. for some reason it does not respond to TERM>
[21:07:44] whatasunnyday: Hi, I had a question about nested resources. In my new action, I call current_user.projects.build. Is there a difference between that and Project.new for the new action? For my create, I know I should use current_user.build.projects so it sets the id of the current_user automatically.
[23:37:57] carlosd: When using turbolinks 5 can I take it for granted that the jQuery ready event will not be triggered?