Ruby on Rails Friday, April 1, 2011

On 1 April 2011 08:16, Manny 777 <lists@ruby-forum.com> wrote:
> No no, the exactly error is "undefined method `sequence' for
> nil:NilClass".
>
> It looks I am getting the database object in var "high",  but I can't to
> get individual items from this object (like "sequence" or "name"). When
> I am trying to print the sequence (puts high.sequence), I am getting
> error "undefined method `sequence' for nil:NilClass".


That is not what you said the error was initially.
High must be nil. Try surrounding the code by if !high.nil? (or just
if high). That should make the error go away. Then you can work out
why high is nil.

Colin

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have generated with form.fields_for and
form.grouped_collection_select
the following html (this is just sample):
<select name="car[name]">
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>

when user submit form, in log i have params[:car][:name] = "Swedish
Cars"
i did not success to reproduce this issue .. except replacing one of
"option"'s value with "Swedish Cars"
But optgroup in normal situation should not be selected ... maybe IE9
bug ? (i dont know what browser was that)

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

No no, the exactly error is "undefined method `sequence' for
nil:NilClass".

It looks I am getting the database object in var "high", but I can't to
get individual items from this object (like "sequence" or "name"). When
I am trying to print the sequence (puts high.sequence), I am getting
error "undefined method `sequence' for nil:NilClass".


If I look to data stored in database, I see:


{ "_id" : ObjectId("4d94f53fd3d8496acd00000d"), "name" : "John",
"surname" : "Smith", "level" : 0, "sequence" : 0 }


So I am a bit confused, where could be fail

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.