I have the following code:
Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(",")
(Essentially I'm trying to build a JS array of tag names)
When I run this code, I get:
LocalJumpError: no block given
from (irb):13:in `each'
from (irb):13
Any ideas?
...
hi, i don't really know what ruby,gems, or ror is, my objective is make this web application run in my local and after that push it on live. the problem is, when I perform this command
rake db:migrate
i am getting an error saying
rake aborted! Could not find RubyGem rack (~) 1.0.1)
what should I do ? please help me
...
I can't seem to get the Ruby Shoes packager to correctly create an exe with Shoes included. I'm using the Raisins release (0.r1134), with the pack.rb replaced from github. The exe's the packager makes are all 70-80K files (they obviously don't include shoes or ruby). These exe's will run on my XP machine that already has Shoes on it. ...
By default when I upload new images, the folder created have 777
permissions
Is there a way to restrict permissions on the new folders?
Thanks
...
Hi so I have a list of 'areas' that are just areas of my site. I want to be able to insert them in to the database and say what type of area they are, this could be the name of the model that inherits from a base Area. This way I can write a generic controller which uses different views and different logic from the loaded model to decide...
I'm just getting into Factory Girl and I am running into a difficulty that I'm sure should be much easier. I just couldn't twist the documentation into a working example.
Assume I have the following models:
class League < ActiveRecord::Base
has_many :teams
end
class Team < ActiveRecord::Base
belongs_to :league
has_many :play...
I am running a sinatra app through RACK.
To which file does the activity get logged ? Also how can I set the log file path ?
...
Hi, I'm currently have a ruby app that is running on Datamapper 0.9.11, and I wonder if upgrading to 0.10.x is a good idea. Any experiences regarding upgrade, performance or reliability problems with the 10.x. branch?
...
ruby: What is the most optimized expression to evaluate the same as result as with
phrase.split(delimiter).collect {|p| p.lstrip.rstrip }
...
I've gone through the Facebooker msg archive, google, etc and found a couple messages dealing with this and they basically say "Go look at the Facebook docs and see what is happening". I did that, but I'm still not clear what is going on and why I'm not able to retrieve my profile or status arrays using Facebooker. I'm starting to think ...
I've got a ruby script that opens a connection to Apple's push server and sends all the pending notifications. I can't see any reason why, but I get broken pipe errors when Apple disconnects my script. I've written my script to accomodate this happening, but I would rather just find out why it's happening so I can avoid it in the first p...
I need to upload a bunch of files in a directory to S3. Since more than 90% of the time required to upload is spent waiting for the http request to finish, I want to execute several of them at once somehow.
Can Fibers help me with this at all? They are described as a way to solve this sort of problem, but I can't think of any way I can...
With reXml using Ruby, I have a particular element and I want to completely clear out all its child nodes and text.
I just cannot work out how to do this.
Given this :
<ug>
<oog>
Delete<delete/>all<delete/>this
</oog>
</ug>
I want to delete all the children of oog, to end up with this :
<ug>
<oog>
</oog>
</ug>
I can g...
There is always a degree of black magic when it comes to Rails and I can't find the documentation to help me figure out this one. What redirect_to does is clearly straight forward. In fact, this question isn't even directly related to, but an argument I see passed to redirect_to often and can't understand where that argument is coming fr...
is there any other simple,nicer way?
require 'pp'
a1 = ["02/28/10","Webinars","131","0","26 Feb 2010","0","3d, 8h, 49m, 18s"]
a2 = ["02/20/10","Webinars","131","9","26 Feb 2010","0","3d, 8h, 49m, 18s"]
def compare(array1,array2,ignore)
tmp1 = Array.new
tmp2 = Array.new
0.upto(array1.length-1) {|index|
if !ignore.include?(in...
Hi,
I have a hash like,
object = { :type => 'book', :name => 'RoR', :price => 33 }
OR
object = { :type => 'wig', :name => 'Elvis-Style', :price => 40, :color => 'black' }
The problem is that keys in above hash may be different all the time or even increase and decrease depending upon the object type.
What I want to do generate XM...
Somewhere along the line from the DB to the application, this:
sauté
is getting turned into this:
sauté
I'm using Ramaze + Rack + MySQL. I've got a force_encoding plugin set up, so the encoding on the string is UTF-8. If I view the record in the database shell, it's looks fine. The default charset on the table is utf8, and the fie...
Hi... most of my apps have a lot to do with web services and often due to the third party site, I get timeout issues.
This is the error that I get:
execution expired
/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill'
How do I rescue this kind of error in a rails app?
...
Hello guys, I need a tool to parse Lua table expressions. If all else fails, I will eventually just code a small Lua module to convert tables to XML, but for the time being, I am interested in a Ruby library doing that, but failing that, I would accept tool in any language, provided I can look at its source.
Here is an example snippet (...
Hey Guys,
I am currently having issues uploading files to amazon S3 while using paperclip. It uploads half the files, and then chokes, with the error: IOError (closed stream) I have no idea what's causing this, any help would be really appreciated.
Here's the stack trace:
/opt/local/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/conne...