Please help me work out this error, regarding the use of a HTTPService to connect Flex4 & Ruby on Ra
- by ben
I have a HTTPService in Flash Builder 4, that is defined as follows:
<s:HTTPService id="getUserDetails" url="http://localhost:3000/users/getDetails" method="GET"/>
It gets called as follows:
getUserDetails.send({'user[username]': calleeInput.text});
Here is a screenshot of the network monitor, showing that the parameter is being sent correctly (it is 'kirsty'):
Here is the Ruby on Rails method that it's connected to:
def getDetails
@user = User.find_by_username(:username)
render :xml => @user
end
When I run it, I get the following error output in the console:
Processing UsersController#list (for
127.0.0.1 at 2010-04-30 17:48:03) [GET] User Load (1.1ms) SELECT *
FROM "users" Completed in 30ms (View:
16, DB: 1) | 200 OK
[http://localhost/users/list]
Processing UsersController#getDetails
(for 127.0.0.1 at 2010-04-30 17:48:13)
[GET] Parameters:
{"user"={"username"="kirsty"}}
User Load (0.3ms) SELECT * FROM
"users" WHERE ("users"."username" =
'--- :username ') LIMIT 1
ActionView::MissingTemplate (Missing
template users/getDetails.erb in view
path app/views):
app/controllers/users_controller.rb:36:in
getDetails'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in
service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in
run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in
start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in
start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in
start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in
start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in
each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in
start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in
start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in
`start'
Rendering rescues/layout
(internal_server_error)
I'm not sure if the error is being caused by bad code in the getDetails Ruby on Rails method? I'm new to RoR, and I think I remember reading somewhere that every method should have a view. I'm just using this method to get info into the Flex 4 app, do I still need to make a view for it? Is that what's causing the error? Any help would be GREATLY appreciated, I've been stuck on this for a few days now! Thanks.