The aws-s3 documentation says:
# Copying an object
S3Object.copy 'headshot.jpg', 'headshot2.jpg', 'photos'
But how do I copy heashot.jpg from the photos bucket to the archive bucket for example
Thanks!
Deb
...
Hi, everyone.
In my rails application my models have a to_html method. This method is called in one of the views so the model's attributes can be displayed properly regardless of their classes (because all of my classes implement that method)
That is a neat solution, but one thing bugs me. I need to write this html code inside the doub...
Hi,
I have some models - NewsArticle, Comment, User (as :author) and Profile.
class NewsArticle < ActiveRecord::Base
belongs_to :author, :class_name => "User", :foreign_key => "user_id"
has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at', :include => 'translations'
end
class Comment < ActiveRecor...
I read that as you are using the default Rails stack you are happy, but if you try to swap something then the real headache begins.
How hard is it to use jQuery instead of Prototype and Haml instead of ERB?
(I'm not Rails developer, I just trying to collect some info about it).
...
Hey,
Erb is the default template type in Rails and I read about Haml.
What other types exist and can be used in Rails?
Thanks.
...
Hi,
I have written a Ruby gem named 'this'. Get it here http://rubygems.org/gems/this. Purpose of 'this' is to show quotes of 'The Zen of Ruby' whenever you "require 'this'". As I could not find any equivalent zen quotes for Ruby, currently I am using 'The Zen of Python' (PEP 20). Extremely sorry for using it :)
Can you guys suggest me...
I am trying to create a quizzing style skill drilling site and use Cucumber to drive the testing. As a rough estimate pretend I am presenting the user with two numbers, and asking the user to click a button representing their difference. Two obvious scenarios would be:
Scenario: Difference drill, correct answer
Given I am on the diffe...
Depending on if a user is signed in or not, I'd like to print a different kind of %body-tag.
This is how I currently do it:
- if defined? @user
%body(data-account="#{@user.account}")
%h1 Welcome
-# all my content
- else
%body
%h1 Welcome
-# all my content
As you can see there's a lot of duplicated code in there. H...
I am using a gem which uses soap/wsdlDriver.
When I post I get back a SOAP response and am unable to easily parse it.
This is the response I get back:
#<SOAP::Mapping::Object:0x159e95faf098 {}id="27b907f8-da51-f611-ab02-4c5f88a8ec8
8" {}error=#<SOAP::Mapping::Object:0x159e95fae33c {}number="0" {}name="No Error"
{}description="No Erro...
Hi,
I've been learning Ruby, so I thought I'd try my hand at some of the project Euler puzzles. Embarrassingly, I only made it to problem 4...
Problem 4 goes as follows:
A palindromic number reads the same
both ways. The largest palindrome made
from the product of two 2-digit
numbers is 9009 = 91 × 99.
Find the largest p...
Disclaimer, I know very little about Rails. I'll try to be succinct.
ModelA belongs_to ModelB
ModelB has_many ModelA
The JSON Show action of the ModelA controller should show all ObjectA's that are belonging to the ObjectB of which the ObjectA in question is a member of.
So if I have an ObjectB that contains ObjectA's of ID 1, 2, and ...
Well, I think the code speaks out for itself :)
# book_in_stock.rb
class BookinStock
attr_reader :isbn, :price
def initialize(isbn, price)
@isbn = isbn
@price = Float(price)
end
end
# csv_reader.rb
require 'csv'
class CsvReader
def initialize
@book_in_stock = []
end
def read_in_csv_data(csv_file_name)
C...
Hi,
I have a Place model that has both 'city_name' and 'name' as attributes. I would like to define a custom method that finds the place whose name matches the city_name for another place eg.
Place.name = "foo"
Place.city_name = "baz"
then Place.find_city gives the record where Place.name = "baz". At the moment I've got something alon...
Is there a way to "reload" or "refresh" a rubygem in memory? As i'm playing in irb, occasionally I like to modify my gem files, and if i require the same gem, it does not update into memory and gives the output "false". Currently I have to exit IRB, get back into IRB and then require the gem again, there has to be a better way...what is ...
pipe = IO.popen("my_cmd 2>&0")
while ???
line = pipe.gets
puts line if some_condition
end
This is using Ruby 1.8.7 on Windows. my_cmd is an application that prints database records to the stdout. One line per database record, and there's no way to know how many records there will be before I run the command. Each gets call retur...
I'm making an application which is listening to prices being updated regularly, but occasionally my data source throws me something like "1.79769313486232e+308". The numbers that get sent will never by really big numbers (eg. "179769313486232e+308"), but as with the example above, they come with a lot of precision.
I'd be happy to drop ...
I have ruby program that is running into a stack level too deep (SystemStackError) error, ending on datamapper:
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/collection.rb:510:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/query/conditions/comparison.rb:616:in `map'
from /usr/local/lib/ruby...
Can anyone tell me how I could go about authenticating with the various OAuth login mechanisms on the internets (Twitter, Facebook) so that I can run scripts against these services.
As an example, right now when I use Facebook data I goto graph.facebook.com and copy paste the access key from the URL. Obviously this is a bad approach, i...
Hello, when running a Rails server, I get the following error:
no such file to load -- openssl
I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I get the following:
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -...
I'm new to both Ruby and to Mac OSX, though I do have a fair amount of experience with Unix commands. I just installed Ruby 1.9 via a MacPorts command (port install ruby19). I then needed to do a find from root just to figure out where it went, which turned out to be: /opt/local/var/macports/software/ruby19/1.9.1-p376_0/opt/local/bin/rub...