Rails has a lot of black magic tricks and class loading is one of
them. If you try to use a class that is not loaded, it will load it
for you. Is it possible that when you call Marshal.load, class
LessonPlan is not loaded yet?
On 8/25/06, Nicholas Wieland
<nicholas_wieland-whZMOeQn8C0@public.gmane.org>
wrote:>
> I''m using Marshal with XMLRPC, and I have weird issues.
>
> This is from a script/console session:
>
> >> api = ActionWebService::Client::XmlRpc.new(ResourceApi,
> "http://localhost:3002/backend/resource")=>
> #<ActionWebService::Client::XmlRpc:0x26d01c4
> @client=#<XMLRPC::Client:0x26cc3bc @port=3002,
> @proxy_host=nil, @create=nil, @auth=nil, @proxy_port=nil,
@host="localhost",
> @cookie=nil, @http=#<Net::HTTP localhost:3002 open=false>, @user=nil,
> @parser=nil, @use_ssl=false, @http_last_response=nil, @password=nil,
> @timeout=30, @path="/backend/resource",
@http_header_extra=nil>,
> @handler_name=nil, @api=ResourceApi,
>
@protocol=#<ActionWebService::Protocol::XmlRpc::XmlRpcProtocol:0x26cfe90>>
> >> r = api.search(''lol'', '''',
'''', '''', '''',
'''')
> =>
>
["\004\010o:\017LessonPlan\006:\020@attributes{\034\"\tname\"\nrotfl\"\016text_name0\"\022resource_type0\"\017updated_at\"\0302006-08-23
>
17:46:15\"\vpoints0\"\ttype\"\017LessonPlan\"\010url0\"\020parent_type0\"\aid\"\a10\"\016folder_id0\"\016mime_type0\"\020description\"\tyada\"\020category_id\"\0060\"\nfilename0\"\nfilesize0\"\021not_assigned0\"\016person_id\"\ecqQaUoluer25xXabrrhD-k\"\021instructions\"\000\"\nduration0\"\017class_code0\"\016school_id\"\n38519\"\023text_publisher0\"\017created_at\"\0302006-08-23
> 17:46:15"]
> >> lp = Marshal.load(r[0])
> ArgumentError: undefined class/module LessonPlan
> from (irb):3:in `load''
> from (irb):3
> >> l = LessonPlan.new
> => #<LessonPlan:0x2691b68
> @attributes={"resource_type"=>nil,
"text_name"=>nil,
> "name"=>nil, "updated_at"=>nil,
"points"=>nil, "parent_type"=>nil,
> "url"=>nil, "type"=>"LessonPlan",
"mime_type"=>nil, "folder_id"=>nil,
> "category_id"=>0, "description"=>nil,
"filesize"=>nil, "filename"=>nil,
> "not_assigned"=>nil, "class_code"=>nil,
"duration"=>nil,
> "instructions"=>nil, "person_id"=>nil,
"created_at"=>nil,
> "text_publisher"=>nil, "school_id"=>nil},
@new_record=true>
> >>
>
> It doesn''t make any sense to me ....
> I just call a method on a WebService, and when I try to load it it says
that
> the class is undefined, but as you can see I can have an instance of the
> same class one without any problem ...
>
> Why ?
>
> ngw
>
>
>
> --
> Nicholas Wieland
> nicholas_wieland-whZMOeQn8C0@public.gmane.org
>
>
>
>
> >
>
--
Kent
---
http://www.datanoise.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
-~----------~----~----~----~------~----~------~--~---