I got sidetracked while benchmarking ruby factorial code:
http://rosettacode.org/wiki/Factorial#Ruby
I put all that code into test_fact.rb and ran with:
> ruby test_fact.rb
> rails runner test_fact.rb #from a fresh rails app
> rails runner test_fact.rb #from a mature rails app
here are the resp
I have a 2-part question here that's a little tricky and starting to
make my head hurt.
I'm working on a plugin for personal use, where I have an rclients
table (not named clients because of conflicts with another plugin),
and several other models that can have Rclients (polymorphic
association).
On Jun 10, 12:02 pm, "Älphä Blüë"
wrote:
> For those of you using slicehost, can you confirm or add to any of my
> notes and/or provide some of your own experiences with setup? Did you
> find it very difficult? How about porting over sites from another
> webhost to slicehost.
I started using
I'm throwing sql errors on a User.find_or_create_by_foo_and_email
call.
I created an index with the following:
add_index "users", ["foo_id", "email"], :name =>
"by_foo_email", :unique => true
Then in a class foo instance method:
user = User.find_or_create_by_foo_id_and_email
(self.id,some_email
he name 'foobar' exists already?
>
> On Mar 23, 1:36 pm, klochner wrote:
>
> > Anyone have insight on this one?
>
> > class Parent
> > has_many :children
> > end
>
> > add_index "children", ["parent_id", "name"], :
Anyone have insight on this one?
class Parent
has_many :children
end
add_index "children", ["parent_id", "name"], :name =>
"by_parent_name", :unique => true
a = Parent.find(1)
a.children.find_or_create_by_name "foobar"
Mysql::Error: Duplicate entry 'foobar' for key 2: INSERT INTO
`children`
or the following should work, although I'd consider just writing a
different
partial (_edit_vendor) to render the <% else %> block, and I'd also
just duplicate the closing in each block, trading an extra
line of code for a self-contained table row.
<% unless edit_mode -%>
<%= h vendor.nam
7 matches
Mail list logo