I am attempting to deploy my first app on Heroku and having a little trouble getting the S3 connection to work.
Here is the error I am getting from the Heroku logs:
AWS::S3::CurrentBucketNotSpecified (No bucket name can be inferred from your current connection's address (`s3.amazonaws.com')):
I have the following configured:
config...
I am developing a mobile Application that users can view their Blog posts and also make posts to their blogs via a mobile phone. I also want it in such a way that the users can save a particular post of interest for future references or to read when they are offline.
What I intend doing is to save the post as a text file and save the tit...
All I want to do is get all the content from a local file and store it in a variable. How?
File.read(@icon.full_filename).each {|l| r += l}
only gives me a part of it. In PHP, I just used file_get_contents.
Thanks!
...
Is there a built-in way or a more elegant way of restricting a number num to upper/lower bounds in Ruby or in Rails?
e.g. something like:
def number_bounded (num, lower_bound, upper_bound)
return lower_bound if num < lower_bound
return upper_bound if num > upper_bound
num
end
...
Our technology set includes java, python, and ruby code (no, we're not google ;-) ).
Recommendations on good CI framework to use? Hudson? Other?
dwh
...
Trying to recreate { script/generate scaffold }, and I've gotten thru a number of Rails basics. I suspect that I need to configure default product url somewhere. But where do I do this?
Setup:
Have: def edit { @product=Product.find(params[:id]) }
Have edit.html.erb, with an edit form posting to action => :create
Have def create { ... ...
I know that title didn't make sense, Im sorry! Its hard to word what I am trying to ask. I had trouble googling it for the same reason.
So this isn't even Ruby specific, but I am working in ruby and I am new to it, so bear with me.
So you have a class that is a document. Inside each document, you have sentences, and each sentence has...
It's a pretty normal binary tree, except for the fact that one of the nodes may be empty.
I'd like to find a way to output it in a horizontal way (that is, the root node is on the left and expands to the right).
I've had some experience expanding trees vertically (root node at the top, expanding downwards), but I'm not sure where to st...
I have been learning Ruby lately, and I want to upload a test web application to my server. But I can't figure out how to get it to run on my shared hosting.
My Hosting Details
Shared Hosting with JustHost (see here for list of features)
OS: Linux
Apache: 2.2.11
cPanel: 11.25.0-STABLE
No SSH access.
Can install Ruby Gems.
Can't instal...
I have a Ruby program that loads up two very large yaml files, so I can get some speed-up by taking advantage of the multiple cores by forking off some processes. I've tried looking, but I'm having trouble figuring how, or even if, I can share variables in different processes.
The following code is what I currently have:
@proteins = ""...
Hey all,
I need to query my database table to find which employee has the most support tickets related to them. I can do this just fine using this MySQL query:
SELECT employee_id, COUNT(id) AS number_of_tickets FROM tickets GROUP BY employee_id ORDER BY number_of_tickets DESC LIMIT 1;
How would write this in Ruby-on-Rails?
Thanks v...
Hi,
So using the regular MongoDB library in Ruby I have the following query to find average filesize across a set of 5001 documents:
avg = 0
total = collection.count()
Rails.logger.info "#{total} asset creation stats in the system"
collection.find().each {|row| avg += (row["filesize"] * (1/total.to_f)) if row["filesize"]}
...
Hi,
I have the following code in my project`s lib directory
module Pasta
module ClassMethods
def self.has_coordinates
self.send :include, InstanceMethods
end
end
module InstanceMethods
def coordinates
[longitude ||= 43.0, latitude ||= 25.0]
end
end
ActiveRecord::Base.extend ClassMethods
...
How should I be passing in the ID?
Error:
Couldn't find Product without an ID
Form:
<% form_for :product, @product, :url => { :action => :update } do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :names %><br />
<%= f.text_field :names %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
Controller (for /...
After executing this code:
var runtime = IronRuby.Ruby.CreateRuntime();
var engine = IronRuby.Ruby.CreateEngine();
var scrope = engine.CreateScope();
engine.ExecuteFile("libtest.rb");
How can I get all the methods of a ruby class in c# code?
...
Given any object in Ruby (on Rails), how can I write a method so that it will display that object's instance variable names and its values, like this:
@x: 1
@y: 2
@link_to_point: #<Point:0x10031b298 @y=20, @x=38>
(Update: inspect will do except for large object it is difficult to break down the variables from the 200 lines of output, ...
How do you reverse a string in Ruby? I know about string#reverse. I'm interested in understanding how to write it in Ruby from scratch preferably an in-place solution.
...
Hello, I'm pretty new to Ruby/Rails but I was taking a look at bundler and was wondering how it works exactly. Do you install a full set of gems like normal gem install XYZand then use the Gemfile to pull a certain subset of those gems for use with a specific application? Or do you not install gems normally anymore and just include them ...
According to this rubyquiz, external iterators used to be slow, but are now faster. Is this an improvement only available in YARV (the C-based implementation of ruby 1.9), or is this also available in the C-based implementation of ruby 1.8.7?
Also, does enum_for rely on external iterators?
...
I am trying to override Ruby's <=> (spaceship) operator to sort apples and oranges so that apples come first sorted by weight, and oranges second, sorted by sweetness. Like so:
module Fruity
attr_accessor :weight, :sweetness
def <=>(other)
# use Array#<=> to compare the attributes
[self.weight, self.sweetness] <=> [other.we...