Hi, could you provide a little bit more detail? I''m guessing that
you''re
entering that data into a form. Thus, could you provide the form as well as
the processing code? Next, person.name from the context of the Ruby code
should be an instance of Person.rb. Lastly, if the post variable in your
form is name="person[name]", then you can access in the resulting
action as
follows:
def <my_action_method>
name = params[:person][:name]
end
Good luck,
-Conrad
On 1/10/08, OnRails <zzzlai-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
wrote:>
>
> I have object person.=>#<person id: 123, name: "test", sex:
"1">
> when I check name value in rails 2.0.2
> used:
> puts person.name
>
> I got this Error:
> #<NoMethodError: You have a nil object when you didn''t expect
it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.[]>
>
> I use this way in rails 1.2.6, I can get right value "test"
>
> but when I used:
> puts person["name"]
> I got the value "test"
>
> So Now I have confused, what happen? Who Can tell me why?
> Thanks!
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---