RailsCasts Pro episodes are now free!

Learn more or hide this

mohsam's Profile

GitHub User: mohsam

Comments by

Avatar

I m very new to ruby on rails, so can you help me.

I m getting the following error

ruby
NoMethodError in Users#new

undefined method `simple_form_for' for #<#<Class:0x5ae0f40>:0x463f218>

this is my new form

ruby
<%= simple_form_for @user do |f| %>
        
          <%= f.input :service_number %>
          <%= f.input :password %>
          <%= f.button :submit %>
          
<% end %>

this is my user controller

ruby
class UsersController < ApplicationController
  def index
    
  end
  
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      session[:user_id] = @user.id
      redirect_to root_url, notice: "Thank you for signing up!"
    else
      render "new"
    end
  end
  
end