hi,
I have a table without an ID column. When I try to delete from it using ActiveRecord the generated SQL is DELETE FROM table_name WHERE ID=NULL, which obviously doesn't work. Is there any way to delete from the table using ActiveRecord, or at least run a raw SQL delete query with placeholders (so it's not vulnerable to SQL injection)...
I am considering the following a "complex" query, given the fact that simpledb is a really simple data storage: I am trying to query a aws-sdb domain with an OR query. using ruby, rails (2) and ActiveResource. I am using the code examples from http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1242 (which don't show Or ...
I'm following the instructions here, and so far so good, but I'm having trouble figuring out this part:
Lastly, download your target version
from the ruby odbc project page and do
a MD5 checksum on it.
What exactly am I supposed to be running MD5 on? The tar file? extconf.rb? I've been poking around for awhile but I just don't ...
Is it possible to keep things DRY and put this into one validation line?
validates_presence_of :login
validates_uniqueness_of :login
...
i know that php is not as good as python and ruby compared from a view of security and performance.
i wonder however, is there a chance for php to reach that level in the future and no one will say..."php is a ugly and slow language"?
a more professional language?
...
mkdir /tmp/scratch
cd /tmp/scratch
git init .
--*--
xx.rb:
SCRATCH = '/tmp/scratch'
repo = Repo.new(SCRATCH)
def add_multiple_commits_same_file_different_content(repo)
previous_commit = repo.commits.first && repo.commits.first.id
dir = "./"
(0...5).each do |count|
i1 = repo.index
i1.read_tree('master')
i1.add("#{dir...
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python?
or is there no major difference just a matter of taste?
cause i know python definetely is a good scripting language.
thanks
...
I'd like to write a irc bot. (please reply with a good irc client library and not a bot framework).
__
why the downvote? I simply like to know which libary is fairly decent and well maintained as there are quite a few ruby irc libraries.
...
I often want to compare arrays and make sure that they contain the same elements, in any order. IS there a consise way to do this in RSpec?
Here are methods that aren't acceptable:
#to_set
For example:
array.to_set.should == another_array.to_set
This fails when the arrays contain duplicate items.
#sort
For example:
array.sort.sh...
i wonder why sun doesnt support python and django in netbeans?
cause i am choosing between learning ruby/rails or python/django.
does this mean that i should use ruby/rails cause then support comes out of the box?
seems that other applications favor support for ruby over python.
...
What's the best way (in terms of both idiom and efficiency) to find the index of the first non-nil value in an array?
I've come up with first_non_null_index = array.index(array.dup.compact[0])...but is there a better way?
...
Not sure if many people are familiar with Scaffolding Extensions for Ruby, but I've looked through their docs, forums, and even the source code of the Heroku test site, and not found an answer.
I made a basic Sinatra app and followed right from the RDoc's instructions:
require 'scaffolding_extensions'
require 'sinatra/base'
class Thing...
I want to create a "Config" class that acts somewhere between a hash and a tree. It's just for storing global values, which can have a context.
Here's how I use it:
Config.get("root.parent.child_b") #=> "value"
Here's what the class might look like:
class Construct
def get(path)
# split path by "."
# search tree for node...
Hello,
This should be a very simple rails question. I have a variable like the following.
@administration = Administration.first
I want this variable to be accessible through every controller action across all my controllers so for example if I have a Product controller and inside of it I have the usual CRUD actions, I want the @adm...
I'm going to start development on a web app using ruby, rails, probably either postgres or mysql, and most likely apache. I'll be using a git repository with the master repo on another server.
I've searched through stackoverflow and done some Googling... so here's what I have so far...
What are your opinions on what's described on this...
I want to upgrade my Mac Snow Leopard ruby from 1.8.7 to 1.9.1 version, anyone know the painless and best way to upgrade? because i read some forum/post/blog/discussion say that is it not good to override the ruby that ship by apple
and what the best way to upgrade rails from version 2.2.2 to 2.3.8? because all the information that i fi...
I would like to do a very simple task: add some markers in a Google Map using a list of addresses from an array.
I have been thinking about generating the Google Maps JavaScript API code using ruby (printf) but this does not seem like a very clean and beautiful solution...
I have read about YM4R for Ruby on Rails... my project is prett...
What is the best/easiest way to configure logging for code kept in the lib directory?
...
Hi,
I write a little ruby script, which sends me an email when a new commit added to our svn.
I get the log with this code:
log = `/usr/bin/svnlook log #{ARGV[0]}`
When I run my script from bash I get good encoded character in the email, but when I try it and create a new commit I get wrong hungarian characters.
I commited this:
...
I'm still fairly new to rails so I'm not sure what I'm missing here.
I'm using GeoKit to geocode an address upon saving. I have a method that geocodes an address and if it fails to find it, it adds an error to the errors list. I've tested it in the console and it is failing on the geocode (presumably adding the error) but still saving s...