Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing error: undefined local var `type'. #32

Closed
spockz opened this issue Apr 16, 2012 · 3 comments
Closed

Routing error: undefined local var `type'. #32

spockz opened this issue Apr 16, 2012 · 3 comments

Comments

@spockz
Copy link

spockz commented Apr 16, 2012

The error in /api/wsdl:

ActionController::RoutingError (undefined local variable or method `type' for WashOut::Param:Class):
  app/controllers/api_controller.rb:8:in `<class:ApiController>'
  app/controllers/api_controller.rb:1:in `<top (required)>
BintraMongo::Application.routes.draw do
  # The priority is based upon order of creation:
  # first created -> highest priority.
  root :to => "home#index"

  wash_out :api

  match '/test', :to => 'foo#test'

  resources :users   
  devise_for :user

  match ':controller(/:action(/:id))'
end

The controller:

class ApiController < ApplicationController
  include WashOut::SOAP

  soap_action "authenticate",
              :args    => {:login => :string, :password => :string, :comment => :string},
              :return  => User
  def authenticate
    # find user by params[:login] and params[:password]
    puts params
  end
end

Versions (full list):

Using rails (3.2.0)
Using wasabi (2.1.0) 
Using savon (0.9.9)
Using wash_out (0.3.7) from git://github.com/roundlake/wash_out.git (at master)
@inossidabile
Copy link
Owner

This was a typo. Patched in master. However this typo was in the raise action. So this code won't work anyway.

  :return  => User

Here is the problem. You can not use your class as a type. You can only use Hashes or Arrays.

@spockz
Copy link
Author

spockz commented Apr 16, 2012

Would it be possible to construct the definition for this hash automatically? So suppose a User has the fields "username" and "emailaddress" the returntype would look like

:return => {:user => { :username => :string, :emailaddress => :string } }

This could probably be done, but I wonder whether there have been efforts in this direction already.

@inossidabile
Copy link
Owner

There are a lot of pros and cons. I'm not sure about it actually. We do have #21 issue with similar request. I'll take your proposal into account while working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants