Missing template admin/citizens/create, admin/application/create, application/create with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :haml, :jbuilder, :rabl]}. Searched in: * “/Users/aa/Sites/Active Shehri/activeshehri-mongo/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/wiselinks-1.2.1/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/rails_admin-0.6.6/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/kaminari-0.16.1/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/devise_invitable-1.5.5/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/twitter-bootstrap-rails-3.2.2/app/views” * “/Users/aa/.rvm/gems/ruby-2.2.2@activeshehri/gems/devise-3.4.1/app/views”
…..here is the code
= form_for [:admin, @user] do |f|
.row
.col-lg-6
.panel
.panel-heading Edit Landmark
.panel-body
.form-group
= f.label :first_name
= f.text_field :first_name, class: 'form-control'
.form-group
= f.label :last_name
= f.text_field :last_name, class: 'form-control'
.form-group
= f.label :email
= f.text_field :email, class: 'form-control'
.form-group
= f.label :gender
= f.text_field :gender, :class => 'form-control'
.form-group
= f.label :contact_no
= f.text_field :contact_no, :class => 'form-control'
.form-group
= f.label :address
= f.text_field :address, class: 'form-control'
= f.submit 'Save', class: 'btn btn-primary btn-submit btn-lg pull-right'
= link_to "Back", admin_home_user_panel_path, class: 'btn btn-primary btn-submit btn-lg pull-left'
2
Answers
The error is because you don’t have a file called
create.html.erb
in yourviews/admin/citizens
folder.In Rails, if you don’t tell it to redirect or render a specific template at the end of a Controller method, it infers a template to render instead, so:
If the create method is run here, a user will be created and then Rails will try to render the template
views/users/create.html.erb
. Typically, you will not have a template with that name – you would probably do something like:Or:
It’s all here:
http://guides.rubyonrails.org/v2.3.11/action_controller_overview.html#methods-and-actions
I think you need to add else part to handle when user is not saved