ruby on rails - Failure in create.js file -
i had made create file in view in ruby on rails when trying create showing following error:
rendered issue_tracker_accesses/_form.html.erb (21.0ms) rendered issue_tracker_accesses/create.js.erb (24.9ms) completed 200 ok in 46ms (views: 33.1ms | activerecord: 2.6ms)
controller code:
def create @issue_tracker_access = issuetrackeraccess.new(issue_tracker_access_params) @issue_tracker_accesses = issuetrackeraccess.all respond_to |format| if @issue_tracker_access.save @issue_tracker_access = issuetrackeraccess.new format.js { @flag = true } else flash.now[:alert] = 'access exist.' format.js { @flag = false } end end end
you have write create method in controller
write creation logic in controller & render create.js.erb fields or data want display.
also, need set remote:true in form.
follow steps writen in example http://guides.rubyonrails.org/working_with_javascript_in_rails.html#a-simple-example
Comments
Post a Comment