Displaying 20 results from an estimated 4000 matches similar to: "CollectionAssociation shadows Enumerable#count"
2006 Mar 27
3
Enumerable?
Hi,
Can anyone please point me to some docs on Enumerable. I can''t seem to find
anything on how to use it.
Thanx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060327/0825d5e8/attachment-0001.html
2006 Jan 23
3
prototype.js: enumerable mixin for hash broken
Hello everyone.
I am not sure if this is the right place to post, please redirect me
if there is a mailinglist more specifically dealing with prototype.js.
After playing around with the very inspiring prototype library I have
found a rather annoying thing, that makes the usefulness of the
Enumerable mixin for Hashes
questionable, if I am not totally wrong (again :-).
Here an example:
2006 Jan 23
4
Enumerable
Hi and sorry if this has already been discussed. I''m new on theese
lists, and I couldn''t find a way to search through them.
I have been looking at the sources of script.aculo.us and I''m rather
impressed by the Enumerable class. What I don''t get is why you choose
to extend Array.prototype with this addon. It seems like a rather
intrusive thing to do, if the code
2006 Jun 28
3
Add to enumerable
This might seem like a really daft question, but I couldn''t find an
answer anywhere. How do you add something to an enumerable object?
Something like
var first = $A(getElementsByTagName(''td''));
var second = $A(getElementsByTagName(''tr''));
first.PUSH(second);
where the PUSH is something unknown.
am i supposed to use inject here in some way?
Andreas
2005 Dec 09
5
Prototype Enumerable, Array and Hash Documentation
Hey guys,
I recently published an article documenting some of the more useful
and interesting parts of Prototype''s Enumerable, Hash and Array objects.
You can find it here: http://encytemedia.com/blog/articles/
2005/12/07/prototype-meets-ruby-a-look-at-enumerable-array-and-hash
If you have any feedback or suggestions, fire away.
Cheers,
-Justin Palmer
2012 Sep 18
1
Cochran-Mantel-Haenszel test
Hello,
I have some satellite tag time-at-depth (TAD) frequency data that I
would like some help with.
The data was transmitted via satellite as percent time spent in each of
7 depth bins (0m, 0-1m, 1-10m, 10-50m etc.), binned over 6-hour
intervals. I categorized each row of data corresponding to a date and
time into summer vs. winter, and day vs. night, and then summed and
averaged the given
2006 Oct 16
1
Start script is perfectly fine or How to look like an idiot
Ok let this be a lesson to the general public. If you want to look as
idiotic as I do right now do the following:
Stay up all night and attempt to debug code the next day without coffee
Patch the wrong file RAILS_ROOT/scripts/backgroundrb/start instead of one in
plugin dir.
Create a patch in the right location containing nothing but an extra space
Send it to the whole Ruby community AND file a
2006 Jul 06
1
ActiveRecord::find or Enumerable::find
Does anyone know the difference in performance between an
ActiveRecord::find and Enumerable::find (or detect since ActiveRecord
redefines the find method) for a has_many association?
Here is an example:
I have a list that has 10 lines and I want to find the first blank line.
Which approach would be better?
list.lines.detect { |line| line.content == nil }
or
2008 Mar 25
6
Prototype 1.6.0.2 + Firefox 3 Enumerable problems
I am using Prototype 1.6.0.2 on Firefox 3.0b4.
The following does not work when I enter it in Firebug:
$A([1,2,3,4]).each(function(n) {alert(n);});
The above is just an example. Any array, using $A and any enumerable
method, returns the following:
TypeError: iterator.bind is not a function
Seems like some objects are not being extended correctly?
Using Prototype 1.5.0 on Firefox 3.0b4, this
2007 Mar 07
0
Simulate an enumerable with a mock
I need to simulate an enumerable class (well, it has one method: each).
The code looks something like this OTTOMH:
class Processor
def initialize(input, output)
@input = input; @output = output
end
def run
@input.each do |row|
@output << ProcessorEngine.new(row).process
end
end
end
This is the best I could come up with:
@input
2008 Jan 26
0
"value must be enumerable" exception when using a sweeper?
Folks,
I''m going slightly crazy here - I implemented a Sweeper in an older app
and used nearly the same exact code in my new app, yet I keep getting
this ''value must be enumerable'' exception. Even after I cut most of the
code away, I still get the error. If anyone can help, I would be much
obliged.
Notes: I''m using Engines... wonder if that could cause a
2007 May 20
9
How to test for exceptions
Hi folks,
I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed.
Thanks in advance,
Blake
describe VenuesController, "on update" do
before(:each) do
@venue = mock("venue")
2006 Jul 17
2
Very strange after_save problem. Please help.
I have a very strange problem here. I do not get this. So any help is
greatly appreciated.
Basically I have a model that calls a method in the background
process in the "after_save" method. Let''s call the model products. So
what happens is this:
1. I create a new product.
2. Everything works and the product is saved with id 13.
3. A method is called in my background
2006 Feb 09
3
Error in prototype.js? / Enumerable.each
Hi List!
I am using the latest version of prototype.js from the SVN, including
the wonderful $$ operator to loop through a number of elements with a
certain classname. In Firefox everything works fine, no JS error, but in
IE I get an error in the .each function saying that an Object was expected.
What I do is
function initializePlugins() {
$$(".plugin").each(function(plugin) {
2005 May 13
17
modeling...
I''ve tried tackling this many ways on my own and can''t find a good solution:
Breaking it down to something simplier...
Venue
has one address
Person
has one address
Address
belongs to state
Assuming I don''t want to do tables for venue_addresses and person_addresses.
What is the best way to model this using rails... big thing here is i
want to be able
to reuse a
2007 Mar 22
2
Enumerable sum oddity
Hi.
In this setup "account has_many :consultations". Can anyone explain
the following behaviour to me? Rails 1.2.2. The "sum" method should
return 0 for an empty array.
>> a = Account.find(1)
=> #<Account:0x39c80a8 @attributes={...}
>> a.consultations
=> []
>> a.consultations.sum(&:foo)
ArgumentError: wrong number of arguments (1 for 2)
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base
belongs_to :venue
belongs_to :category
end
class Venue < ActiveRecord::Base
belongs_to :city
end
class City < ActiveRecord::Base
belongs_to :state
end
I want to retrieve all event records belonging to a state. Coming from
hibernate background I tried something like this:
def self.list_for_a_state(state_id)
find_by_sql(["select e.*
2006 May 18
3
populating array of text_fields from an array of model objects
I have in my view the following:
<% 0.upto(@num_performances) do |idx| -%>
<%= text_field ''performance'', ''city'', :index => idx, %>
<%= text_field ''performance'', ''venue'', :index => idx, %>
<% end -%>
and in my controller I have:
@performance = [Performance.new("city" =>
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi,
In my user_controller.rb, I have the following method, which is supposed
to send the user to their profile, dependng on what "role" they are (the
roles correspond to the other controllers: venue, band, fan):
def login
if request.post?
if session[:user_id] = User.authenticate(params[:user][:login],
params[:user][:password])
flash[:message] =
2008 Sep 04
3
Can you use observe_field to watch a select list and then update the contents of a text field?
Before I waste more time trying to figure that out, I was wondering if
it''s even possible? The Rails Way says that observe_field by default
will trigger changes in text fields and text areas, and on clicks for
radio buttons and check boxes. So perhaps I''m using the wrong tool
here? Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you