Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8185315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:48:17+00:00 2026-06-07T01:48:17+00:00

When the view pass the parameters to controller, controller gets nil for all of

  • 0

When the view pass the parameters to controller,
controller gets nil for all of the arguements somehow.

Can anyone how to fix this?? Thanks!

and I have no model called “Message”

controllers/messages_controller.rb

  def deliver

   recipient = User.find_by_username(params[:recipient])
   subject = params[:subject]
   body = params[:body]

   current_user.send_message(recipient, body, subject)
    redirect_to :controller => 'messages', :action => 'received' 
    flash[:notice] = "message sent!"

  end

views/messages/new.html.erb

<%=form_for :messages, url: url_for( :controller => :messages, :action => :deliver ) do |f| %>
    <div class="field">
      <%= f.label :subject %><br />
      <%= f.text_field :subject %>
    </div> 

    <div class="field">
      <%= f.label :body %><br />
      <%= f.text_field :body %>
    </div> 

  <div class="actions">
    <%= f.submit %>

<% end %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:48:18+00:00Added an answer on June 7, 2026 at 1:48 am

    Check your source HTML to better understand what FormHelpers do.

    With the form_for f.text_field will generate names attributes in the format:

    messages[subject]
    

    Consequently, your params will be in the format:

    params[:messages][:subject]
    

    You can also use <%= debug params %> to inspect what’s in params, it’s very helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I pass back a (binded) model from a view to a controller
I'm essentially having difficulty pass dynamic variables to a view. I have php functions
how do i pass a multi diminutional array to a view? controller code public
Possible Duplicate: pass data from Action To Another Action I have a view in
How can I pass a viewmodel to a view without the model's data showing
I have a List to pass to my view in ViewBag: public ActionResult ContactUs()
Suppose I pass a dictionary to my jinja2 template. In the view I have
I need to pass a url string from the view to the controller, a
I have an abstract base Controller class and all action controllers are derived from
I am trying to set blockUI message to display controller action view. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.