on click on submit it should go to update_settings method of dashboard_controller. on click i gets this error.How to solve this
Any help is appreciatable
undefined method
model_name' for 1:Fixnum`
i have my routes like this
namespace :generic_users do root to: 'dashboard#show' get 'settings', to: 'dashboard#settings' patch "settings" => "dashboard#update_settings", :as => "update_settings" end
my dashboardcontroller is like this
class GenericUsers::DashboardController<ApplicationController before_filter :authenticate_user! def settings @title='Generic Users Profile Management Page' @generic_user = current_user.specific.id end def update_settings @generic_user = GenericUsers.find(current_user.specific.id) if @generic_user.update_attributes(sign_up_params) redirect_to generic_users_root_path, flash: {notice: "Your details have been updated"} else render "new" end end private def sign_up_ end private def sign_up_params params.require(:generic_user).permit(:username,:mobile,:firstname,:lastname, :email,:image,:referred_by,:address) end end
in views/dashboard folder, view file called, settings.html.erb
<%= simple_form_for(@generic_user, :url => generic_users_update_settings_path) do |f| %>
<div class="form-inputs">
<%= f.input :username, required: true, autofocus: true %>
<%= f.input :firstname, required: true, autofocus: true %>
<%= f.input :lastname, required: true, autofocus: true %>
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :mobile, required: true, autofocus: true %>
<%= f.input :image, required: true, autofocus: true %>
<%= f.input :referred_by, required: true, autofocus: true %>
<%= f.label :address, "Address" %><br>
<%= f.text_area :address, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up" %>
</div>
<% end %>
also have a model generic_user.rb Please give me a solution to this error. i have no idea
Aucun commentaire:
Enregistrer un commentaire