>>> And why not use Haml?
>> I don't know what that is
>
> But you know what Google is, right? :) Look it up!
haha, thanks, already did. HAML sounds good
> Where in the controller are you setting the variable? Let's see the
> entire controller method that you're using.
I was setting it at the top of the controller, thinking it would
propagate to all the methods.
class ServicesController < ApplicationController
@durations = {"30 minutes" => "30", "1 hour" => "60", "1 hour 30
minutes" => "90", "2 hours" => "120"}
def index
@services = Service.all
...
end
But then I moved it inside the method.
def new
@service = Service.new
@durations = {"30 minutes" => "30", "1 hour" => "60", "1 hour 30
minutes" => "90", "2 hours" => "120"}
....
It gave me another descriptive error message that led me to fix the form
partial.
<div class="field">
<%= f.label :duration %><br />
<%= f.select ("duration", @durations, :prompt => "Select") %>
</div>
And it works now! XD
Sorry, I know this is probably very basic but I just started yesterday
my first Rails application outside of a tutorial book.
Thanks for pointing me in the right direction! :D
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.