Where is the ActionStruct::Base in rails?


#1

there is a example in

http://api.rubyonrails.com/classes/ActionWebService/Base.html

and it mentioned

class SearchCriteria < ActionStruct::Base
member :firstname, :string
member :lastname, :string
member :email, :string
end

but i can not find ActionStruct’s source code in the rails’s
distribution,and i found ‘NameError: uninitialized constant
ActionStruct’ when using it

should it be ActionWebService::Struct ?

Maybe it’s a type error ?


#2

I also find the example in
http://api.rubyonrails.com/classes/ActionWebService/Invocation/ClassMethods.html

class CustomService < ActionWebService::Base
before_invocation :intercept_add, :only => [:add]

def add(a, b)
  a + b
end

private
  def intercept_add
    return [false, "permission denied"] # cancel it
  end

end

can’t work at all

The method intercept_add need declare two parameters otherwise rails
will report “wrong number of arguments (2 for 0)”

my environment is rails 1.0 ,ruby 1.8.2, windows xp sp2


#3

my environment is rails 1.0 ,ruby 1.8.2, windows xp sp2

On the rails site i think it says not to use 1.8.2


#4

I can’t find ActionStruct in 1.8.3 either
Chris wrote:

my environment is rails 1.0 ,ruby 1.8.2, windows xp sp2

On the rails site i think it says not to use 1.8.2


#5

Chris wrote:

my environment is rails 1.0 ,ruby 1.8.2, windows xp sp2

On the rails site i think it says not to use 1.8.2

Not so. I’m using 1.8.2 on OS X 10.9.3, Windows 2000 and Debian without
problems. The site says 1.8.3 is duff, though…