I have a spec which is failing because of this:
unexpected invocation:
#<AnyInstance:Achievement(id: integer, name: string, created_at: datetime, updated_at: datetime)>.errors()
satisfied expectations:
#<AnyInstance:Achievement(id: integer, name: string, created_at: datetime, updated_at: datetime)>.errors(any_parameters)
In my spec I...
class SomeClass
end
some_local_var = 5
sc = SomeClass.new
def sc.should_work_closure
puts some_local_var # how can I access "some_local_var", # doesn't this work like a closure ?
end
sc.should_work_closure()
Line 9:in should_work_closure': undefined local variable or methodsome_local_var' for # (NameError)
from t.rb:12
...
I have a string:
TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC,...]...
I want to convert it into a list:
list = (
[0] => "TFS"
[0] => "MAD"
[1] => "GRO"
[2] => "BCN"
[1] => "ALC"
[0] => "GRO"
[1] => "PMI"
[2] => "ZAZ"
[3] => "MAD"
[4] => "BCN"
[2] => "BCN"
[1] => "ALC"
[2] => ...
[3] => ......
We're running Ruby workers across a large number of machines using Resque. Every once in a while, we see segmentation faults in our Resque worker processes. It's hard to debug these, because they're fairly rare, and we must run tens of thousands of distributed jobs to trigger a crash.
Ideally, we'd like to capture backtraces and core fi...
As I remember, on Windows, all the gems get installed relative to c:\ruby192, so can we actually have different paths such as
c:\ruby187_rails238
c:\ruby187_rails301
c:\ruby192_rails301
c:\ruby192_try
and therefore have 2 Ruby installations and 2 gemsets for each of them, and create more gemsets as needed this way. (just make sure to...
I am going to be learning Ruby, Haskell and Prolog at university.
Now, I'm wondering what should get most of my attention. I have half a year to do all three, which means I need to decide on one language to get my extracurricular time. The others I will learn just enough to do very good in the course.
I am familiar enough with Haskell a...
I need to mock the following:
Class User
def facebook
#returns an instance of a facebook gem
end
end
So in my User tests, to access the User's facebook info I need to call user.facebook.me.info to retrieve its info. If I want to mock this, I'm currently using the following:
@user = Factory(:user)
facebook = mock()
me = mock()...
Quick background: I'm setting up a quick and dirty templating scheme where all of my template files are named '*.erb'. the fill in data resides in a yaml file. Output is to files with the name of the template, minus '.erb'.
I haven't done much work with erb, and I'm getting the error "`result': can't convert String into Integer (TypeErr...
def find_users_online(count = 1)
users = Array.new
count.times do
users += get_users_online
end
users # <==== I want to remove this here
end
In the code above im must put the "users" variable again at the end of the function to return the right value (users). But is it possible that the times block ...
I find the integration with RSpec, Growl and rails particularly useful. However, it takes about two to three seconds before a change (save file) is picked up by autotest.
Is there a way to increase the interval by which autotest scans for filechanges?
...
Hello,
1 The following is more to point out to the code devs an issue of rails that can be percieved as a flaw.
2 And also me asking some oppinions from people who know better.
I want to add WebDAV to my Rails 3 App with Warden authentication. My warden middleware is injected via Devise.
http://github.com/chrisroberts/dav4rack
...
How to get file creation time in ruby on windows?
File.ctime is supposed to return change time.
dir /tc in cmd.exe returns creation time with bunch of other stuff.
Is there a better way than exec'ing it and parsing?
...
I am trying to work with the Populator gem. I just installed it, but Ruby is unable to load it. I have only one Ruby installation on my machine and it's Ruby 1.8.7. What can I do?
This is the gem that doesn't get loaded.
Edit: Here is the trace out. I should have included this earlier.
Freenaut:bio-clinical newuser$ rake db:populate ...
I'm developing an master rails app which controls other rails apps. It has a bash script to start those rails apps, and it works well while it's invoked in the command line manually.
But if I invoke it in the matter rails app, using backticks, system, or exec, the script will fail.
The error message is:
unicorn_rails worker[0] -c ../c...
I'm running Mac OSX 10.6.4 and setting up rails for the first time. I've been following a bunch of guides to get set up, specifically these two here and here. Also, I know this question has been asked before, but nothing has helped me and my circumstances are a bit different.
First, let me give you my setup.
I've installed Xcode, ...
Hello,
I'm building a site with nanoc and cannot find out how to use a global variable that could be incremented on the compilation of each page.
The idea behind this is to get the list of all tags (incrementing the appearance number each time a tag is seen).
I though that declaring the variable in lib/helper.rb would do the trick, but ...
I am trying to use a question mark in one of my url's but sinatra/ruby is interpreting it as the regex character that makes precedings optional. Is there any way to allow actual ? in your get methods? I have tried \? and [?] but they didn't work. Here is the begining of my get method:
get '/group?groupid=:groupId' do |id|
If I go to w...
In C and many other languages, there is a continue keyword that, when used inside of a loop, jumps to the next iteration of the loop. Is there any equivalent of this continue keyword in Ruby?
Thanks in advance!
...
Hi,
There are conflict with inherited_resources and Ryan Bates's cancan gem.
I have some simple controller
class IssuesController < InheritedResources::Base
respond_to :html
load_and_authorize_resource
def tag
@issues = Issue.tagged_with(params[:tag]).recent.paginate(:page => params[:page])
end
protected
def collec...
I have 2 sets of data as following:
default_products - A set of active record objects retrieved from memcached
owned_products - A set of active record objects retrieved from the database
Retrieving the data is fast and i get around 30-40 req/s when just returning either one of the arrays yet as soon as i do the following to return both...