ruby - undefined method `model_name' with simple_form on Rails 5 -
i'm getting undefined method 'model_name'
error simple_form when want edit basic post on rails 5.
show.html.haml:
= link_to "edit", edit_post_path(@post)
edit.html.haml:
= simple_form_for @post |f| = f.input :title = f.input :link = f.input :description = f.button :submit
posts_controller.rb:
def show @post = post.find(params[:id]) end def edit end def update if @post.update(post_params) redirect_to @post else render 'edit' end end
any idea?
def edit @post = post.find(params[:id]) # <========= end
Comments
Post a Comment