#RubyOnRails - 30 January 2016
« Back 1 day Forward 1 day »
[00:12:52] blackmesa: hi all. I want to use an each-do-block inside an each-do-block. Unfortunately what comes after the second is ignored https://gist.github.com/anonymous/fa5485b9fb0a7f1f481a
[00:19:04] Vert`: Hey gang, this may be more generally Ruby but.. for the sake of garbage collection, I'd like to wrap some processes in a scope of their own, so that local variables die once it's complete. Would a begin..end block suffice you think?
[00:21:45] Vert`: I would think so but I'm not seeing a difference in my resource monitor.. Then again, it could just be that the local vars I'm testing don't have as large of a footprint as I thought.
[00:22:31] matthewd: Vert`: 1. No, GC will clean up when it feels like it. 2. Even when it does, it generally won't give resources back to the OS.
[00:23:31] Vert`: matthewd, "it generally won't give resources back to the OS" that part in particular is problematic.. You're saying the same would be the case if I say wrapped them in a method, or manually set vars to nil?
[00:31:49] Vert`: matthewd, though, do you know if when Ruby does stop using that memory space without surrendering it back to the OS, it reuses the space down the line before allocating new addresses?
[00:32:29] smathy: blackmesa, you're having a problem where what's coming after the second each is not showing up, and you think what's after the second each is not relevant?
[00:42:52] Vert`: Are you asking if RoR 3 is used in production environments? Cause the answer is yes.
[00:45:04] underplank: Okies. well I???ll ask here. Im using postgres and want to use the inbuilt enum type rather than the one in Rails. I???ve been able to create a migration, but when the schema.rb gets dumped it errors out with https://www.refheap.com/114245
[00:45:57] underplank: I have to execute a custom sql to create the enum type. and then use an call to add_column to add the column.
[03:44:09] jimmtt: I'm trying to install the mysql2 gem but it fails to build the native extensions even though I've installed libmysqlclient-dev
[05:04:13] mices: i'm reading here https://medium.com/rails-ember-beyond/how-to-build-a-social-network-using-rails-eb31da569233#.cdojrtwvg where they tell you to use a form on an index page with form_for(@post) but @post hasn't been instantiated yet because there was no new action to instantiate it so how does the author expect this to work?
[05:15:19] mices: fryguy: they don't show you the home_controller.rb file, they only show you the rails generate command that creates it
[06:32:16] silverdust: when generating migration for change_column how should it be written? should I just use the rails g add_column_to_table existing_attr:type
[08:57:09] KucukMubasir: why can???t i update the integer field of the model on console ? model.value = 3 , model.save! yet it still shows nil :/
[09:08:54] KucukMubasir: I was chain calling it, like Plan.first.books_allowed = 2 , and assignment wasn???t carried out, but just the query
[09:28:25] KucukMubasir: sevenseacat: but only ???select??? query is called, not ???insert into??? after running this: Plan.first.books_allowed=14
[09:28:56] sevenseacat: KucukMubasir: because you're not calling save anywhere, like you did in your initial example code
[10:07:21] fahrradflucht: I try to pass self to a scheduled mailer in before_save because I want to store a reference to the delayed_job ID on the model. Problem: I get an error, because if the model is new, there there is obviously no ID on the model and it can???t be serialized??? any ideas?
[10:10:07] fahrradflucht: arup_r no I want to store if an attribute is present that could be on a new model as well
[10:14:02] arup_r: if you need model id, then before_save is not the right tool when it is a fresh record..
[10:14:59] fahrradflucht: arup_r: I thought about that, but how I then save the delayed_job IDs on the model without entering an infinit loop saving?
[10:17:52] arup_r: well, then just don't use the callback. Write a simple PORO, and from the controller do it.. it will be in your controll.
[10:19:12] arup_r: or, if you still want to use callback. then use after_create and when you will be updating, use the update method which don't run callbacks ? also use after_update callback to update and use genrall update which runs callback.. do you get me ? :)
[10:22:11] arup_r: but better is write a simple ruby class, where you will pass the object and do that stuff inside it.. it is simple..
[13:12:39] taxen: Hey guys. I'm trying to write a method that recieves a base64 image and should write this file to this, via Carrierwave.
[13:15:11] taxen: Now I'm struggling to understand how to create an avatar object and get the file connected to the image uploader.
[13:18:24] Depili: anyone know a way to generate the signed and encrypted session cookie from ruby code? (in my case I will have several raspberry pi clients that will be needing a set of cookies that need to be put on the sd-cards into a sqlite db)
[13:18:40] Depili: best I have found is this http://blog.bigbinary.com/2013/03/19/cookies-on-rails.html
[13:20:19] chr5: Hi guys ! I have a project maked with rails 3.2.13 and ruby 1.9.3 , do you think is a good idea update rails version to 4.x?
[13:21:04] Depili: oh, and then I found the root answer to my own question: http://api.rubyonrails.org/classes/ActiveSupport/MessageEncryptor.html
[13:41:35] qurve: Is there a way to make asset precompilation not dependent on a database? I'm trying to do a precompile of assets in a docker image, but there's no database so it blows up. Which is sad.
[13:41:50] qurve: Or, if someone else has experience in dockerizing rails apps that knows a better way, I'm all ears.
[14:23:34] pwnd_nsfw: you have like... 2 different controllers there named the same thing. I guess I'm paying attention to the second one
[15:18:20] chridal: When running a Rake task that is in lib/tasks/*.rake why does it take it so long to run? I just added a puts statement to it. Is this because it's loading the Rails app first or something?
[15:37:05] chridal: pwnd_nsfw: Oh? Is it possible to disable Spring just for the rake task? I don't need anything from the Rails app in these tasks. They're for setting up Docker stuff
[15:39:21] Doddlin: I want to make the simplest of forms, I will enter a number in a text_field, hit submit and it should return ???True??? or ???False???. However, as I have set it up now, I get ???TypeError, no implicit conversion of Symbol into Integer???
[15:53:02] arup_r: give some more above on it https://gist.github.com/anonymous/ebc4a1df1550285592a4#file-error
[15:54:13] Doddlin: Hmmm, I want to use that form to enter a tanknumber, click ???check??? and get back the current status of that tank
[15:55:25] pwnd_nsfw: Doddlin, he means that there's more to the stack trace than what you've posted
[15:55:36] pwnd_nsfw: but essentially, it's the fact that you have a symbol in your form, and not an object
[15:57:06] arup_r: Doddlin: go to link http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for read, For a generic model object, a form can be created by passing form_for a string or symbol representing the object we are concerned with:...
[15:57:21] Doddlin: pwnd_nsfw, get '', to: 'dashboard#check_tank', as: '/check_tank' (under namespace loadingstation)
[16:02:36] mrchris: I'm writing a rails template but having issues amending and replacing certain files such as application_controller.rb. Simple put, my changes are replaced by the default files Rails generates during new. Does anyone have any insight to this? Its difficult to google because most results pertain to either generators or views templates.
[16:05:10] mrchris: Its weird because its not just the copy_file command either. For example, insert_into_file "config/locales/en.yml" [changes are not there after new completes]
[16:05:41] mrchris: I've tried everything I can think of so far. I have these commands at the end of the file too.
[16:06:28] chridal: pwnd_nsfw: Tested with and without and for a test suite of 222 tests it took the same time with and w/o spring
[16:06:32] mrchris: My gut feeling is Rails does something special with "core" files. My next stop will be looking into the rails new task
[16:07:08] chridal: pwnd_nsfw: But! After removing Spring from the project it still doesn't run the rake tasks any faster
[16:07:49] fryguy: __chris: what file are you putting these "commands" in. nobody is still sure what you are actually doing
[16:08:20] mrchris: these commands are going into template.rb. Usage: rails new foo_app -m template.rb
[16:09:25] chridal: pwnd_nsfw: Well it's fine the speed that the tests run. I just need rake to execute faster
[16:11:29] Doddlin: My form is working no, at least partially, I was using f in the form right before that, hade to change letter
[16:12:04] Doddlin: loadingstation_check_tank GET /loadingstation(.:format) loadingstation/dashboard#check_tank
[16:14:57] mrchris: fryguy, because i've made customizations to those files that i want copied into the new project
[16:21:15] mrchris: If the file exists already in the new rails project Thor will confirm removal of the file. Since I want this fully automated, removing the file will prevent the script from stopping and asking about it.
[16:26:39] mrchris: the method source_paths returns file sources. The overlying system uses files it finds in those directories
[16:27:10] mrchris: so, when remove_file is called, it removes it from the new rails app. when copy file is called it copies from where the replacement files are stored
[16:38:07] Doddlin: how come ???url: loadingstation_check_tank_path??? does not go to that action despite my routes stating
[16:38:14] Doddlin: loadingstation_check_tank GET /loadingstation(.:format) loadingstation/dashboard#check_tank
[16:43:32] kitsuneyo: i have a users/show action that any visitor should be able to access. i set my pundit user_policy to def show; true; end. it redirects for people who aren't signed in
[16:49:47] arup_r: was that included in the gist that you shared first time ? I think no.. your gist was half baked hehee
[16:59:16] Doddlin: I have an If/Else-statement that I want to redirect to the same page but with different flashes
[16:59:53] Doddlin: before ???else??? I do ???redirect_to loadingstation_path??? - works fine, no error
[17:00:00] pwnd_nsfw: Give us relevant code, tell us what you want to happen, tell us what is happening
[17:03:37] arup_r: it should go up https://gist.github.com/anonymous/fd1cf6b4371454a3d16c#file-controller-rb-L30
[17:06:40] Doddlin: undefined local variable or method `loadingstation_path' for #<Loadingstation::DashboardController:0x0000010bc2dd08>
[17:10:36] Doddlin: I will leave my computer and get back when I have smashed my head to the wall for 2 hours
[17:11:24] Doddlin: yeez, there is no surprise I get nothing done during my days, only chasing my own errors
[17:13:25] Doddlin: pwnd_nsfw haha that is to true??? I have built one service though, but the amount of google in there is massive
[17:13:55] norc: Hi. I have the need to query an external API for some resources. For that I initially thought about delayed_job for ease of implementation, but I need something that allows for rate limiting (I may only poll the API 200 times per hour)
[17:16:09] Voyage: I might be sllightly off topic but can anyone help? http://pastie.org/10701958#12-13
[17:16:42] Doddlin: arup_r, probably also because we just degraded our server, taking it back to Free plan
[17:16:49] norc: Or more precisely, I have a bucket of potentially thousands of jobs, but I only want them to be done 150 at a time.
[17:19:23] norc: (And I really want to avoid using something like sidekiq with sidekiq-throttle since I do not want to add a redis as a dependenc)
[18:08:38] elshaka: I'm upgrading a 3.2 app to 4.0, there seem to be changes with inflections and now activerecord points to non-existent tables
[18:12:08] zombiewithlasers: Hi everyone. Does anyone have a good idea what the freelance market for Rails is like in the US right now?
[18:16:18] chridal: When you're running a Rails app (in my case an API) on AWS with ElasticLoadBalancer do you still use something like nginx as a reverse proxy in front of puma? Or do you just use the load balancer?
[18:18:48] arup_r: zombiewithlasers: I can take you to one community where you can ask this. If interested share me your email..
[18:20:31] arup_r: chr5: please show the rails server log.. error is saying though you what is wrong..
[18:22:18] arup_r: or it is available too where you ran the rails server with command like `rails s`
[18:25:35] Andr3as: chr5: like i said, insert a new line before line 11, put "fail" on that line and do what you wann do
[18:31:49] chr5: i introduced the code into the fuction, i tryed to upload an image, and i recorded tail log
[18:48:42] chr5: can someone explain how can i copy a git repository to create a new ? clone? export?
[18:57:11] arup_r: chr5: You have issue in understanding rails fundamental. Get a book which suits you, and make your base good. It will help you to pick up rails fast.
[18:58:43] chr5: Thaks you arup_r, i try learn, can you recommend any book? I have Agile development with rails..
[19:00:03] chr5: I have not finished...i started to do the project, but i am very interested to advance in my new project, colaborative
[19:00:16] arup_r: if not please do it first, or pick some other book, like Rails 4 in action, Ruby on Rails tutorial.. any 1 or 2 book will give you the foundations.. The app you are writing is not the app the book you have taught us.. :D
[19:01:01] arup_r: ok, good chr5, finish the book.. give it some time.. and if you have issue with understanding anything there.. ask here..
[19:01:35] arup_r: but before rolling your own app, get familiar with the environment or framework etc ..
[19:03:02] arup_r: I don't know from where to start.. here the issue is when you are submitting the form, you are not sending the id which u used inside the .find(params[..]) here
[19:03:39] arup_r: if you check the server log, you will see Rails shows a prams hash.. and go and see the hash, you will see it is `nil` there
[19:21:42] smathy: chr5, basically yes, but strong_paramaters plays a part here too, your Design will only be created with whatever parameters are allowed through that filter in your controller (or that you set individually)/manually.
[19:33:45] chr5: smathy: my design model say: attr_accessible :description, :title, :image , :user_id
[20:42:47] StaticVo1d: chr5: just enter the first couple character of the handle and then hit <tab> (Assuming you are referring to IRC)
[20:46:38] StaticVo1d: chr5: Yes, so you just mentioned me, so YOUR name changes color for me. Notifications depend on the IRC client you are using, haven't really looked into that, but you an set it up so it beeps
[20:49:07] StaticVo1d: chr5: just to a search for 'xchat notifications' I'm sure you'll find how to set it up. I'm using IRSSI
[20:49:31] smathy: chr5, ah, I see. You should lead with that in future btw, people in here assume a recent Rails version. So yes, if the attribute is in your attr_accessible and comes in from your form, then it should be created/updated in your model.
[20:49:44] chr5: StaticVo1d, now, i recived a notification... every time i have mentioned i recibe this notification , not ploblem, thanks
[20:51:05] chr5: smathy, You mean that in desgin model, i have to: attr_accessible :description, :title, :image , :user_id , so i recibe user_id right?
[21:05:45] chr5: smathy, i want to make a copy of my project, i use git, can i copy the app rails folder or must i introduce some special git command?
[21:06:14] chr5: smathy, I have a app rails project, i want to make a new folder , to create a new repository to start a new project with the old code
[21:07:44] chr5: smathy, in subversion i used svn xport folder and then i got the project with out subversion hide folders
[21:08:05] smathy: chr5, just copy the whole dir, and then delete the `.git` folder in the copy and `git init` again there.
[21:15:54] fox_mulder_cp: chr5: hm. i have a solution - read git giudes, may be copy foolder with project and delete .git bad idea...
[21:18:04] TheMonster_: Hi, I'm trying to setup a test app on Heroku rails 5.0.0.beta1.1. I'm having a problem getting ActionCable to work. Console says WebSocket connection to 'wss://sustain-game.herokuapp.com/cable' failed: WebSocket is closed before the connection is established. Does anyone have an idea about this?
[21:19:20] chr5: fox_mulder_cp, what rails folder of my app must i send to github? app folder, Gemfile? .ruby_version and ruby_gemset?
[22:17:31] alonkooks: whats the easiest for a college kid that doesnt know jack shit except some codeacademy html css bootstrap
[23:51:21] l4v2: I was asked by a company to make a website. He says "He is going to hear other offers." I am a new college graduate. Should I write a business proposal? What do most companies do in this situation?
[23:57:12] nickjj: for small projects i don't mind giving basic quotes for free because it doesn't take too long to make an accurate quote
[23:57:20] l4v2: I called him to see what he had in mind for the new site, but right now, there is no data, jsut all front end, but a lot
[23:57:55] nickjj: but for larger projects (more than a few months, let's say hundreds of hours), i tend to do this as a "project discovery" service, which really fleshes out the features and in return allows you to make an accurate quote