Ruby on Rails: using method name 'request' in controller fails -


I am completely harmed by what I am doing wrong with the following code. I am trying to implement a messaging system in my application, but it should handle different types of messages. In this case, I want to make a "request" message of '' message_type => 1 ''

Instead of using forms, I want to click this example at that moment on the link. I am Here's how I set it up for the "user" in the show error file:

  & lt;% = link_to "Send friend request" ,: action => "Request",: Controller => "Message" ,: ID = & gt; @ User.id%>  

and in the administrator:

  DIF request @message = Message.new (: sender_id => current_user.id ,: user_id = & gt; Parameter [: id],: message_type => 1) if @ message.save flash [: notice] = 'The message was created successfully.' Redirect_to message_path (@message) other redirect_to message_path (@message) ending  

This results in the following error message: Undefined method 'Rewrite' for zero: NilClass Looks like `method_mission 'in

  c: /ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb: 52: C: /ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb: 634: `url_for '(in eval): 16: in' message_path 'app / controller / message_controller .rb: 11: In 'request'  

I used map.resources: In Routes. The Rb file is appropriate, and: has_many and: associate and message in the user's model.

EDIT: Something else to note is that successful after saving, because once the root address is manually entered in the address bar, the "flash" notice is shown that saved I went. Using the development console is actually there, so there is a mess with some redirects.

To change the name of the action you want, I'm pretty sure that requests means something in the controller.

You request to

then

In the administrator

  def create @message = Message.new (: sender_id => current_user.id ,: user_id = & gt; Params [ : Id],: message_type => 1) if @ message.save flash [: notice] = 'The message was created successfully.' Redirect_to message_path (@message) other redirect_to message_path (@message) end and  

Comments