Hello! I am learning RoR and have started a small project to help me learn it, I have a question, as Rails tries its best to be DRY… I have a User model in the database that looks like this:
create_table "users", force: :cascade do |t| t.string "first_name" t.string "last_name" t.string "phone_number" t.integer "tokens" t.string "relation" t.boolean "verified" t.boolean "deleted" t.integer "available_loan" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "admin" t.string "password" end
I want to create 3 pages that uses this model, login, that only requires the users email and password, signup, which will require first_name, last_name, email, password, phone_number and relation, and finally an edit user page that needs all that. The most important here is the login and signup, in my routes I have:
get “/signup”, to: “users#new”
post “/signup”, to: “users#create”
Which are to sign up, now how do I separate login and signup here? I assume in the .html.erb file I will need to check the page route, and if it is login to only display some of the form, and if signup to display more of it? This feels wrong… Is it?
Also! Any tips and tricks and advice you can give me as a newbie to Ruby would be awesome!
Thank you in advance!