small doubt HELP me

this is really basic, basic, basic stuff. you should really read up on
your basics instead of asking people to code for you.

anyway, in your controller get all the entries you want to desplay:
  @entries = Entry.all

then in your view iterate through all entries:
  <% for entry in @entries do %>
    <Div id='<%= entry.id %>'style='color:<%= entry.color %>'><%=
entry.when %></Div>
  <% end %>

of course you could use partials as well. but as you obviously don't
know much about rails, I won't go into that here. seriously learn some
basics.

#1
well, if you just go like this:
  entry.when - entry.to
you'll get the seconds in between both times. you can then calculate
minutes, hours, days, ...

#2
filling in the values should then be a piece of cake.

#3
what you are looking for is not an array, but a hash. shouldn't be
problem, once you've figured out how to write some ruby-code.

i'm still not sure, what exactly you are trying to do, but try
something like this:

  # create hash
  hash = Hash.new
  # iterate through your entries
  for entry in @entries do
    # create date
    date = entry.when.to_date
    # calculate range in days
    days = ((entry.to - entry.when)/86400).round)
    # for every day add a value to hash
    days.times do
      # build the string
      string = "<Div id='1' style='color:" + entry.color + "'>" +
entry.description + "</Div>"
      if hash.has_key?(date)
        # append string
        string = hash[date] + string
      end
      # add to hash
      hash.merge!({date => string})
      # increase date
      date = date.advance(:days => 1)
    end
  end

  # iterate through your hash
  hash.each_pair do |key, value|
    # output
    puts key + '=>' + value
  end

i should mention a few things:
1) i did this because i was bored. for the future, try it on your own
and ask if you are stuck. post your code, so people can spot the error
for you. don't expect people to code for you.
2) i did not test the code above. i just hacked it into this post.
there may be errors in it.
3) your page will not work with all the divs having the same id. id
should be unique, but as php-coder you should already know that...

You don't need a do when you're using for in

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Arrays do not have keys and values. Ruby is not php. An orderedhash is
like a php associative array.

Your description of your problem is not clear enough. Ask simple clear
questions and we can help then. You seem to be having algorhithm
problems, not language problems. Explain your algorhithm to us on
pseudocode and show the ruby you've tried and then we will help where
you're stuck.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Nah, he has string fields

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Your English Has confusions!

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

For...in doesn't take do!

Obviously you're not testing your code before you suggest it!!!

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

hallo julian,

you already said the following:

You don't need a do when you're using for in

you're right on that one, but you don't have to tell me twice:

For...in doesn't take do!

especially as this is just wrong. try it yourself:
  for number in [1, 2, 3] do
    puts number
  end

Obviously you're not testing your code before you suggest it!!!

i already said that:

i should mention a few things:
2) i did not test the code above. i just hacked it into this post.
there may be errors in it.

so: obviously you're not reading a post before you comment on it!

You're right I skim them. Sorry about that. Didn't realize you could
use do there. It's definitely optional tho. I fail :slight_smile: thanks, I learn
something.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/