Activity Graph

Page 1 of 2 | Next »


[22:56:38] JokesOnYou77: I'm trying to compare a local file to a Paperclip attachment and I'm having some trouble: expect(FileUtils.compare_file(Paperclip.io_adapters.for(@report.comment_file), Rails.root.join('spec/support/test.csv'))).to be_true
[23:45:18] JokesOnYou77: I'm trying to compare a local file to a Paperclip attachment and I'm having some trouble: expect(FileUtils.compare_file(Paperclip.io_adapters.for(@report.comment_file), Rails.root.join('spec/support/test.csv'))).to be_true


[03:52:31] JokesOnYou77: krz, up to 3 I think, it could get deeper though
[03:58:17] JokesOnYou77: krz, sigh, I was afraid of that :/
[04:05:08] JokesOnYou77: krz, Think I could dump it to string/json and just do a string comparison? It's coming in a json to begin with.
[04:07:13] JokesOnYou77: I think I'm gonna do that. It feels elegant considering that the hashes I'm comparing are really just JSON
[04:20:38] JokesOnYou77: Can I force rspec tests to run in a certian order? I'm testing an API client and I want a different test for each stage of interaction with the API.
[18:58:56] JokesOnYou77: bibix82, Sometimes it can be a time-suck for the browser layout engine to do automatic coloumn-width detection/optimization. There may be a way to get around that. The other option that comes to mind is to ajax and paginate the table.
[19:02:59] JokesOnYou77: bibix82, yes. It might not make a huge difference though. It's hard to tell. It also means you have to specify the widths in CSS if you want the layout to look decent
[19:03:32] JokesOnYou77: smathy, How would the caching work?
[19:07:44] JokesOnYou77: Whould it also be faster to hard-code the actual table and then just fill in the values? Maybe you could even combine that with some kind of lazy-loading, using AJAX to populate the table values after the initial page load. It wouldn't _technically_ be pagination
[19:09:59] JokesOnYou77: yeah, I was figuring it souldn't wait for any event. Just write the first 50 rows with erb and then take advantage of asynchronous JS to fill in the rest so that the initial page-load time is fast even if the data isn't all there.
[19:13:03] JokesOnYou77: I do something similar with our app at work. I cut page loading time by 60% or more by not actually loading any data when the page loads :P
[19:28:12] JokesOnYou77: bibix82, I still think you should try loading over ajax and see what happens.
[20:16:10] JokesOnYou77: What's the best way to compare two files for equality of content? Dump to string and string compare or is there a faster way with some kind of binary mode for the files?
[20:18:30] JokesOnYou77: bricker, ty! Will do more googleing next time.
[20:20:43] JokesOnYou77: That's true, but I do feel like a bit of a jerk when I go to IRC too quickly. :P
[20:26:05] JokesOnYou77: jacksonmills, my favorite:
[21:38:26] JokesOnYou77: I'm rendering a view with a form in an rspec test and I'm getting an error: ActionView::Template::Error: First argument in form cannot contain nil or be empty. Is it trying to submit the form??
[21:39:27] JokesOnYou77: nvm, I was missing an instance var.


[22:14:09] JokesOnYou77: I'm writing an accessor method for a model, the purpose is to return a default field value for older models created before this migration, how can I check is the new field is present in the model in the accessor methods without actually calling the accessor getter method?
[22:36:15] JokesOnYou77: Do I have to do anything before calling write_attribute(my_json) to a json field? Will ActiveRecord escape it for me etc.?
[22:39:20] JokesOnYou77: bricker, I just realized that I asked questions from a conflicting point of view. I'm guessing you mean that I don't need to do anything to my_json?
[23:43:02] JokesOnYou77: Is there a built-in for comparing nested hashes?
[23:44:20] JokesOnYou77: I'm doing that now. Seeing gems and a bunch of SO post that are old, the language and the framework are both evolving and I thought info here would be most current
[23:50:05] JokesOnYou77: {:filters => {:globalFilters => {:Positive => true}}} the method I'm testing should also return this, and I'm writing an rspec test, so I just want to test if it's equal to this.
[23:51:20] JokesOnYou77: I suppose I could jsut cop-out and expect(result[:globalFilters][:Positive]).to eql(true)) but that feels too easy :P


[17:40:03] JokesOnYou77: I have a user model that: belongs_to :organization; and validates :organization, :associated => true; but I dont understand the validation. It doesn't really look like the validates_associated from the docs.
[18:23:42] JokesOnYou77: Will serving precompiled assets from S3 reduce my RAM usage on the server hosting my app (heroku)?
[18:30:17] JokesOnYou77: Yeah, but I'm interested in RAM usage :P
[18:36:02] JokesOnYou77: Ok, good to know. Still hunting for a way to profile what's using all the RAM
[18:39:04] JokesOnYou77: pipework, this looks promising, thanks
[18:41:52] JokesOnYou77: Yes! I haven't actually started to googling yet, so I probably should have waited to ask here but I thought I'd throw it out there to see what came back
[18:52:38] JokesOnYou77: How do I test this in rspec: validates :organization, :associated => true (this is from the User model I am writing tests for)
[19:58:04] JokesOnYou77: How do I test this in rspec: validates :organization, :associated => true (this is from the User model I am writing tests for)


[18:01:10] JokesOnYou77: Hi all. I'm reading my logs and looking at what I assume is an Active Record message: SQL (8.3ms) UPDATE "reports" ... Is the 8.3 ms the time for the entire following operation takes?
[18:04:46] JokesOnYou77: skit, thank you!
[18:23:58] JokesOnYou77: Looking at a NewRelic report it looks like some of my controller methods are taking a lot of time in "Request Queuing" where is this queue and how do I cut in line?
[18:31:40] JokesOnYou77: I don't need to add indexes on my primary keys, right? Active record does that and uses it automatically when I do a Models.find(someInt), right?
[18:34:15] JokesOnYou77: rhizome, thank you. That still seems odd though as apparently it's very time consuming to .find a single object, most timeconsuming part of my controller :/
[18:36:44] JokesOnYou77: hmmm...I'll look into it some more
[18:41:11] JokesOnYou77: rhizome, A class variable @report, won't be shared between the initial controller method that responds to the request for the view and another method in the same controller that responds to an ajax request from that view, will it? It would be nice if I could just keep the model object in memory and eliminate the find time.
[18:48:19] JokesOnYou77: rhizome, Would that variable be persisted then?
[18:49:18] JokesOnYou77: And, because I thought I was separating concerns by separating the method that renders the view from the one that responds to an ajax request for a statistical analysis.
[18:51:18] JokesOnYou77: I thought it made more sense to separate the routes and methods rather than combine them. Cleaner code and all. How would I have the same action respond to both requests? Just put a condtional at the top of the main method and route it based on some flag in the request parameters?
[18:57:35] JokesOnYou77: rhizome,
[19:01:51] JokesOnYou77: rhizome, this? before_action :set_report, only: [:show, :edit, :update, :destroy, :logi, :check_status]
[19:03:40] JokesOnYou77: Yeah, there's a ton of stuff going on. I'd actually prefer not to post the model, sorry :/
[19:04:48] JokesOnYou77: rhizome, do you think the before_action is causing a delay?
[19:27:45] JokesOnYou77: rhizome, good call. That will clean up the view too.
[20:38:08] JokesOnYou77: If a user is very quickly performing a bunch of actions that and then performs a new action that uses a different controller method, are the requests blocking? Can they be executed by different unicorn workers concurrently?
[21:55:52] JokesOnYou77: If a user performs an action that requires a large DB write, is that write blocking to other actions on the server?
[21:57:52] JokesOnYou77: smathy, So if some other wants to do something they need to be handled by another worker process or they need to wait?
[22:02:09] JokesOnYou77: smathy, Ok, that explains a lot. Our app is a RAM hog and unicorn was making it worse so we went to 1 worker per dyno and that's caused it's own problems. I'm looking at puma now :/
[22:07:29] JokesOnYou77: Is puma worth it if my app isn't thread-safe (i.e. can only use forked processes)?
[22:11:48] JokesOnYou77: smathy, The effort of changing over from unicorn.
[22:12:01] JokesOnYou77: Sorry, should have been more clear.
[22:18:09] JokesOnYou77: smathy, yes. Low traffic for the moment, but it's been causing problems. More than one unicorn worker per heroku dyno is too much RAM and with only one at a time we get concurrency problems with only one worker per dyno
[22:19:56] JokesOnYou77: smathy, apologies.
[22:21:03] JokesOnYou77: Because I use class variables and I recognize that I don't know enough to clean up my code to be thread-safe or have the time to review all of the gems we're using to make sure that they are thread-safe.
[22:21:48] JokesOnYou77:
[22:23:46] JokesOnYou77: smathy, So I get no RAM benefit per worker process, just the ability to have concurrency within workers.
[22:32:30] JokesOnYou77: smathy, Not on free heroku. Paid account, 3 dynos at 2x level. The problem is that the app uses so much RAM that any more than 1 unicorn worker starts hitting the RAM limit of the machine if anyone starts actually using the app.
[22:36:37] JokesOnYou77: smathy, yes. Sorry, the docs call them workers which is confusing.
[22:38:19] JokesOnYou77: smathy, Great. So either, make it thread safe or get a bigger dyno? :/
[22:39:10] JokesOnYou77: smathy, that would also probably be a good idea.
[22:42:47] JokesOnYou77: smathy, Maybe I'm wrong about what I'm doing (very possible as I'm still learning)? I have a ruby object I created that, in initialize sets initial values of a bunch of vars: @num_annotations, etc. and some of the methods use and change those variables depending on some other conditions.
[22:56:28] JokesOnYou77: smathy, No that's really it, but I'm having trouble parsing that article to determine if that's actually a threadsafe operation since i'm changing class vars
[23:16:25] JokesOnYou77: smathy, def initialize(report, bool); @foo = 0; @bar = report['blip']; end def method; if @bar; @foo = 2; end; end
[23:16:33] JokesOnYou77: smathy, threadsafe? ^
[23:20:07] JokesOnYou77: smathy, Yes? I guess not. Oh, it's an instance var isn't it?
[23:24:16] JokesOnYou77: That class is just in lib/ It's produces a statistical breakdown of a bunch of info in the model. It's instantiated and called in a controller as a response to an ajax call.
[23:27:42] JokesOnYou77: smathy, that's why I'm here. :P
[23:28:45] JokesOnYou77: But I need help in the context of rails, thus this channel.
[23:29:13] JokesOnYou77: I'm competent enough to actually write the classes, it's the architecture I'm having trouble with.
[23:31:00] JokesOnYou77: Thanks, I can't ell you how many ruby tutorials I've done but thank you. So now I just need to review my gems and get someone who actually knows what they're doing to do a code review.
[23:33:11] JokesOnYou77: smathy, I agree with your advice. My very first comment on thread-safe was that I don't know enough to determine if it is or not so I can't reliably use concurrent threads. I know I don't have the chops to do make the determination for myself.
[23:40:20] JokesOnYou77: smathy, Also, thank you so much for taking the time. It means a lot that I can get a response here.


[04:38:56] JokesOnYou77: Hi all. I'm trying to setup a backtrace cleaner to get rid of lines including .rvm and it's not working: Rails.backtrace_cleaner.add_silencer { |line| line =~ rvm }
[04:46:03] JokesOnYou77: Any thoughts on the backtrace silencer?
[04:59:17] JokesOnYou77: How can I filter all lines including '/.rvm/' from my stacktraces?
[05:19:18] JokesOnYou77: How can I filter all lines including '/.rvm/' from my stacktraces?
[05:26:35] JokesOnYou77: there's no way to get backtrace_cleaner to actually clean my backtrace? I'm happy to use grep, I just thought I might be able to actually get the built in feeature to do its job
[05:29:16] JokesOnYou77: This is what I currently have in backtrace_silencers.rb: Rails.backtrace_cleaner.add_silencer { |line| line =~ rvm }
[05:30:19] JokesOnYou77: Not even a little bit. Tried other various combinations of quotes and full paths etc
[05:34:31] JokesOnYou77: smathy, Ah ha! A better gem may be exactly what I needed
[05:36:31] JokesOnYou77: smathy, Actually, we have better_errors, still giveing all of the gem internals in the backtrave. It's a real pain
[05:37:14] JokesOnYou77: In the terinal. $ rails c
[05:38:25] JokesOnYou77: Ah ha. About a month ago we must have changed something because I just get our production 500 error page instead of better errors


[04:23:59] JokesOnYou77: When we started our web app at work we used Postgres as our backend, but (aside from our standard user data) the data that we're storing has a lot of many-to-many relationships (it's a graph) and we're starting to plan a major refactor and I'm wondering if we should switch backends. Right now we store graph data as JSON in postgres.
[04:31:47] JokesOnYou77: Right now, we have limited to no customer data that needs to be preserved and the arnchitecture we chose when we started (everything goes into the view and JS does all of the data manipulation) is causing problems for us so as we re-architect I'm considering a new DB. I was thinking about Mongo or Neo4j
[04:33:04] JokesOnYou77: rhizome, I recently did a side project (not with rails) with Neo4j and as we are storing graph data and and a lot of many to many realtionships I thought it might perform better than a bunch of really big joining tables.
[04:36:38] JokesOnYou77: Our app is a text analytics tool where users have reports and reports have many comments (e.g. tweets). Our analysis API analyzes the comments and returns them in a graph structure where each comment has connections with 0-n other comments and each connection has a strength. Then in the analysis phase a comment gets annotations and tags which are also many-to-many
[04:40:50] JokesOnYou77: jesmith, It has come up in recommendations before but I haven't reviewed it yet. Part of the consideration would be how good the rails integration is though and I know Neo has good support.
[04:44:00] JokesOnYou77: My main concern with postgres is that if a report has 10000 comments and I use a joining table for the many-to many relations it will only take 1000 Reports before the joining table is at 10 Mill rows and I'm not sure what's going to happen to the join queries at that point. Does anyone have experience with something like that?
[04:45:11] JokesOnYou77: Now all of the comments are in a big JSON blob in the DB and I've heard that psql can use array fields instead of a mapping table which may make a big difference, but I'm not sure how to do it in Rails yet.


[05:32:33] JokesOnYou77: You also need to have that gem installed/in you gem file if thats what you're doing, but yeah, that should do it


[22:11:03] JokesOnYou77: Hi all. I'm trying to write a bash script to start rails. I've tried, "cd /path/to/app && bin/rails s" but I get error messages that suggest that I'm not getting the rvm environment specified by the project files (i.e. my gems aren't available). How can a start rails with a script?
[22:14:51] JokesOnYou77: weaksauce, good idea, but "bundler: command not found: rails"
[22:21:06] JokesOnYou77: weaksauce, yes. And if I do it manually in the command line without the script it works fine. What is the process that normally autodetects all of the rails config files ina project folder?
[22:23:00] JokesOnYou77: mikecmpbll, right now it's "bundler: command not found: rails"
[22:23:33] JokesOnYou77: weaksauce, I also tried putting "source ~/.bashrc" into the script but I think you may be right
[22:25:43] JokesOnYou77: weaksauce, Not entirely sure how to do that. Thoughts?
[22:27:19] JokesOnYou77: weaksauce, got it!
[22:27:52] JokesOnYou77: exported the path to my .rvm bin files and I think that did it.
[22:28:02] JokesOnYou77: weaksauce, and mikecmpbll thank you both


[19:16:05] JokesOnYou77: Hi all. If (like a complete idiot) I run bundle update. Will it also screw up everyone else on my git? I noticed that the Gemfile.lock is tracked by git and I'm not sure if that will cause problems
[19:17:10] JokesOnYou77: webdestroya, so you're saying i shouldn't push? If I revert in git will it roll back my idiotic update?
[19:18:17] JokesOnYou77: webdestroya, No, I didn't intend to update. It was a mistake
[19:19:10] JokesOnYou77: webdestroya, nothing commited yet. And still on a branch. So backing up that file and then bundle install will bring back the old versions?
[19:20:01] JokesOnYou77: webdestroya, you're my hero :)
[19:50:39] JokesOnYou77: How can I update just a single gem?
[19:51:35] JokesOnYou77: Also, your advice worked and the app is unbroken again. Thank you webdestroya
[20:53:08] JokesOnYou77: If I use a "pattern as a string".match(string_to_search) what characters do I need to escape in the pattern string if it's denoted as "foobar" and not /foobar/ ? I have a regex that's working but I'm having trouble understanding why :/
[20:55:51] JokesOnYou77: wait, yes, you're right. Sorry. But the question still stands. I'm not sure what I need to escape when my regex is a string
[20:57:34] JokesOnYou77: webdestroya,
[20:59:35] JokesOnYou77: How did you figure out what it converts to? Or did you do that by hand?
[21:00:07] JokesOnYou77: And why don't the dots need to be escaped?
[21:01:05] JokesOnYou77: so it's not parsing properly. I'm glad I asked. This is the problem with getting regex from SO :P
[21:02:32] JokesOnYou77: No, match 4 is what I'm looking for.
[21:03:12] JokesOnYou77: It worked in irb but I couldn't figure out how string => regex was working. Now I know the Regexp class which makes that easier
[21:03:38] JokesOnYou77: The problem was I didn't understand. So, all in my head, I guess.
[21:05:07] JokesOnYou77: Also, it's not for ruby, but this thing is awesome:
[21:05:57] JokesOnYou77: right, I used both. But the 101 link does an autogenerated explanation of what's going on
[21:07:32] JokesOnYou77: Thank you agian, btw
[22:09:47] JokesOnYou77: Is there a way to display the on-disk size of a field in a model object?
[22:13:07] JokesOnYou77: apeiros, If you only need to remove words with special characters and not words that are just gibberish then you could tokenize the text, make an array of all of the charaters you don't like, and then remove all tokens containing those chars and join back into a string
[22:14:28] JokesOnYou77: webdestroya, Yeah. I don't know the correct rails terminology. But I have a model with a field called foo. And I want to get the disk usage for each foo in the DB. I've been looking at the postgres docs but they haven't been much help :/
[22:16:29] JokesOnYou77: Probably. This isn't actually for development I'm doing an improptu review of our schema and trying to figure out how much space some of the massive JSON blobs we store are taking up.
[22:17:01] JokesOnYou77: What about just getting the character count? 8 byted / char
[22:19:42] JokesOnYou77: I think postgres stores them as escaped strings though. It's basically a blob type. The exchape chars will add some but it's better than nothing
[22:31:36] JokesOnYou77: webdestroya, I was hoping that ActiveRecord had some kind of magic, but this is even better. Thank you.


[16:27:26] JokesOnYou77: Hi all. I have a file that I I'm using to seed a db with. Where in the file structure should I put the file both so that the initilizer can see it and that makes sense for the file structure conventions? Right now it's in tmp which is ignored by git so it won't be there when I push to heroku which is a problem
[16:30:24] JokesOnYou77: ammar, So that's the appropriate place for a file that will be loaded into the DB? Like a csv?
[16:35:11] JokesOnYou77: ammar, I like that organization. What I have is an instance of regular data that is going to be a demo data set for new users to play with. The app is an analysis platform and we want new users to have data to play with on their first visit.
[16:38:38] JokesOnYou77: ammar, it is a one time thing...but then how do i get it to heroku?
[16:44:39] JokesOnYou77: ammar, will a file in db/seeds be available to an initilizer.rb? Do I need to give it a special path?
[16:48:09] JokesOnYou77: It looks like no matter what path I put in the initilizer yml it looks in tmp/
[16:53:31] JokesOnYou77: We were storing the file information in a .yml. I figured out where the code specifying tmp/ was. It worked! Thank you!


[01:48:09] JokesOnYou77: Hi all. I have a JSON blob stored in postgres, what do I need to put in my controller to yield that to an ajax request?
[01:53:30] JokesOnYou77: centrx, I was using a respond_to, would a send_data be better as an ajax endpoint?


[01:40:06] JokesOnYou77: Hi all, I'm using rails 4 and I'm trying to use image_tag in a view but it can't find the image. The png is in assets/images but I didn't think I needed to specify a path in order for rails to find it. This is in development mode, but I'd like it to work both in production and dev so that I can test before I push.
[01:41:21] JokesOnYou77: <%= image_tag "image.png" %>
[01:42:02] JokesOnYou77: <%= image_tag "synapsify_A.png" %>
[01:43:16] JokesOnYou77: app/assets/images/synapsify_A.png
[01:44:54] JokesOnYou77: rails log: Started GET "/images/synapsify_A.png" for at 2014-09-24 21:44:34 -0400
[01:44:59] JokesOnYou77: not looking in the right place
[01:46:36] JokesOnYou77: right. hfp mentioned that the pipeline may not be used in development?
[01:46:55] JokesOnYou77: sevenseacat, I did try restarting the server. How do I restart spring?
[01:48:15] JokesOnYou77: looks like restarting the server restarts spring. Since when the server isn't running I get Spring is not running
[01:50:23] JokesOnYou77: sevenseacat, I get Spring is not running when i enter spring stop in the terminal O.o
[01:53:38] JokesOnYou77: sevenseacat, I don't think so, it's a group project though so little is certain. How can I test?
[01:55:25] JokesOnYou77: gem 'spring', group: :development
[01:56:07] JokesOnYou77: not sure what the inline group is though as we have another big group :development do
[01:56:32] JokesOnYou77: Technodrome, multi-step? Like multiple pages to go through?
[01:59:22] JokesOnYou77: I don't know the typical approach, I was mostly curious, but doing everything in JS actually does sound nice. If it is really long though there could be an expectation with users that the form is saved when they click next.
[01:59:31] JokesOnYou77: sevenseacat, any thoughts?
[01:59:49] JokesOnYou77: sevenseacat, Is it possible it has something to do with precompiling assets?
[02:04:51] JokesOnYou77: sevenseacat, ok
[02:05:45] JokesOnYou77: sevenseacat, just don't understand. I'm not a rails expert, but I'm not completely new at this either and everything I know about the asset pipeline says what I'm doing should work :/
[02:17:14] JokesOnYou77: sevenseacat, It worked! All that for a damn typo lol


[23:00:16] JokesOnYou77: Hi all. I'm using rails 4 and I have an image in app/assets/images but image_tag isn't seeing it. Currently running in development mode.
[23:12:29] JokesOnYou77: d3 is great but once you want to do something custom it gets very complicated very quickly
[23:16:17] JokesOnYou77: harly, This is, unfortunately, a non-answer but is a library exists that is already close to what you what to do it may be easier than d3. The thing is that because d3 can do just about anything it's really tempted to go down the rabbit hole without looking at alternatives. So in short, no :P
[23:18:10] JokesOnYou77: I'm actually having some trouble with the asset pipeline in rails 4. I'm trying to use image_tag in a view for a png that's in assets/images but rails can't find it. I think it might have something to do with dev/production mode and asset compilation but I'm really not sure? I just want it to work in dev so I can test before I push to heroku
[23:19:43] JokesOnYou77: harly, Yeah. In fact, it most definitely supports customization, it's an entire JS sublanguage just for creating visualizations but that means that you're basically learning a new language in order to extend it's functionality.


[17:08:24] JokesOnYou77: Will Model.all.find_each(options) behave the same as Model.find_each(options)? Will both of them get the advantage of not loading everything into memory


[00:01:50] JokesOnYou77: No errors. I just can't figure out what the keys are. I just .each ed what I loaded and got #<Psych::Nodes::Scalar:0x0000000144fd58>
[00:03:40] JokesOnYou77: Ok. It looks like what I loaded has only values ?
[00:05:33] JokesOnYou77: It's an array! LMAO. No wonder I was having trouble lol
[00:05:52] JokesOnYou77: I've been figureing it out in the listener slowly with your combinded help
[00:07:25] JokesOnYou77: Yeah, and array
[00:09:05] JokesOnYou77: OK now that I have the file loaded, can I modify the file? When I exit the script will it overwrite the file or anything?


[23:58:27] JokesOnYou77: How do I check if something is in a YAML file?
[23:59:59] JokesOnYou77: jhass, Any chance you could be a bit more explicit? I'm having trouble with the specifics. I've tried both YAML::parse and YAML::load_file and havne't been able to get either to work


[21:30:16] JokesOnYou77: I'm using where should a put an image I want to serve on a page with rails 4?
[21:53:08] JokesOnYou77: If I'm in dev mode and I have compiled assets and I now add a new css file, and require it in application.css.scss do I need to recompile my assets? The css in the new file doesn't seem to be working
[22:09:55] JokesOnYou77: My css is getting loaded by not getting applied for some reason. I created the file without generate (someone else created the page and must not have used generate but now I need to style it). I created the new scss file with the .controller-controllername at the top bont none of my rules there seem to be getting applied to the pages.
[22:14:01] JokesOnYou77: Can anyone give me a hand on the css?


[04:12:30] JokesOnYou77: Creating the link. I think I can create a controller that just returns the file. And If it's just a send_file I don't think I need routing?
[04:12:45] JokesOnYou77: oh, routing makes everything better
[04:13:10] JokesOnYou77: I do really like rails but every once and a while I just hit a wall. Thank you
[04:14:19] JokesOnYou77: luckyruby, But the file doesn't have a page, so where does the route point?
[04:14:55] JokesOnYou77: In the controller.
[04:15:06] JokesOnYou77: Just generated then sent to user
[04:16:30] JokesOnYou77: sevenseacat, So how do I link to the controller? And should the controller just return a file?
[04:19:06] JokesOnYou77: sevenseacat, Ok, I think I'm just bing thick now. In my route, I have get /some/path, to: 'somecontoller" , as: "namedroute" but if there's no separate page for the file, what is some/path?
[04:20:08] JokesOnYou77: It shouldn't navigate anywhere. It should just prompt the user to download the file from the page they're currently on
[04:20:57] JokesOnYou77: The page with the download link already has a route though, It's that going to f* it up?
[04:21:40] JokesOnYou77: I was being thick
[04:28:12] JokesOnYou77: Ok, so as easy as this all sounds, I managed to screw something up.
[04:28:30] JokesOnYou77: I have link_to 'report_download
[04:28:49] JokesOnYou77: then in my routes I have get 'reports/:id/download', to: 'reports#download', as: "report_download"
[04:29:18] JokesOnYou77: And the controller: def download \ send_data("4", :filename => "Annotated_Comments.txt") \ end
[04:31:32] JokesOnYou77: <i class="fa fa-download"></i> Download Annotated Results (CSV)
[04:31:32] JokesOnYou77: Ok, the full html is: <%= link_to 'report_download' do %>
[04:32:12] JokesOnYou77: And I get Could not find report with id=report_download
[04:33:02] JokesOnYou77: Ok, so I how do I create the link
[04:35:21] JokesOnYou77: YOU ARE THE GODS OF RAILS! ALL HAIL!
[04:36:22] JokesOnYou77: Now I just need to convert a massive JSON string into a CSV :P
[04:37:36] JokesOnYou77: luckyruby, Yeah, I was PHP.Drupal :P. But I'm also a recent grad and this is my largest real project with a framework. Before this i did everything by hand from scratch with no frameworks, fine for small projects.
[04:40:09] JokesOnYou77: The project manager's friend works for a Ycombinator startup and knows rails, so we used him to get started. It turns out to have been a terrible choice for our app (no offense) but I've actually enjoyed rails/ruby as ruby is closer than anything else to Lisp
[04:44:54] JokesOnYou77: The app is essentially a spreadsheet application for annotating sentiment etc. on social media posts (like when Walmart wants to know what people are actually saying out of 20000 tweets at them). It has some cool visualizations, but at the end of the day it's basically a frontend for SQL and rails obscures a lot ot SQL functionality in the models. We just want to write stored procedures and push the results to the screen :P
[04:48:59] JokesOnYou77: So now we should run our SQL app that needs to process 10000+ rows on a javascript server? I actually do think node is really cool and I'm trying to do some of our d3 processing server-side, but it doesn't seem like a good fit for this.
[04:50:37] JokesOnYou77: That came out a bit harsh, sorry.
[04:54:16] JokesOnYou77: It is def cool. The thing is that we have tabular data, users give us excel files, and that's what SQL is for. I have been getting increasingly turned on to node though. Just seeing some of the things it can do is really incredible.
[04:56:19] JokesOnYou77: So now that I'm writing the actual controller, I'm realizing that I'm not actualyl sure how to create a file (CSV actually) in memory without writing to disk and then return it :P
[04:57:13] JokesOnYou77: CSV.generate maybe...
[04:58:12] JokesOnYou77: oh man I don't want to jynx it but I might actualyl get this done tonight.
[04:58:25] JokesOnYou77: I didn't actually expect that
[05:45:09] JokesOnYou77: luckyruby, How do I redirect back to the page where the link was clicked?
[05:47:05] JokesOnYou77: rvanlieshout, in the controller or in the link_to?
[05:47:29] JokesOnYou77: It's a download link for a dynamically created file if that makes a difference
[05:53:38] JokesOnYou77: sevenseacat, But the address bar goes to blah/download :P
[07:32:39] JokesOnYou77: Hi all, does anyone know how fast/slow .html_safe is for a (very) large string? I'm using Oj to dump the json but it hardly seems to matter if .html_safe is going to eat up any gains I get from Oj
[07:37:22] JokesOnYou77: rvanlieshout, so, no speed hit?
[07:38:45] JokesOnYou77: Ahh, well I've got 30MB+ of JSON so it's going to be slow no matter what :P
[07:38:54] JokesOnYou77: But if Oj helps, I want it
[07:41:14] JokesOnYou77: The app is actualyl pretty much a spreadsheet application, but we have this crazy force-directed graph to vizualize the data in D3. There has been a lot of back and fourth about how idiotic it is to put that much data into the client but I was overruled the last time it came up