My Rails application is running on a VM. The VM's performance is just fine with static pages. In fact, I'm running another site using Apache virtual hosting that is just serving up static HTML files and the response is adequate. However, my Rails application that is dynamically generating XML files responds very slowly. In fact, it takes...
I'm iterating through an array in ruby with each. Is there an easy way to get the iteration number or array index without going back to a for loop?
...
I'm a beginner to Ruby and RoR. I went through a book (railsspace) which covers the basics. I understand the basics of how RoR works, REST etc.
Beyond this, I'm not sure how to proceed. In short, my questions are
What topics should I concentrate on, to grow as a RoR programmer?
I checked quite a few books, didn't fully like many of...
I recently upgraded my application from Rails version 2.1.2 to version 2.2.2. It was tested in on development and on my staging system. When I moved to production it fails to load all the way through the environment.rb file. (Why, oh why, is it always on production!?!)
Below is my environment.rb file
# Be sure to restart your web serve...
I have a rails controller handling requests to www.mydomain/foo, now I want all traffic to www.mydomain/ (the domain root or homepage) to go to www.mydomain/foo. I asked a similiar question about how to do this with ReWrite, and haven't gotten an answer yet, but I would be happy also solving it in the controller so I have opened up this...
I have read that errors.add_to_base should be used for errors associated with the object and not a specific attribute. I am having trouble conceptualizing what this means. Could someone provide an example of when I would want to use each?
For example, I have a Band model and each Band has a Genre. When I validate the presence of a ge...
I have a small ruby application I wrote that's an anagram searcher. It's for learning ruby, but I would like to put it up online for personal use. I have some experience with Rails, and many here have recommended Sinatra. I'm fine with either, but I cannot find any information on how to use a text file instead of a database. Is there ...
I seem to be having trouble with Rails finding the appropriate path to a textfile I would like to load into memory for processing, for a personal learning project.
require "#{RAILS_ROOT}/lib/english.txt"
or
require "/lib/english.txt"
are not working.
The textfile is located in the lib directory.
I am trying to load it fro...
I'd like to make a customized file manager using Ruby, but I don't want to reinvent too many wheels. Is there an existing file manager with an open API that could be accessed from Ruby? Or, is there a toolkit or framework available to make my own file manager?
Thanks.
...
It seems like there are no guidelines on Ruby Gem package submission. There's no way to tell what is the definitive package for your needs. At least not within the Gem framework itself. Or am I missing something?
For example: I found out about "ActiveLDAP". I did
gem search ldap --remote
and got back
*** REMOTE GEMS ***
activ...
I'm using restful_authentication in my app. I'm creating a set of default users using a rake task, but every time I run the task an activation email is sent out because of the observer associated with my user model. I'm setting the activation fields when I create the users, so no activation is necessary.
Anyone know of an easy way to...
How are you supposed to find stuff on Ruby Doc? I can't find navigate it at all.
...
Hi, I am trying to learn Rails by working with different packages (ActiveRecord, ActiveSupport) without rails gem.
I can't figure out how to create a database with three classes, though.
Here's my rakefile:
require 'rubygems'
require 'activerecord'
require 'yaml'
task :default => :migrate
desc "Migrate the database through ...
I have an HTML document of this format:
<tr><td colspan="4"><span class="fullName">Bill Gussio</span></td></tr>
<tr>
<td class="sectionHeader">Contact</td>
<td class="sectionHeader">Phone</td>
<td class="sectionHeader">Home</td>
<td class="sectionHeader">Work</td>
</tr>
<tr valign="top">
...
require 'pp'
p *1..10
This prints out 1-10. Why is this so concise? And what else can you do with it?
...
I was having a discussion with some programmer friends who said that they see Ruby programmers (in particular) producing a lot of code that's "too clever". So I'm wondering what would that look like? I'm referring to the unnecessary use of an obscure language feature in a context in which something straightforward would have worked just ...
Let's say I have a Ruby class:
class MyClass
def self.property
return "someVal"
end
def self.property=(newVal)
# do something to set "property"
success = true
return success # success is a boolean
end
end
If I try and do MyClass.property=x, the return value of the whole statement is always x. It is a convention i...
I have some base class A with a method that is not to be overridden.
class A
def dont_override_me
puts 'class A saying, "Thank you for not overriding me!"'
end
end
And another class B that extends A and tries to override the dont_override_me method.
class B < A
def dont_override_me
puts 'class B saying, "This is my impl...
Hello,
All I want is to send emails from my ruby scripts, over SMTP using SSL.
I only find examples of doing it from Rails, or for Gmail with TLS.
I found people talking about SMTPS support with ruby 1.8.5, but the libdoc doesn't mention it.
Anyone with an example of sending mail over SMTP with SSL, on port 465?
ruby -v
ruby 1.8.7 ...
I am just learning Ruby and I don't quite understand the difference between several Ruby methods with and without a '!' at the end. What's the difference? Why would I use one over the other?
...