search for: each_index

Displaying 11 results from an estimated 11 matches for "each_index".

Did you mean: cache_index
2006 Mar 04
5
has_many and belongs_to example?
Hi! If i have 2 tables i.e. product and images and product has_many images, image belongs_to product - how to create _form.rhtml, new/create and edit/update methods in product controller, so in a single form i can add one product and MANY (let''s assume for now that this number is fixed) images for this product? Pleeeeease help me :) -- Posted via http://www.ruby-forum.com/.
2008 Jul 08
12
Some more win32-security: SID.create
Hi all, How does this look as a general approach to a SID.create method: # Creates and initializes def self.create(authority, *sub_authorities) if sub_authorities.length > 8 raise ArgumentError, ''maximum of 8 subauthorities allowed'' end authorities = Array.new(8, 0) authorities.replace(sub_authorities) count = authorities.select{ |e| e > 0 }.size
2006 Aug 24
3
A new QueueWorker class
Hello all, I''ve come up w/ a worker class that manages queued jobs using a fixed number of child workers. Well, that''s not quite true -- a new worker is spawned for each job, but you set the total number that may exist at once. There are three components: 1) queue_worker.rb: The singleton worker that manages the child workers. You probably want to auto start this. Make sure you
2006 Feb 28
6
Problem with select and each_with_index
Disclaimer: Ruby newbie at work Thought I was going so well. Wanted to produce a select box from an array constant, with the indices returned as values , and the array values used as the descriptions. Checked out Ruby RDoc and saw there was an each_with_index method and came up with: <%= select (''type'', ''typecategory'', Typecategory.each_with_index
2006 Jan 17
8
Next Record
Okay, I know this will probably be a very easy question. But I am discovering that RonR makes just about everything easy. The problem is, it takes me a few hours to figure out that I can do it the easy way. I need to know how to move to the next record in a database. I want to format my out put in a table. For example, I want a 3 by 3 table. So record one goes in the first cell, record
2006 May 15
0
acts_as_list, move_higher, odd indexing behaviour?
...39;transaction_id'' belongs_to :account acts_as_list :scope => :transaction_id belongs_to :credit_type end #unit test class AccountTransactionTest < Test::Unit::TestCase fixtures :account_transactions, :credits def display_credits(transaction) transaction.credits.each_index do |x| credit = transaction.credits[x] puts " index #{x} id #{credit.id} position #{credit.position}" end end def test_credits assert_equal @account_transaction.credits[0].id, @first_credit.id assert_equal @account_transaction.credits[1].id, @second_cre...
2008 Jan 09
0
odd manifest problem
...=> 0644, owner => root, group => root, content => template("network/resolv.erb"), } } and the template: ; search domain for <%= domain %> on <%= fqdn %> <% a = domain.split(".") b = [] a.each_index {|i| b << a[i..-1] } b.pop -%> search <% for sd in b -%> <%= sd.join(".") + " " -%> <% end %> <% for ns in nameservers -%> nameserver <%= ns %> <% end -%> now if I do a very small and simple manifest ---- notice "this is domain...
2006 May 31
7
How do you create a controller & view to create a list of objects?
I''m trying to figure out how to design a view and controller to work with a simple collection. I have a Foo that has many Bars, so here''s what I did: $ ruby script/generate model Foo $ ruby script/generate model Bar (Uncomment t.column, :name: :string in foo and bar migrations) (Edit Foo.rb and Bar.rb, add has_many :bars to Foo, belongs_to :foo to Bar) $ rake db:migrate $ ruby
2009 Jan 29
4
Help understanding EVERYTHING
Team, I am trying to learn a GUI for Ruby and I picked wxRuby. The problem is that I am kind of slow learning this and I now feel frustrated after trying for about at least 7 hours. I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - 9, using buttons. I posted a question on Ruby forum ruby-talk and a gentleman, Alex Fenton, answered my questions. Alex gave me what appear to be
2006 Apr 28
7
acts as drop down
Hi Im using the acts as drop down plugin and have this code below acts_as_dropdown :text => "forename", :order => "forename" It currently makes use of the forename in the option tag, how can I get it to use the surname as well ie somthing like ''forename'' . ''surname'' in php Thanks -- Posted via http://www.ruby-forum.com/.
2008 Mar 16
8
include a page in another
Hi, for my isbn plugin, I''m wishing to incldue generated isbn pages in caller pages (the ones with <isbn value=""> tags). But I want my isbn page to be processed before for its tags to be transformed (like the relocatable or other ones). Besides, i do not want its header to be included. Is there an easy solution for that, or should I do the work myself ? -- Nicolas