parameter
parameter

Reputation: 904

rails form input text is not saved, all fields are blank upon hitting submit

I have a rails scaffold Reviews with different fields (text input) like artist, date, venue, etc. On the form page, none of my input is being saved now after I just made a new controller/model for users. I'm able to create new users with emails and passwords using the form and they're saved, but when I try to create new reviews now, all the information is blank after I hit submit. What can be causing this? I didn't modify any of the code for the reviews controller or model after creating the users. There are now 2 migration files, one for reviews and one for users, but I didn't modify either. I did modify the application_controller.rb file to detect if a user is logged in but I don't think this would cause the issue?

I tried doing rake db:drop and rake db:create all and migrate again but the still issue occurs. Any help is appreciated, thank you.

when I hit submit this is the error I get:

> Started POST "/reviews" for 127.0.0.1 at 2014-03-30 04:50:13 -0400
Processing by ReviewsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"YzL5s5e+nT/2U3zoYtrmAT443qIn2fUMjx/MAmGoyTk=", "review"=>{"artist"=>"testArtist", "venue"=>"testVenue", "date"=>"3/30/2014", "genre"=>"Rock", "sound"=>"3", "stagePresence"=>"4", "songSelection"=>"5", "overallRating"=>"2", "comments"=>"testComment"}, "commit"=>"Create Review"}
WARNING: Can't mass-assign protected attributes for Review: artist, venue, date, genre, sound, stagePresence, songSelection, overallRating, comments
    app/controllers/reviews_controller.rb:27:in `create'
   (0.2ms)  BEGIN
  SQL (38.2ms)  INSERT INTO "reviews" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"  [["created_at", Sun, 30 Mar 2014 08:50:13 UTC +00:00], ["updated_at", Sun, 30 Mar 2014 08:50:13 UTC +00:00]]
   (8.4ms)  COMMIT
Redirected to localhost:3000/reviews/3

Upvotes: 0

Views: 638

Answers (1)

parameter
parameter

Reputation: 904

My issue is from having this gem "protected_attributes" that I was using for user authentication. I guess there's a new method of doing it, found here

Upvotes: 1

Related Questions