In the edit function, I am fetching the object that will be edited. Unfortunately I have been getting this weird error that I can' understand its cause so far.
NoMethodError in Tasks#edit
undefined methodmodel_name' for #Hash:0x007fe92d2afeb8 at line#1 in _form.html.erb
tasks_controller:
def edit
uri = URI.parse("http://localhost/tasks/public/api/tasks/"+params[:id])
response = Net::HTTP.get_response(uri)
@task = JSON.parse(response.body)['task']
end
_form.html.erb
<%= simple_form_for(@task) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>