我收到如下所示的错误:
TypeError (wrong argument type Module (expected Class)):
app/controllers/player_profiles_controller.rb:1:in `<top (required)>'
什么可能导致上面显示的错误?
我想通过在 SoapUI 中呈现 JSON 来测试结果。
这是错误
Started POST "/player_profiles/show" for 192.168.6.246 at 2012-11-02 10:14:15 +0700
TypeError (wrong argument type Module (expected Class)):
app/controllers/player_profiles_controller.rb:1:in `<top (required)>'
Rendered /home/gunarto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.e
rb (3.0ms)<br>
Rendered /home/gunarto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request
_and_response.erb (2.3ms)<br>
Rendered /home/gunarto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnost
ics.erb within rescues/layout (19.2ms)
player_profiles_controller.rb
class PlayerProfilesController < ActionController<br><br>
def register<br>
@player_profile = PlayerProfile.find(:first , :conditions => {:PlayerProfile => {:fullname => params[:fullname]}})<br>
if @player_profile == nil<br>
@player_profile = PlayerProfile.create(:fullname => params[:fullname], :nickname => params[:nickname],
:weight => params[:weight], :height => params[:height] ,
:bloodtype => params[:bloodtype], :teamname => params[:teamname],
:playerno => params[:playerno], :playerphoto => params[:playerphoto]) <br>
else<br>
@player_profile = PlayerProfile.find_by_sql("SELECT * FROM PlayerProfile WHERE fullname = '#{params[:fullname]}'")<br>
end<br>
render :json => {:result => @player_profile}<br>
end<br><br>
def show<br>
@player_profile = PlayerProfile.find_by_sql("SELECT * FROM PlayerProfile WHERE fullname= ? LIMIT 1 ",params[:fullname])<br>
render :json => {:result => @player_profile}<br>
end<br><br>
def delete<br>
@player_profile = PlayerProfile.destroy_all(:fullname => params[:fullname])<br>
render :json => {:result => @player_profile}<br>
end<br><br>
def update<br>
@player_profile = PlayerProfile.update_all(:fullname => params[:fullname], :nickname => params[:nickname],
:weight => params[:weight], :height => params[:height], :bloodtype => params[:bloodtype],
:teamname => params[:teamname], :playerno => params[:playerno] , :playerphoto => params[:playerphoto])<br>
head :ok , :content_type => 'application/json'<br>
end<br>
end
我在配置中的路线
post ':controller/:action' , :format => 'json'