ruby on rails - simple_form undefined method `model_name' for NilClass:Class -
I am learning to train, and I would like to use simple_form I am making a simple app (my first time) And I want to create a signup form. I used tracks G Scaffold User Username: String Password: String to make my model and Controller I am also using Foundation Ratna, if this is the case, and I establish simple_form with the right command for the foundation. I am looking for two hours' answers, I tried many things, I do not know what is wrong in my code.
##app / views / home / index.html.erb ## And for lieutenant;% = simple _ form_ user u | F | & Gt%; & Lt;% = f.input: Username% & gt; & Lt;% = f.input: Password% & gt; & Lt;% end% & gt; ## App / Model / UserRb ## Class User & lt; ActiveRecord :: Base End ## App / Controller / User_Controller RB Class User Controller & lt; ApplicationController before_action: set_user, only: [: show,: edit, update: deleted] #GET / user # GET /users.json DNF index @ user = user.All end #GET / user / 1 # GIT / users / 1. Jason Df Show End # GET / Users / New Diff New @ User = User New End # GIT / Users / 1 / End of Ed editing # POST / Users # Post / User Dies Make the def @ user = user.new (User_params) response_to do | Format | If @ user.save format.html {redirect_to @user, notice: 'User was created successfully.' } Format.json {Render Action: 'Show', Status :: created, Location: @ User} and Format. Html {Action: 'New'} format.json {Render Jason: @ User. Errors, Status :: Inappropriate} End & End # Patch / Pet / Users / 1 # Patch / Put / User / 1 JSN DIF Update Reply-To-Do | Format | If @ user.update (user_params) format.html {redirect_to @user, notice: 'User was successfully updated.' } Format.json {head: no_content} else format.html {render action: 'edit'} format.json {render json: @ user.errors, status :: unprocessable_entity} End & # DELETE / users / 1 # DELETE / User / 1.json Delete DF @ user.destroy Reply | Format | Format.html {redirect_to users_url} format.json {head: no_content} Use callback to share common setup or barriers between end-end personal # tasks def set_user @user = User.find (params [: id]) End # Scary Do not trust the criteria from the Internet; Allow only through white list
I'm clearly messing up something, and I'm pretty sure that I'm in a way Feel stupid, but this is my first app: / Thanks Edit: I forgot to say, I tried hard (every) user (@ user, @ user, user, user), none of them works: /
index.html. Get rid of the form from ARB View (and no, do not put it in show.html, either ARB!)
This form is new.html Place in ARB view:
<% = simple_form_foruser do | F | & Gt%; & Lt;% = f.input: Username% & gt; & Lt;% = f.input: Password% & gt; & Lt;% = f.submit% & gt; & Lt;% end% & gt;
Note that the form @ user @ user
Comments
Post a Comment