ReBa_

Activity Graph

Page 1 of 4 | Next »

2017-04-10

[06:03:34] ReBa_: has joined #RubyOnRails
[14:22:35] ReBa_: Ping timeout: 260 seconds

2017-04-07

[06:10:44] ReBa_: has joined #RubyOnRails
[07:13:16] ReBa_: I have a weird difference in getting a variable: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2
[07:13:46] ReBa_: If I do self.inspect, I get the correct hash for my columns variable. If I do self.columns.inspect, I get an array in stead of a hash
[07:14:09] ReBa_: Although it's exactly the same object
[07:16:26] ReBa_: It stores the order of an excel template
[07:16:43] ReBa_: order of columns in an excel*
[07:19:05] ReBa_: I've updated the gist (https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2) - the :columns field is a text field that is hashed
[07:23:23] ReBa_: sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb it's a saveable template to reuse in future exports
[07:28:22] ReBa_: sevenseacat: Why is that?
[07:29:24] ReBa_: (I don't know what gnarly means) => I'm searching and I find "extreme", "groteque, yet awesome", ...
[07:29:44] ReBa_: They sometimes come in as an array and sometimes as a hash
[07:29:55] ReBa_: So I'm trying to be sure it's always the same type of information I get
[07:31:17] ReBa_: The outcome is a hash
[07:31:36] ReBa_: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-self-inspect-L19 Like you can see here
[07:32:58] ReBa_: So in fact, it's better to start renaming it
[07:33:05] ReBa_: to for example: export_columns
[07:33:48] ReBa_: I'm trying to understand your remark "raw value - not delegated value"
[07:37:33] ReBa_: sevenseacat: In fact, it returns the hash (https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb-L27) or it gets params which have different :removed and :added columns
[07:37:55] ReBa_: It then checks if they should be included at all (if not in the original :added hash, it shouldn't be added at all)
[07:39:19] ReBa_: sevenseacat: I'm trying to follow, but as I'm getting sometimes a hash, sometimes an array, your remark will be correct
[07:39:39] ReBa_: sevenseacat: I understand what you're pointing out
[07:39:58] ReBa_: and the InspectionsExport has a hash
[07:40:32] ReBa_: but because it is linked to the export_template, it's returning a "wrong" value
[07:41:11] ReBa_: sevenseacat: Thank you for this damn interesting/helpfull insight
[07:41:27] ReBa_: sevenseacat: Would you rename the "columns" variable to export_columns?
[07:41:40] ReBa_: For the sake of understandable code and avoiding conflicts
[07:42:31] ReBa_: The user can create a custom excel file with columns in a custom order. He can also delete some columns he doesn't like.
[07:43:10] ReBa_: So that "columns" field saves the order of the columns, and only renders the :added items
[07:43:59] ReBa_: sevenseacat: You mean this: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb-L27
[07:44:51] ReBa_: Because they can change the order of an export_template
[07:45:14] ReBa_: And if an export template is used, future re-exports with the same filters will be used with the new columns order
[07:45:41] ReBa_: A user can choose to save a template or not, that's why I have an columns field in my InspectionsExport
[07:46:31] ReBa_: sevenseacat: Would you use nil if an export_template is used?
[07:47:56] ReBa_: Because it could be that a user doesn't link an export template
[07:48:56] ReBa_: sevenseacat: Owkay, if I'm following correct, you would just leave the columns data nil if an export_template is linked
[07:49:12] ReBa_: And if there isn't any relation, fill in the columns data
[07:49:36] ReBa_: Owkay. I get your point
[07:49:57] ReBa_: And I will do it like you see it, because it's logical
[07:51:01] ReBa_: sevenseacat: Would you only make it nil on before_save?
[07:51:30] ReBa_: Now it's initialized in the "default_values" method
[07:52:10] ReBa_: Or don't you mean that I just shouldn't save it in the database
[12:11:09] ReBa_: Ping timeout: 260 seconds

2017-04-06

[08:57:11] ReBa_: has joined #RubyOnRails
[09:01:54] ReBa_: Ping timeout: 260 seconds

2017-04-05

[06:47:35] ReBa_: has joined #RubyOnRails
[11:26:59] ReBa_: I've been able to structure my tempfiles ("/tmp/exports/export_#{user_id}.xml") but the extension is before the added has so you get export_1.xml20170405-27899-9fyfvl | I would like to have export_1-20170405-27899-9fyfvl.xml so the extension is at the back
[11:27:35] ReBa_: I've seen you can do it with Tempfile.new(['export', '.xml']), but that doesn't include the subfolder /exports to keep it structured
[11:29:06] ReBa_: If I doe Tempfile.new(['exports/export', '.xml']) I get the message that the file or folder doesn't exists (although it really does exist)
[11:30:59] ReBa_: Or is it better to use File.new if I want to achieve that?
[11:34:04] ReBa_: matthewd: So you would just use Tempfile.new(['export', '.xml') to keep it simple?
[11:34:20] ReBa_: (['export', '.xml'])*
[11:37:11] ReBa_: matthewd: It's just temporary storage to upload to the amazon s3 bucket. With that in mind, not caring about dirs is in fact logical :)
[11:37:24] ReBa_: I will implement it as intended
[11:40:38] ReBa_: matthewd: Thank you for your insights & help!
[12:03:41] ReBa_: experymental: You can use width: 661
[12:03:49] ReBa_: in stead of size: 661
[12:04:12] ReBa_: Or you can add a class to style your text_field in css
[13:18:00] ReBa_: Anyone had this issue before: an .xlsx as paperclip attachment is saved as content_type 'application/zip' in stead of 'application/excel' | 'application/vnd.ms-excel' | "application/x-excel" | "application/x-msexcel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
[13:18:17] ReBa_: I had to add 'application/zip' as allowed content type
[13:18:26] ReBa_: But if I look at the file, it's just a normal xlsx file
[13:20:27] ReBa_: It's not such a big deal, but it would be nice if it only included the right type :)
[13:31:20] ReBa_: epochwolf: only the xlsx versions, or the .xls too?
[13:32:01] ReBa_: Which would make use of one of the other allowed content_types, right?
[13:33:24] ReBa_: epochwolf: It's a generated file from axlsx that is being saved with paperclip
[13:34:20] ReBa_: Interesting
[13:36:27] ReBa_: And because I have full control of the rendered file, extra validation from my part isn't needed I suppose...
[13:36:48] ReBa_: Wouldn't that be spoofing then?
[13:37:05] ReBa_: Because it is in fact the correct type I'm setting
[13:37:52] ReBa_: No, now I'm saving it temporarily and then adding it as attachment to my model
[13:38:41] ReBa_: I'll try that
[13:39:06] ReBa_: It's the most robust way of doing it, as you state :)
[13:42:32] ReBa_: Owkay, I'll add it to config/initializers/mime_types.rb
[13:43:28] ReBa_: Even better than changing the content type :)
[13:45:23] ReBa_: epochwolf: Dang. The mime type is already initizalized
[13:45:30] ReBa_: So it keeps using /zip
[13:45:58] ReBa_: If I add it to the mime types, it states it's already adde
[13:46:14] ReBa_: So it should already accept it in fact, would be my understanding
[13:46:33] ReBa_: Back to changing the type then :P
[13:48:51] ReBa_: It states that on line 163, the xlsx is already added: ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::XLSX
[13:51:50] ReBa_: epochwolf: Only reference in sin the content_type_detector_spec inside papercli 5.0.0
[13:57:47] ReBa_: Maybe the axlsx_rails gem adds it
[14:00:51] ReBa_: epochwolf: Yep, the axlsx_rails gem adds it for me!
[14:01:14] ReBa_: Unfortunately not, no :s
[14:01:57] ReBa_: Still application/zip ...
[14:02:08] ReBa_: But changing the content type will do the trick (although not perfect)
[14:09:01] ReBa_: epochwolf: Thank you for your help! Really appreciated :)
[14:53:24] ReBa_: Ping timeout: 260 seconds

2017-04-03

[10:50:15] ReBa_: has joined #RubyOnRails
[15:20:54] ReBa_: Ping timeout: 260 seconds

2017-03-31

[06:54:57] ReBa_: has joined #RubyOnRails
[08:35:54] ReBa_: Ping timeout: 260 seconds
[09:43:09] ReBa_: has joined #RubyOnRails
[13:57:32] ReBa_: Would you let some application variables & configurations be based upon url? You have example.com and example2.com that have the same code base, some different styling & most importantly: different database connections?
[13:58:06] ReBa_: Or would you consider that dangerous?
[14:06:26] ReBa_: fryguy: I'm considering that as best option, because 1. I have seperate scalability, if needed, 2. I can only have 1 staging per instance, which gives me less controll
[14:06:37] ReBa_: + easier to use with environment variables per instance
[15:25:59] ReBa_: Ping timeout: 260 seconds

2017-03-30

[08:48:26] ReBa_: has joined #RubyOnRails
[12:49:47] ReBa_: I'm unable to render my xml in a model: https://gist.github.com/RemiBa/3577d1a8898bfa6bb647a6657228dc15 - How do I get the Builder to be required inside that model?
[12:51:03] ReBa_: nvm: http://stackoverflow.com/questions/7425457/nameerror-uninitialized-constant-activerecordassociationsbuilderxmlmarkup solved it...
[15:20:29] ReBa_: Ping timeout: 260 seconds

2017-03-29

[09:09:07] ReBa_: has joined #RubyOnRails
[09:20:51] ReBa_: I'm having trouble permitting my nested hashed field: https://gist.github.com/RemiBa/a18358c0ff66f7415b01cde97d83323e - How do I allow the "columns" attribute to be allowed with strong parameters? http://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-permit doesn't make me any wiser :s
[15:55:15] ReBa_: Ping timeout: 260 seconds

2017-03-24

[08:45:48] ReBa_: has joined #RubyOnRails
[14:22:07] ReBa_: With pundit, how to know if a user is able to create a new item?
[14:45:33] ReBa_: tbuehlmann: The new? method inside the policy was my problem. Did something wrong there.
[14:45:44] ReBa_: It's solved and works as explained in the documentation ;)
[17:24:25] ReBa_: Ping timeout: 260 seconds

2017-03-22

[10:20:56] ReBa_: has joined #RubyOnRails
[16:08:40] ReBa_: Ping timeout: 260 seconds

2017-03-20

[10:09:16] ReBa_: has joined #RubyOnRails
[10:18:43] ReBa_: I'm not able to load my custom class in my controller: https://gist.github.com/RemiBa/94859045b3a1b4543d71c1b754d37c99 - it sais I need to add it to my lib folder, but I already did that?
[10:19:28] ReBa_: Andr3as: yes
[10:22:57] ReBa_: Andr3as: Ow damn. I feel so stupid now :s
[10:23:11] ReBa_: Thank you for pointing that out :P
[10:23:28] ReBa_: Sometimes you really don't see it anymore
[10:39:46] ReBa_: mavik: Try to find your routes with rake routes
[11:19:25] ReBa_: Torrone: Can't you just check if the string is longer than 40 chars and only if it is longer truncate your string?
[11:21:29] ReBa_: Torrone: Sorry, my bad.
[11:23:11] ReBa_: Torrone: Still, you can check the word size?
[11:23:34] ReBa_: And if you count +40 words, don't truncate?
[11:23:55] ReBa_: I mean: if you count -40 words, don't truncate
[11:26:32] ReBa_: And you don't truncate the string if it's below 40 words?
[11:26:44] ReBa_: Or do you still execute the function to truncate?
[11:27:56] ReBa_: Torrone: And you use the http://apidock.com/rails/ActionView/Helpers/TextHelper/truncate function?
[11:29:08] ReBa_: So you first count the first 40 words and take the length of those, whereafter you truncate to the length of those 40 words, correct?
[11:33:38] ReBa_: Torrone: I've tried to reproduce the problem, but in my app, it turns out nice...
[11:33:47] ReBa_: Maybe it's the raw that makes it like that
[11:36:15] ReBa_: Torrone: And if you remove the ":escape => false" option?
[11:38:45] ReBa_: Torrone: I don't know... some strange behaviour like you explain
[14:08:36] ReBa_: I have an array with key => value pairs. I want to have the nth-position of one specific key. What's the best approach for this?
[14:08:47] ReBa_: I could just loop over the array and keep track of the count
[14:08:56] ReBa_: But maybe there is a faster option?
[14:10:08] ReBa_: epochwolf: BTW, your "class" solution for xml+excel rendering with DoubleRenderError works perfectly! :)
[14:10:12] ReBa_: Let me try that out
[14:18:40] ReBa_: epochwolf: Trying to get that to work, but in fact, I need the position based upon the key.
[14:19:08] ReBa_: Wait, I'll make it a little more clear
[14:20:56] ReBa_: epochwolf: https://gist.github.com/RemiBa/acd830b1d3905fc2f5292df17e0cd979
[14:21:00] ReBa_: I hope it's somewhat clear
[14:21:50] ReBa_: I need the position of '[inspections][filename]'
[14:22:02] ReBa_: The keys is an array, not?
[14:22:17] ReBa_: If you do hash.keys?
[14:22:38] ReBa_: Because the user can change the position in the user interface
[14:22:58] ReBa_: So they can or remove the column, or alter it's position
[14:23:12] ReBa_: So it could be that the filename is the 3rd in the :added hash
[14:23:58] ReBa_: It's the particular key
[14:24:13] ReBa_: So you have '[inspections][filename]' => Inspection.human_attribute_name(:filename)
[14:25:18] ReBa_: epochwolf: matthewd: that will be it!
[14:25:38] ReBa_: I was focussing to much on the hash in the beginning
[14:26:07] ReBa_: Thank you guys!
[15:05:45] ReBa_: Ping timeout: 260 seconds

2017-03-17

[08:49:24] ReBa_: has joined #RubyOnRails
[10:11:40] ReBa_: Quit: Page closed
[13:39:25] ReBa_: has joined #RubyOnRails
[13:59:12] ReBa_: How can you create dynamic items in a xml file based on an array? https://gist.github.com/RemiBa/0a35a7673a9fcf9f044f17901df33221
[14:01:55] ReBa_: epochwolf: Thank you for the tip, but I get <send>01010101Inspection010101</send>
[14:05:35] ReBa_: epochwolf: So that would becoome: xml.tag(key, value)
[14:05:57] ReBa_: epochwolf: Sorry (I thought you were being enthousiastic :P)
[14:06:44] ReBa_: epochwolf: But seems to work perfectly! :)
[14:06:52] ReBa_: Thank you!
[15:22:17] ReBa_: Quit: Page closed
[15:53:08] ReBa_: has joined #RubyOnRails
[15:55:06] ReBa_: If you use render_to_string, and afterwards uses a redirect, does Rails generates a DoubleRenderError?
[16:13:07] ReBa_: yeah... it generates the DoubleRenderError :s
[16:14:07] ReBa_: Because I want to add save 2 files (xml & xlsx) to a zip file
[16:15:10] ReBa_: So you wouldn't use export.xml.builder as view, but instead a render action?
[16:15:18] ReBa_: They need to be downloadable seperately too
[16:16:09] ReBa_: For example, you would put it in a model?
[16:16:41] ReBa_: Ow! Never done that before! :o
[16:16:44] ReBa_: Time to learn something new!
[16:19:57] ReBa_: epochwolf: Do you have an example / tutorial, or a documentation page which I can use to learn?
[16:20:51] ReBa_: Thank you
[16:27:26] ReBa_: epochwolf: I'm already using the builder gem, my file is named export.xml.builder
[16:27:34] ReBa_: So that's a plus, I guess?
[16:31:39] ReBa_: epochwolf: https://gist.github.com/RemiBa/8faed45b8f994eb0832677549e798d70
[16:31:48] ReBa_: that's what I have now
[16:31:56] ReBa_: but it's situated inside a view
[16:32:51] ReBa_: So you would create a seperate class for it?
[16:33:08] ReBa_: With probably exactly the same (reusable) code
[16:33:28] ReBa_: And where do you put that file?
[16:37:11] ReBa_: epochwolf: Thank you for the tips & superhelp!! :)
[16:44:10] ReBa_: Ping timeout: 260 seconds

2017-03-16

[12:07:11] ReBa_: has joined #RubyOnRails
[13:24:41] ReBa_: Quit: Page closed

2016-04-26

[08:43:25] ReBa_: has joined #RubyOnRails
[12:49:46] ReBa_: Quit: Page closed

2013-11-24

[15:55:48] ReBa_: https://gist.github.com/RemiSpot/72b515c335ff624575f4 When I do my code in trips/show.html.erb I get the error: undefined method `crossing_trips' for #<Class:0x007fd15f018e60> on line 1 --> can someone explain what my error is? Or lead me in a correct direction?

2013-10-16

[09:13:56] ReBa_: https://gist.github.com/RemiSpot/c2eb1552a57c61119793 I'm trying to inspect my array of items (model Location) but I keep getting errors about what I'm trying to iterate over...

2013-10-11

[08:06:53] ReBa_: Morning all ;)
[09:15:34] ReBa_: I don't get why my customized error message isn't desplayed (I'm using PaperClip btw) https://gist.github.com/RemiSpot/dbe8957954ed770f9ba0
[13:28:40] ReBa_: My paperclip image class can't find the PaperClip class: https://gist.github.com/RemiSpot/c64c16ac94a2cb844eb8 What am I doing wrong?
[13:29:48] ReBa_: I seem to read somethime it has to be in the initializers paperclip.rb file, but when I do that, it gives me the same error :s
[13:30:50] ReBa_: app/models/image.rb:10:in `<class:Image>': uninitialized constant Image::PaperClip (NameError) (I've put it in the description)
[13:35:54] ReBa_: workmad3: goddammit :s Why is a f*cking typo my problem! I've printed the documentation... and didn't pay enough attention... Thx... sometimes someone else points out while I've been looking at it for hours :s
[13:36:55] ReBa_: workmad3: And I'm like... no it WONT happen EVER again! (and everytime, I get shitted by it :P)
[13:39:04] ReBa_: I'm such guy that really likes to have some documentation on paper... I don't know why. And my eye for details is sometimes somewhat absent :s
[13:40:20] ReBa_: workmad3: What do you mean by cop(y)ing? mechanism?
[13:41:51] ReBa_: workmad3: Like a strucdown thing: if this isn't causing the error, check if the other thing can cause the error?
[13:44:12] ReBa_: Okay :) Will keep your advise definately to do that :)

2013-10-10

[12:47:19] ReBa_: Good afternoon
[14:21:15] ReBa_: https://gist.github.com/RemiSpot/d8800e46ed28c6bf2a08 I have some errors in my polymorphic association... I want to add a picture to an ablum (which becomes albumable) and now I want to add an image related to an album... but there seems to be some problems (Look at gist album.rb -> line 15)
[14:49:10] ReBa_: https://gist.github.com/RemiSpot/d8800e46ed28c6bf2a08 Sorry guys, I really don't get my problem. My polymorphic association works for users, but it doesn't work for images

2013-10-09

[06:59:59] ReBa_: fn3: I really appreciated this book: http://pragprog.com/book/rails4/agile-web-development-with-rails-4
[07:01:21] ReBa_: sevenseacat: At the moment there are to many kittens on the internet ;)
[07:02:50] ReBa_: Of course, there are many others
[07:04:38] ReBa_: sevenseacat: I'd like to hear your opinion
[07:07:57] ReBa_: sevenseacat: Can you give some examples, I can believe there are some outdated principles in the book, but as I'm trying to stick to a good workflow, I'd like to hear what exactly was wrong (and maybe I'm still doing wrong)
[07:08:59] ReBa_: sevenseacat: Hah, I think there are always some parts that you'd do different then in the book
[07:10:48] ReBa_: bugo_: :)
[07:13:02] ReBa_: fn3: I'd especially like the fact that the language is so easy to write and understand
[07:13:55] ReBa_: I don't know about America, but here in Europe, I've been offered 3 jobs (while I didn't had a lot of knowledge of Rails) with an average of ???60 an hour
[07:14:04] ReBa_: Which is, for me, a good payout :)
[07:16:40] ReBa_: Only by online communication sucks imo
[07:16:47] ReBa_: I'd like some real interaction
[07:16:56] ReBa_: Some real discussion on how a problem can be tackled
[07:17:12] ReBa_: Like with trowing shoes at eachother
[07:18:39] ReBa_: tagrudev: Yeah, that one helped me a lot on my last projects ;)-
[08:49:34] ReBa_: https://gist.github.com/RemiSpot/d8800e46ed28c6bf2a08 I've changed my album to a polymorphic one (albumable). If I now want to know which user it belongs to, I get the error that user is not defined, how do I get the user to be defined, because the linked Model will always have it's user defined
[08:50:52] ReBa_: I think it should be something like "my_associated_model.user"
[08:55:31] ReBa_: Oh yes, that's where my mistake takes place, I'm still to much thinking as you're saying. Thanks
[10:47:48] ReBa_: lessless: It could also be like on facebook, where you specificaly want to look at if it's been on his screen (so not only when showing the page, but also the particular message) you'll want to use the jquery.visible plugin
[10:49:20] ReBa_: lessless: And based on the scroll event, you'll want to see if the message is visible, if it's visible, you'll send the data through ajax
[12:46:58] ReBa_: Can you fake-create folders when testing? Now my tests makes for each user a new folder, but I don't want this because that makes like 50 folders each time, and I really don't need that. Like the mail-delivery, but with folders?
[12:55:32] ReBa_: sevenseacat: Hmmm, cleaning up afterwards can be somewhat dangerous as my development server could have some items in that directory too. I'm not yet familiar with stubbing though
[12:57:38] ReBa_: sevenseacat: That seems like a nice method
[12:59:07] ReBa_: sevenseacat: Do you have any advice on where I should go look to implement that?
[13:01:54] ReBa_: I'll show in a gist, just a second :)
[13:04:58] ReBa_: sevenseacat: https://gist.github.com/RemiSpot/a0f8ca9e49d6ddca7360
[13:08:15] ReBa_: sevenseacat: Don't know if it's the best way of doing things, but it's A way for sure :D
[13:16:24] ReBa_: For the mean time, I'll be doing it with creation of the files, it's not disastrous. Thx for helping ;)
[13:17:16] ReBa_: And further on, maybe I'll make the creation of those files public so they can be stubbed out

2013-10-08

[07:43:48] ReBa_: Goodmorning all
[09:26:46] ReBa_: Would it be a smart Idea to create user file folders within a folder that has a hashed name of their id?
[09:29:33] ReBa_: The id's are starting from 1 -> ... | I want to implement than that users can give access rights for images within those folders (images are stored in the db with a link to the image path)
[09:31:27] ReBa_: workmad3: So in fact, rights will be given to specific persons/group of persons. The main ID is to try and randomize the user id to a hash for some extra security.
[09:32:43] ReBa_: workmad3: Yes, they are sequential. So either way, hackers would always get there fast.
[09:40:35] ReBa_: workmad3: I think for the app as it now is (and as I think will be expanding) won't require a direct UUID user-id. And like you say it provides a bit of security, I don't think the change is required. It's good though to know I can use it maybe later on :)

2013-10-07

[11:11:49] ReBa_: because if I watch my params I get: https://gist.github.com/RemiSpot/0882b884b38b29965a50
[11:12:00] ReBa_: It just isn't "location_attributes" but "location"
[11:12:19] ReBa_: That's probably then because of my "params.require(:trip).permit(:id, :name, :from, :to, location: [:address])" line
[11:15:09] ReBa_: rvanlieshout: Okay! I understand it totally now, so in defining the strong parameters, I should give permissions on the attributes and not specifically on a model
[11:16:21] ReBa_: rvanlieshout: Okay, that makes sence too :)