From the error, I would guess that the @feeds variable is nil. It would be
helpful to see the corresponding controller, and know the url you entered to
trigger the error. My guess is that in some scenario, the @feeds is not
being set in the controller.
On 11/30/06, Chris Gallagher
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> Hi,
>
> Im getting the following error while attempting to apply valdiation to
> email addresses on a form in my rails app:
>
> You have a nil object when you didn''t expect it!
> You might have expected an instance of Array.
> The error occured while evaluating nil.each
>
> Extracted source (around line #39):
>
> 36: <fieldset>
> 37: <legend>Feed subscriptions</legend>
> 38: <p><select name="feeds[feeds][]"
id="feeds_feeds[]"
> multiple="multiple" size="5">
> 39: <% @feeds.each do |feed| %>
> 40: <option value="<%= feed.id %>" <% if
> (@user.subscriptions.find(:all, :conditions => "FeedIdentity >
#{feed.id}").length != 0) %>selected="selected"<% end
%>><%= feed.Title
> %></option>
> 41: <% end %>
> 42: </select>
>
> The validation that im applying within my model is:
>
> validates_format_of :Email,
> :with =>
> /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,
> :on => :update,
> :message => ''has an invalid
format''
>
> This is the first time ive tried to use validation on fields hence I may
> well be missing something really simple here.
>
> --
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---