Hi, I am working on creating a daemon in Ruby using the daemons gem. I want to add output from the daemon into a log file. So I am wondering what is the easiest way to redirect puts from the console to a log file?
...
Some of the answers to a question I had about redirect_to made me think about some other questions.
Basically I'm writing a blog application using Rails 2.1. I've been trying to do most of it myself (as I know a bit of rails), but with reference to tutorials and references on the internet when I need it.
I managed to get a simple blog ...
I'm wondering if it's possible to embed Ruby as a scripting language in Microsoft XNA, and what's the best way to do that. I'm looking for something like Xnua, except for Ruby.
I've stumbled upon Ruby.NET and IronRuby and both seem to be in very early stages, so I'm not sure how usable they are. Furthermore, I'm not sure if they'd work...
I am using the ruby daemons gem to create a custom daemon for my rails project. The only problem is that when I try to start the daemons ruby lib/daemons/test_ctl start that it fails and will not start. The log file has this output.
# Logfile created on Wed Oct 22 16:14:23 +0000 2008 by /
*** below you find the most recent exception th...
I've been reading up on conditional style expressions in ruby, however I came across one I couldn't quite understand to define the classic FizzBuzz problem. I understand the FizzBuzz problem and even wrote my own before finding the following quick solution utilising the ternary operator. If someone can explain to me how this chain works ...
I have an ActiveRecord model, Foo, which has a name field. I'd like users to be able to search by name, but I'd like the search to ignore case and any accents. Thus, I'm also storing a canonical_name field against which to search:
class Foo
validates_presence_of :name
before_validate :set_canonical_name
private
def set_cano...
I recently installed RailRoad gem to generate an .svg diagram of my app's models and controllers.
The rake task keeps breaking with a similar error:
1.8/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant
I tried the rake task on 2 seperate apps and ...
I have a partial that renders a select box using the following method:
<%= collection_select 'type', 'id', @types, "id", "name",
{:prompt => true},
{:onchange =>
remote_function(
:loading => "Form.Element.disable('go_button')",
:url => '/sfc/criteria/services',
:with => "'ty...
Everyone is talking about TDD (BDD) in Rails (and not just Rails) development world today. It's easy to find plenty of good general information about it, there are quite a few tools you can use for this purpose and there are many (good) examples of how to use them.
Now, I'm already on the train. I like the idea (never did TDD before) a...
Hi,
I am playing around with Ruby in Windows using Notepad++ and the console but am finding this extremely inconvenient due to the lack of tabbed consoles.
Any recommendations for a more comfortable environment?
...
I have a Rails app that sets a cookie and does a redirect to another server once the user is logged in. However, the cookie that the Rails app sets isn't seen by the server for some reason. I've tried setting http_only to false but I still can't even see the cookie unless the domain is the same as my Rails app. Here's the code I'm using ...
I am trying to debug an ActiveResource call that is not working.
What's the best way to view the HTTP response to the request ActiveResource is making?
...
I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exception using the default rails logger?
...
I'm new to ruby and I'm playing around with the irb.
I found that I can list methods of an object using the ".methods" method, and that self.methods sort of gives me what I want (similar to python's dir(builtins)?), but how can I find the methods of a library/module I've loaded via include and require?
irb(main):036:0* self.methods
=>...
I'm trying to get tags working in my rails application and want to use acts_as_taggable. Firstly I followed the instructions I found in Rails Recipies (a free sample bit online) that used the acts_as_taggable plugin. However, I then found this site which seems to have a gem for acts_as_taggable which is more advanced (has options for rel...
When using something like object.methods.sort.to_yaml I'd like to have irb interpret the \n characters rather than print them.
I currently get the following output:
--- \n- "&"\n- "*"\n- +\n- "-"\n- "<<"\n- <=>\n ...
What I'd like is something similar to this:
---
- "&"
- "*"
- +
- "-"
- "<<"
- <=>
Is this possible? Is the...
The Background
I started a Rails project recently and decided to use RESTful controllers. I created controllers for my key entities (such as Country) and added index, new, edit, create, show, update, delete. I added my map.resources :country to my routes file and life was good.
After development progressed a little, I started to encoun...
I'm using Mongrel::DirHandler to control response headers for static files - this works great on my dev machine. My production machine uses Passenger so my headers aren't getting set. How do I control headers for static files when using Passenger?
snippet from my environment.rb:
if defined? Mongrel::DirHandler
module Mongrel
clas...
In a project I am working on, Apache is set up to only forward requests that come in as /prefix/* to mongrel. How can I tell ruby on rails to generate all URLs with that prefix?
I have the routes set up for forward to the correct controller action by doing this:
map.connect 'sfc/:controller/:action'
but that doesn't seem to affect t...
For some weeks now I simply can't run gem install in windows.
It sticks on this line:
C:\Windows\System32>gem install rails --version 2.1.2
Bulk updating Gem source index for: http://gems.rubyforge.org/
Any ideas what it could be?
...