Param is missing or the value is empty ROR

Ali Abbas Jaffri

Good Day, i am trying to update the rating of a user using form_for to populate the text_field of its current rating and then update it to user entered value. So far, its seems all simple but something doesn't seem well and i am getting this error. Help will be highly appreciated!

user controller:

def edit_rating
      @ad = Ad.find(params[:id])
      @user = User.find(@ad.user_id)

      if @user.update_attributes(user_params)
        flash[:notice] = "User Updated Successfully"
        redirect_to(:action => 'index')
      else
      end
    end

    def user_params
      params.require(:user).permit(:firstName, :lastName, :email , :password , :location, :rating)
    end

edit_rating view:

<h2>
    Edit User Rating
</h2>

<h4>
    Name: <%= @user.firstName %>
</h4>

<p>
    Current Rating: <%= @user.rating%>
</p>

<%=form_for(:user , :url => {:action => 'edit_rating' , :id => @user.id}) do |f| %>

    <p>
        Updated Rating: <%= f.text_field(:rating) %>
    </p>

    <%= submit_tag("Update Rating") %>
<% end%>

This is the error that i am getting.

enter image description here

mohamed-ibrahim

You can do the reverse not to permit you can only use the params you only want to use:

@user.update_attributes(rating: params[:user][:rating])

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ROR5: 'param is missing or the value is empty' error with adding Bookmarks

From Dev

param is missing or the value is empty

From Dev

param is missing or the value is empty?

From Dev

param is missing or the value is empty for:

From Dev

ParameterMissing param is missing or the value is empty

From Dev

param is missing or the value is empty for: quotes

From Dev

param is missing or the value is empty error

From Dev

param is missing or the value is empty: user

From Dev

Param is missing or the value is empty for: contact

From Dev

param is missing or the value is empty: center

From Dev

param is missing or the value is empty on creation

From Dev

param is missing or the value is empty: comment

From Dev

param is missing or the value is empty: breads

From Dev

param is missing or the value is empty: conversation

From Dev

param is missing or the value is empty: sale

From Dev

Rails 4.0 param is missing or the value is empty

From Dev

ActionController::ParameterMissing (param is missing or the value is empty: film):

From Dev

Test is returning param missing or value empty

From Dev

Rails: param is missing or the value is empty: article

From Dev

ActionController::ParameterMissing (param is missing or the value is empty: bid)

From Dev

Rails - param is missing or the value is empty: measure

From Dev

ActionController::ParameterMissing param is missing or the value is empty

From Dev

param is missing or the value is empty - Rails 4 Engine

From Dev

Rails: ActionController::ParameterMissing param is missing or the value is empty:

From Dev

param is missing or the value is empty: module_list

From Dev

rails error - param is missing or the value is empty: buyer

From Dev

Validation not working - param is missing or the value is empty carrierwave

From Dev

rails param is missing or the value is empty: post

From Dev

ActionController::ParameterMissing (param is missing or the value is empty: bid)

Related Related

  1. 1

    ROR5: 'param is missing or the value is empty' error with adding Bookmarks

  2. 2

    param is missing or the value is empty

  3. 3

    param is missing or the value is empty?

  4. 4

    param is missing or the value is empty for:

  5. 5

    ParameterMissing param is missing or the value is empty

  6. 6

    param is missing or the value is empty for: quotes

  7. 7

    param is missing or the value is empty error

  8. 8

    param is missing or the value is empty: user

  9. 9

    Param is missing or the value is empty for: contact

  10. 10

    param is missing or the value is empty: center

  11. 11

    param is missing or the value is empty on creation

  12. 12

    param is missing or the value is empty: comment

  13. 13

    param is missing or the value is empty: breads

  14. 14

    param is missing or the value is empty: conversation

  15. 15

    param is missing or the value is empty: sale

  16. 16

    Rails 4.0 param is missing or the value is empty

  17. 17

    ActionController::ParameterMissing (param is missing or the value is empty: film):

  18. 18

    Test is returning param missing or value empty

  19. 19

    Rails: param is missing or the value is empty: article

  20. 20

    ActionController::ParameterMissing (param is missing or the value is empty: bid)

  21. 21

    Rails - param is missing or the value is empty: measure

  22. 22

    ActionController::ParameterMissing param is missing or the value is empty

  23. 23

    param is missing or the value is empty - Rails 4 Engine

  24. 24

    Rails: ActionController::ParameterMissing param is missing or the value is empty:

  25. 25

    param is missing or the value is empty: module_list

  26. 26

    rails error - param is missing or the value is empty: buyer

  27. 27

    Validation not working - param is missing or the value is empty carrierwave

  28. 28

    rails param is missing or the value is empty: post

  29. 29

    ActionController::ParameterMissing (param is missing or the value is empty: bid)

HotTag

Archive