I am compiling HornetsEye on Linux Mint 9. And I think it should be successful. When I tried 'require 'hornetseye'' in irb, I got the following message.
RuntimeError: /usr/lib/ruby/1.8/i486-linux/RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use.
from /usr/lib/ruby/1.8...
My problem basically looks like this:
module Foo
class Bar
def self.who
self.class.to_s
end
end
end
class World < Foo::Bar
end
When I call World.who I don't get "World" as a result, I get "Class". Some quick Googling didn't yield anything useful, so hence I'm here hoping someone will know how to get the correct cla...
I have the following. Each article has a title and a body and also up to three urls. I would want to store the urls in a different table. Therefore in my form, i've a field for the urls. However they are not working, only the article fields get entered into the database. how should i specify them? Could any kind soul help me out with thi...
In Ruby unit testing can I run a test class from another class
for exa
class Foo < Test::Unit:: TestCase
test_abc()
test_bnd()
Now i want to run this above test suite from my main class
so how could i do it I tried using runner
but dono wat should be argument to the run method
Test::Unit::UI::Console::TestRunner.run(FOO)
,
R...
I'm running Ruby 1.9.1p243 on CentOS, and I decided to install rvm to handle upgrading to 1.9.2 or downgrading to 1.8.7 (whichever turns out to work better for rails3).
I followed the instructions here: http://rvm.beginrescueend.com/rvm/install/ and everything installed correctly. I was able to compile and install Ruby 1.8.7, 1.9.1, and...
I have a route that looks like the following:
map.newsletter '/newsletter', :controller => "newsletter" , :action => "newsletter_signup"
There is also a NewsletterController and a Newsletter model. The thing is, I wanted to keep my controller down to one simple method, newsletter_signup. In there I simply check if the request is of ty...
Sorry if this is a dumb question, but I am new to Ruby on Rails. I would like to do something like this in my amazon_s3.yml config file:
access_key_id: ENV['S3_KEY']
secret_access_key: ENV['S3_SECRET']
...but I know this isn't working. Not sure if it is even possible, but can you put Ruby code in a YAML file?
...
I am trying to write some small timeout code:
t = Thread.new { sleep 3 } # <- The thread that will do stuff.
Thread.new { sleep 2; t.kill; p 'hi!' } # <- The thread that will kill it after two seconds.
t.join
If the first thread completes it's job within two seconds, it will stop, and the main thread will have nothing to do. This will...
Imagine I have this object (written with Ruby literals) stored in a MongoDB:
{"tags" => ["foo", "bar"],
"jobs" => [{"title" => "Chief Donkey Wrangler", "tags" => ["donkeys"]}] }
Now, I want to search for objects based on the tags on the first level of data, not the second. I can write a query like this (using the Ruby MongoDB librar...
I noticed this little tid-bit in the readme for pickle:
(The latest version of pickle supports multiple
blueprints, for earlier versions of machinist use pickle <= 0.1.10)
I'm running in to a situation where I want to create a user with admin privileges. I've got two machinist blueprints:
User.blueprint do
first_name
last_name
...
In the following code example, why does the second (sheetplus) method seem to pick up the instance variables @name and @occupation fine, but the first (sheet) method return nil? I feel like I'm missing something deadly obvious, but I am basically the world's worst Ruby programmer.
class Test
def initialize(name, occupation)
@name = n...
So Im trying to implement a file upload functionality where when a user uploads a file, I can read that into a File object and process it accordingly:
def create
name = params[:upload]['datafile'].original_filename
directory = "public/data"
# create the file path
path = File.join(directory, name)
# read the file
Fil...
I am planning to learn selenium, what would be the best language to learn along with selenium?
Perl or Ruby or others?
...
I saw this in a rails 2 vs 3 comparison pdf lecture and I'm not sure what's going on with the preview and archived flags.
post.resources :comments, :member => { :preview => :post },
:collection => { :archived => :get }
Any ideas?
...
I am stuck in this error for quite sometime now and have hit a dead end.
I get this totally unhelpful error
can't dup NilClass
This is the situation.
I have one class which is in a relationship with another. Say
class Parent
end
class Child < Parent
unloadable
:has_many :parents, :foreign_key => "child"
end
The err...
I'm trying to implement support for Apple's enhanced Push Notification message format in my Rails app, and am having some frustrating problems. I clearly don't understand sockets as much as I thought I did.
My main problem is that if I send all messages correctly, my code hangs, because socket.read will block until I receive a message. ...
Hi - I was wondering, if theres a way in rails to calculate time stamp like - half a minute ago, 2 minute ago, 1 day ego etc. Something like twitter real time date stamp.
I want to know if ruby/rails has a pre-built function for such date-time conversion??
...
I have installed Ruby.
When I start the Mongreal server I get this error message
the program cant start because msvcrt-ruby18.dll is missing
I even downloaded the file msvcrt-ruby18.dll, but no use
I googled it, but cannot solve the problem
...
I found this Ruby code to help use the Imageshack API on CodeSnippets. I'm new to Ruby on Rails, so I know how to use models, views and controllers generally, but I'm not sure how I just use this code. Would it be a module? Thanks for reading.
Usage:
pic_online =
ShackMirror.new(local_path_of_pic)
pic_online.url # => retu...
hi
I have a menu class and that have many menu_items and a menu_item class that is embedded docuemnt.
I can get a specific menu like
menu = Menu.find_by_name("menu 1")
then i want to find and update or create the menu_item that matches a specific category id.
I want to create the menu item if category id is not found in menu items...