#RubyOnRails - 16 April 2017
« Back 1 day Forward 1 day »
[00:07:28] fryguy: wkoszek: bundler configuration tends to vary by environment, especially when using --deployment
[01:55:10] willyham: is ruby on rails good enough performance wise to support a mobile api on top of the normal web server
[02:12:40] wkoszek: I think you just need to lookup the bigest consumers of Rails and see what their workload is and compare it t yours.
[02:30:19] wkoszek: Bad performance of your code is a good problem to have. Typically it's less of an issue for all of your 5 users :)
[10:52:08] willyham: Hey all. We are proposing ruby to our client but he is telling us that “mainly lack of good devs out there using it”
[10:56:42] willyham: We are a development company that is going to be creating the project and passing it on to a team they build
[10:59:29] willyham: PHP is what I think they are pushing for because they have done projects in that language before
[11:01:38] sevenseacat: what technical reasons do you have for wanting to do the project in rails? (and 'i love rails' is not a valid answer)
[11:02:26] dminuoso: My reason was "I have a really cool Rails icon. If we use rails we can re-use that and save ourselves some time"
[11:07:02] dminuoso: 12:58:46 dminuoso | willyham: Ask them whether they consider PHP to be popular. Or Perl. ??? arielserafini
[11:07:04] dminuoso: 12:58:54 dminuoso | If they do, point out that Ruby is more popular than both. ??? arBmind
[11:09:07] tbuehlmann: because I don't see how ruby is more popular than php, but also, I don't have any sources for that, it's just a feeling
[11:09:41] tbuehlmann: but I do see a point when willyham says the development using ruby (or are we talking rails?) would be faster. how is that not an argument?
[11:10:27] sevenseacat: and really, you should know what language you're using before you go quoting anything.
[11:11:23] sevenseacat: and its not the only argument important here - given the client is building a team to maintain the app afterwards
[11:11:48] dminuoso: So with that in mind, they care about reasons that have an impact on maintainability.
[11:12:52] willyham: Well that is the thing. Ruby and PHP are very similar in advantages and disadvantages.
[11:18:34] pankaj: I am using paperclip gem to upload images to my rails application. Everything is fine but problem is that it always points to the default image which is Missing.png and cannot find my submitted image. What is the problem?
[11:27:39] sevenseacat: pankaj: if you can gist some code relating to your problem at http://gist.github.com/ that would be helpful. not pics.
[11:38:24] sevenseacat: pankaj: I suspect params[:post] is nil when you submit your form - can you paste the logs of what happens?
[11:42:35] pankaj: I first went to index Page. I pressed 'Create new Post'. I created the post and then returned to index page.
[11:44:16] sevenseacat: params[:post] is not set, because you're using form_tag as opposed to the typical form_for
[11:45:32] pankaj: ok. How will I get the value of :avatar then. (I know that I have not taken the values of name and email in this case so to be submitted).
[11:47:53] pankaj: sevenseacat: Does rails provide any method so that I can handle to submit the image manually as I did with form tag?
[11:48:34] sevenseacat: you need to pass the right parameters to your Post.create method, in your controller.
[11:54:14] pankaj: sevenseacat: So how to pass the correct parameters. I know about the four parameters that are created when I create an attachment. So how can I pass correctly?
[11:54:14] pankaj: sevenseacat: Can you send me an example listing the create action only so to handle the image upload process
[11:55:30] sevenseacat: pankaj: you need to look at the params you're submitting https://gist.github.com/anonymous/5b8359e6d63d904da53e01d66398efec#file-pankaj1-L94 and compare them to what you're doing in your controller. I'm not going to write the code for you.
[11:55:42] sevenseacat: https://gist.github.com/anonymous/56bf52254d68e0875e713ba09f3e20fb#file-gistfile5-txt-L8 and https://gist.github.com/anonymous/56bf52254d68e0875e713ba09f3e20fb#file-gistfile5-txt-L27
[12:00:26] dminuoso: sevenseacat: Im willing to bet that there's more than 12 Ruby devs in your city though. :-)
[12:01:47] sevenseacat: we no longer have any companies doing Ruby dev (or if we do, I haven't seen them), and our meetups get about 6 people, not all of whom actually write Ruby
[12:02:41] dminuoso: sevenseacat: I think it's more likely that you haven't seen them. Or perhaps the majority of them is involved with inhouse projects.
[12:02:47] pankaj: sevenseacat: I usually used to write create action manually like this. I am just asking that why I am not able to submit the image via :avatar. What is the different in this case of image?
[12:03:34] pankaj: sevenseacat: Error 'No handler found for "button4"' is being reported to me. How can I handle the image so to submit.
[12:07:52] pankaj: sevenseacat: I am asking that: 'Like many parameters that I can reference via params['parameter name']' why I am unable to reference the image also. You said that I was submitting nil image so how to reference the image from the form if my way was wrong. What is the right way of referencing the image if params['image name'] does not work.
[12:16:59] pankaj: sevenseacat: As I can get the value of parameters from the form to create action via params['parameter name']. So similarly how to access image that I submitted?
[15:44:10] RubyRonin: greetings all, I'm having the darnest time install bootstrap 4 in my rails 5 app
[15:53:35] helpa: RubyRonin: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[16:06:28] dminuoso: "Clearly explain what is happening" and "as well as any useful output like stacktraces."
[16:07:00] RubyRonin: bootstrap components are not loading, the bootstrap css is not being applied to my html
[16:10:18] RubyRonin: my console does show any errors, just my files being loading when I navigate through the pages
[16:14:37] RubyRonin: I have a index.html.erb file in my charges folder, wired up to my charges controller, none of the bootstrap styles are being shown
[16:16:04] sevenseacat: RubyRonin: if you're using that file as your layout, it does not include bootstrap, or any CSS.
[16:16:23] cerulean: RubyRonin: have you rebooted the server, have you tried rake assets:precompile to see if it gets compiled?
[16:16:46] RubyRonin: I've rebooted the server, i have not tried rake assets:precompile, didn't know it was needed
[16:17:16] cerulean: < sevenseacat> RubyRonin: if you're using that file as your layout, it does not include bootstrap, or any CSS.
[16:18:13] RubyRonin: so I removed that file, refreshed the charges page, it is now loading the application.html.erb layout file
[16:18:33] cerulean: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
[16:20:08] dminuoso: sevenseacat: Apparently not only do some people not provide them when they have a problem, others also don't read them when they are provided.
[16:20:32] cerulean: http://stackoverflow.com/questions/35880086/bootstrap-sprockets-error-file-to-import-not-found-or-unreadable-bootstrap-spr
[18:50:48] xco: hi. where can i look first if i’m getting such an error “XMLHttpRequest cannot load http://localhost:3000/api/v1/firms/1. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.” from my api only rails app?
[18:53:26] dminuoso: xco: To explain: When a browser detects that your app from "hostA" makes a request to "hostB", it asks "hostB" whether "hostA" is allowed for that access. This is called CORS preflight requests.
[18:54:12] dminuoso: xco: You need to somehow give Rails the capability of giving that permission. That rack-cors middleware does that.
[18:58:39] cerulean: "you don't" is a pretty shitty answer to a legitimate question, don't you think?
[18:58:59] cerulean: User458764: http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-method if you REALLY need it
[18:59:20] cerulean: User458764: i think you probably want this tho: http://guides.rubyonrails.org/routing.html
[19:00:30] dminuoso: User458764: Just for completions sake, if you actually should, you would generally use #request_method rather than #method
[19:31:03] xco: someone here uses docker env variables? do i save my values as ENV PASSWORD password in the Dockerfile? or there’s a different way of doing this?
[19:47:06] beingjohnm: I have created an active job in app/jobs. Is there a way to load it and run it from the console? Or using rake or something?
[19:53:33] dminuoso: beingjohnm: There is nothing magical about it. Look at it and tell me how to run it.
[19:57:43] beingjohnm: dminuoso: I thought I would run it as MassUpdateJob.perform_now but I get a name error: unitialized constant
[19:58:48] dminuoso: beingjohnm: perform_now is fine too, it just uses AJs dispatch mechanism. But you can just call .perform() directly
[19:59:01] beingjohnm: I read something that suggests that app/jobs isn't loaded when you use the console
[20:02:42] dminuoso: beingjohnm: I'm fairly certain that you have to restart spring in order for it to pick up the new autoloading dir.
[20:11:51] dminuoso: beingjohnm: yeah. The reason is that app/jobs was newly created, so the pre-loaded rails was not aware of that autoloading directory.