|
A MIRACLE posted:What are the differences between these? I think the <% ... -%> version will keep a blank line from showing up in the resulting html?
|
# ? Aug 26, 2011 20:27 |
|
|
# ? May 14, 2024 22:33 |
|
Do you even need to do that anymore now erubis is the default erb parser? (haml 4 lyfe)
|
# ? Aug 26, 2011 21:00 |
|
smug forum rear end in a top hat posted:I think the <% ... -%> version will keep a blank line from showing up in the resulting html? Yeah, it trims the whitespace after.
|
# ? Aug 27, 2011 05:07 |
|
clockwork automaton posted:Yeah, it trims the whitespace after. I thought that code:
code:
|
# ? Aug 27, 2011 21:36 |
|
Yes but with old erb if you did <% if cond %> that line would leave a blank line into the output. Doing <%- if cond %> suppresses the line. Erubis, which Rails 3+ uses, doesn't leave blank lines and the <%- is unnecessary.
|
# ? Aug 27, 2011 23:24 |
|
NotShadowStar posted:Yes but with old erb if you did <% if cond %> that line would leave a blank line into the output. Doing <%- if cond %> suppresses the line. Erubis, which Rails 3+ uses, doesn't leave blank lines and the <%- is unnecessary. I can thank my crappy low-res display for making <%= look just like <%-
|
# ? Aug 28, 2011 04:59 |
|
I'm starting to use jQuery for the first time in Rails (first time ever, really) and I'm running into a weird problem. Does Firefox do something different than IE/Chrome when it comes to waiting for page responses? When I update some records with a jQuery remote form submit I notice that the records updated don't always reflect their changes after a page refresh in IE/Chrome but they do 100% of the time in FF. In the former browsers sometimes I have to do two page refreshes to see the changes. What gives?
Tomed2000 fucked around with this message at 20:48 on Aug 29, 2011 |
# ? Aug 29, 2011 20:45 |
|
Sounds more like a jQuery thing than a Rails thing, post in the javascript or jquery thread along with your code that you're trying to do.
|
# ? Aug 29, 2011 22:10 |
|
NotShadowStar posted:Sounds more like a jQuery thing than a Rails thing, post in the javascript or jquery thread along with your code that you're trying to do. Thanks. I have another question that is probably more Rails related, though, so maybe someone can still help. I'm trying to figure out how to use check boxes to select multiple records and update them accordingly depending on what button a user presses (think GMail e.g., delete, archive, etc). There's a really great Railscasts that introduced me to this functionality but I'm having trouble figuring out how to extend it to include more than one button. He essentially uses a form that includes a checkbox and the button but I don't want to have more than one checkbox! What is the best way to go about extending this functionality to include more buttons without adding the checkboxes?
|
# ? Aug 29, 2011 22:41 |
|
So...Rails 3.1 is scheduled to drop tomorrow. Anyone have a decent set of links for getting up to speed on things? So far I've not touched it and have just cobbled together info from the links in this 3 month old blog post. In particular I'd appreciate thorough write-ups of asset pipelines and engines.
|
# ? Aug 30, 2011 07:18 |
|
Tomed2000 posted:Thanks. I have another question that is probably more Rails related, though, so maybe someone can still help. I'm trying to figure out how to use check boxes to select multiple records and update them accordingly depending on what button a user presses (think GMail e.g., delete, archive, etc). One thing that a lot of people don't realize is that submit fields actually pass their value through to the server when they submit - I'm imagining you could do something like this pretty easily: (view) code:
code:
enki42 fucked around with this message at 12:35 on Aug 30, 2011 |
# ? Aug 30, 2011 12:31 |
|
enki42 posted:One thing that a lot of people don't realize is that submit fields actually pass their value through to the server when they submit - I'm imagining you could do something like this pretty easily: Cool, thanks!
|
# ? Aug 30, 2011 18:10 |
|
I know this was answered awhile back, but how can I speed up the load time of a heroku app? Pretty sure it had something to do with installing new relic to keep your instance running... just wondering if there is another method.
|
# ? Aug 30, 2011 18:18 |
Oh My Science posted:I know this was answered awhile back, but how can I speed up the load time of a heroku app? Are you on a free account? They'll spin your dyno down if there's no activity for a few minutes.
|
|
# ? Aug 30, 2011 18:22 |
|
A MIRACLE posted:Are you on a free account? They'll spin your dyno down if there's no activity for a few minutes. Yes I am currently using a free account, and am willing to spend money to keep it running. I am / was under the impression that adding a dyno or worker would not prevent the instance from dropping. Damnit I was going through the documentation and didn't find that. Thanks VVV Oh My Science fucked around with this message at 18:47 on Aug 30, 2011 |
# ? Aug 30, 2011 18:41 |
looked it up. heroku has pretty extensive documentation.heroku dev center posted:What is dyno idling?
|
|
# ? Aug 30, 2011 18:46 |
|
In regards to the New Relic "trick", there's an availability monitor on NewRelic that will ping your server every 30 seconds or so - if you turn this on with a free instance, you'll never have enough idle time for Heroku to spin down your instances. On a related question, does anyone have any hints for speeding up Heroku loadtime immediately after deploys? It's probably the biggest obstacle in our way to being able to deploy fairly continuously, since every deploy means that users are going to see a loading screen for 10-15 seconds. Also, the migration setup is somewhat weird on Heroku - I'd really like to be able to do database migrations BEFORE deploying code (since 99% of the time they are additive, and code that doesn't know about the new columns will still happily work, whereas the converse is very rarely true.)
|
# ? Aug 30, 2011 21:52 |
enki42 posted:Also, the migration setup is somewhat weird on Heroku - I'd really like to be able to do database migrations BEFORE deploying code (since 99% of the time they are additive, and code that doesn't know about the new columns will still happily work, whereas the converse is very rarely true.) I suppose you could pull/migrate/push your db but that's not really a clean solution.
|
|
# ? Aug 30, 2011 21:56 |
|
A MIRACLE posted:I suppose you could pull/migrate/push your db but that's not really a clean solution. Yeah no, I can't really count on the database not being changed while I'm going through that. I know it's probably an impossibility, it's just more than a little painful to deal with.
|
# ? Aug 30, 2011 21:57 |
|
Does anyone here run selenium tests over a dozen or so VMs? I'm gearing to finalize our setup (such as things can be finalized) and am interested if there are any oddball things I'm not thinking of that have tripped people up in the past.
|
# ? Aug 31, 2011 00:31 |
|
A MIRACLE posted:looked it up. heroku has pretty extensive documentation. Not idling worker dynos is really loving annoying. I realize it's only $34/month but it's dumb to wind down the free web dyno while leaving the worker dyno up, doing absolutely nothing. Edit: So this happened. Read about it here. Plastic Jesus fucked around with this message at 04:18 on Aug 31, 2011 |
# ? Aug 31, 2011 01:00 |
|
enki42 posted:Yeah no, I can't really count on the database not being changed while I'm going through that. I know it's probably an impossibility, it's just more than a little painful to deal with. It's an interesting (read: hard) problem. The safest thing is always going to be, maintenance mode, deploy, migrate, un maintenance mode. If you're willing to do engineering work around it though, you could write your app to work with both schemas new and old, your app can run while the migrations are running. Especially if you use a good database like postgres (which you probably are if you're on us) , the alters can run in a transaction for extra awesome. That's hard to do though, especially with active record out of the box. Pardot fucked around with this message at 22:16 on Dec 8, 2013 |
# ? Aug 31, 2011 08:23 |
|
Also, if you wanted, I suppose you could copy your DATABASE_URL to a second app, and run migrations off of that second app. You'd still need to make sure your code ran on both versions. lovely experience though, but something to consider.
|
# ? Aug 31, 2011 08:28 |
|
Not sure if this is an acceptable place for general Ruby questions, but I can't find any other Ruby thread so figured I'd try here. Looking at the source for the Net::FTP.gettextfile method (http://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/classes/Net/FTP.html#M001274), I can't see how you can end up with the "localfile" argument as nil. Am I missing something here?
|
# ? Sep 7, 2011 16:31 |
|
Juz posted:Not sure if this is an acceptable place for general Ruby questions, but I can't find any other Ruby thread so figured I'd try here. What's the context of the question? What are you trying to do?
|
# ? Sep 7, 2011 16:54 |
|
I'm trying to use that function to return the contents of a file from the FTP server into a variable rather than write it to a file. The comment for the function says "If localfile is nil, returns retrieved data" and it looks from the source like the intention is there to be able to do this, but I can't see how you can do this given that it sets localFile = File.basename(remotefile) in the argument list. I thought I might be able to do gettextfile(my_remotefile, nil), but ruby complains about converting "nil" to a string.
|
# ? Sep 7, 2011 17:01 |
|
Juz posted:I'm trying to use that function to return the contents of a file from the FTP server into a variable rather than write it to a file. The comment for the function says "If localfile is nil, returns retrieved data" and it looks from the source like the intention is there to be able to do this, but I can't see how you can do this given that it sets localFile = File.basename(remotefile) in the argument list. Which version of Ruby are you using? That documentation link from your earlier post is for 1.9. In 1.8, #gettextfile doesn't have the option of not writing to a file and passing nil would result in the error you're getting. e: But in 1.9 what you're attempting would work. Soup in a Bag fucked around with this message at 17:25 on Sep 7, 2011 |
# ? Sep 7, 2011 17:08 |
|
Juz posted:I'm trying to use that function to return the contents of a file from the FTP server into a variable rather than write it to a file. The comment for the function says "If localfile is nil, returns retrieved data" and it looks from the source like the intention is there to be able to do this, but I can't see how you can do this given that it sets localFile = File.basename(remotefile) in the argument list. Default arguments only happen if the argument isn't given, not if it's nil. code:
|
# ? Sep 7, 2011 18:04 |
|
Soup in a Bag posted:Which version of Ruby are you using? That documentation link from your earlier post is for 1.9. In 1.8, #gettextfile doesn't have the option of not writing to a file and passing nil would result in the error you're getting. Ok, looks like this is the problem, I'm on 1.8.7. Thanks for the help.
|
# ? Sep 8, 2011 09:38 |
|
Any suggestions for a captcha setup that works well with Ruby? Basically looking to slow down a brute-force login attempt by adding it as a requirement after say, 4 failed logins. Ideas other than a captcha would be entertained as well, account lockout for a period of time, and making each login take longer to process than the previous one have been ruled out.
|
# ? Sep 13, 2011 14:50 |
|
Bob Morales posted:Any suggestions for a captcha setup that works well with Ruby? http://rubygems.org/gems/recaptcha
|
# ? Sep 13, 2011 17:53 |
|
BonzoESC posted:http://rubygems.org/gems/recaptcha Thanks. https://github.com/kiskolabs/humanizer was suggested, but it only works with Rails 3. Our newest app is on Rails 3 but the rest are on 2, and it'd be nice to use the same thing in the older apps if that need arises.
|
# ? Sep 13, 2011 18:07 |
|
Bob Morales posted:Thanks. https://github.com/kiskolabs/humanizer was suggested, but it only works with Rails 3. Our newest app is on Rails 3 but the rest are on 2, and it'd be nice to use the same thing in the older apps if that need arises. I'm pretty sure I've used the recaptcha gem in both 2 and 3 apps.
|
# ? Sep 13, 2011 18:11 |
|
OK, I really screwed up here. I'm using the Mongoid ORM here, and stupidly set up documents as being referenced when they should have been embedded. Now I'm having performance problems now that the data is growing and I've seeing the error in my ways. What's the best way to pick up the documents and embed them into their parents-to-be? The object IDs correspond to files stored on Amazon S3 so I certainly don't want to lose those.
|
# ? Sep 21, 2011 06:15 |
|
kitten smoothie posted:OK, I really screwed up here. I'm using the Mongoid ORM here, and stupidly set up documents as being referenced when they should have been embedded. Now I'm having performance problems now that the data is growing and I've seeing the error in my ways. Loop through the documents, follow the reference, jam their contents into an embedded field.
|
# ? Sep 21, 2011 13:28 |
|
We now have two Rails 3 apps. When we deployed the first one, it ate all our memory and crashed the server. The second one did the same thing the other day.code:
Rails 3.0.7 (new app 1) uses considerably more memory than Rails 3.0.9 (new app 2) -- but neither is as good as Rails 2.x or 1.x in terms of memory usage. For example, after serving 333 requests, one <old app> process (a Rails 2.x app) is using 69MB of RAM. On the other hand, after serving 64 requests, one <new app 1> orocess (a Rails 3.0.7 app) is using 207MB of RAM. I chose those two apps because they have so much in common that it seems like the only difference is the Rails framework. I set passenger to kill (new app 1) processes after 75 requests. It looks like a bunch of memory is eaten on each request and it's not released. But if you kill the process, then the OS will reclaim the memory. No idea what's causing it though. It's (new app 1)-specific because (new app 2) is a Rails-3 app that does not have any problems. Memory leak of some sort? Garbage collection?? Rackspace wants a good-sized amount of money to add another 24GB to our server (split into 12gb app, 12gb db VM's) But if we signed up another big customer or deploy a third rails 3 app, we'll just be eating up a ton more memory anyway.
|
# ? Sep 22, 2011 16:23 |
|
What Ruby implementation? 37signals uses 1.9.3dev to get tunable garbage collection for speed; REE has the same tuning options but is 1.8.7. Either of these will be better with Passenger than straight 1.8.7 or 1.9.2 due to the way gc and forking interact. You might also want to test a different app server configuration; passenger has lots of knobs and dials you can play with, and unicorn has some too. Finally, there's a reason lots of apps just go to Heroku; scaling is done by adjusting a "how much money you want to spend" slider in real-time.
|
# ? Sep 22, 2011 18:08 |
|
Bob Morales posted:Memory leak of some sort? Garbage collection??
|
# ? Sep 22, 2011 18:31 |
|
Ruby 1.8.7 (2009-12-24 patchlevel 248) Ruby Enterprise Edition 2010.01 Passenger 3.0.7 I am looking at setting up memprof right now, I'm just not sure what could I should be checking (or what the easiest way to check all of it is)
|
# ? Sep 22, 2011 18:48 |
|
|
# ? May 14, 2024 22:33 |
|
code:
Also memprof.com isn't working so I don't know if that's part of the error, I'm trying to just get it to dump to a file by giving a made-up key and using the -f option
|
# ? Sep 22, 2011 19:57 |