Skip to content

Instantly share code, notes, and snippets.

@Frank004
Last active May 26, 2016 16:30
Show Gist options
  • Select an option

  • Save Frank004/d9821951346dab1b2472b40c9fe503ec to your computer and use it in GitHub Desktop.

Select an option

Save Frank004/d9821951346dab1b2472b40c9fe503ec to your computer and use it in GitHub Desktop.
ActionController::RoutingError (No route matches [POST] "/inspection_components/10622"):
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
12:02:44 log.1 | rack-contrib (1.4.0) lib/rack/contrib/response_headers.rb:17:in `call'
12:02:44 log.1 | meta_request (0.4.0) lib/meta_request/middlewares/headers.rb:16:in `call'
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
12:02:44 log.1 | railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
12:02:44 log.1 | railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
12:02:44 log.1 | activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
12:02:44 log.1 | activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
12:02:44 log.1 | activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
12:02:44 log.1 | railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
12:02:44 log.1 | quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
12:02:44 log.1 | rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
12:02:44 log.1 | rack (1.6.4) lib/rack/runtime.rb:18:in `call'
12:02:44 log.1 | activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
12:02:44 log.1 | rack (1.6.4) lib/rack/lock.rb:17:in `call'
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
12:02:44 log.1 | rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
12:02:44 log.1 | railties (4.2.5) lib/rails/engine.rb:518:in `call'
12:02:44 log.1 | railties (4.2.5) lib/rails/application.rb:165:in `call'
12:02:44 log.1 | puma (2.16.0) lib/puma/commonlogger.rb:31:in `call'
12:02:44 log.1 | puma (2.16.0) lib/puma/configuration.rb:81:in `call'
12:02:44 log.1 | puma (2.16.0) lib/puma/server.rb:557:in `handle_request'
12:02:44 log.1 | puma (2.16.0) lib/puma/server.rb:404:in `process_client'
12:02:44 log.1 | puma (2.16.0) lib/puma/server.rb:270:in `block in run'
12:02:44 log.1 | puma (2.16.0) lib/puma/thread_pool.rb:106:in `block in spawn_thread'
def create
@inspection_component = InspectionComponent.new(inspection_component_params)
respond_to do |format|
if @inspection_component.save
format.html { redirect_to action: 'index'}
format.json {
render :show,
status: :created, location: @inspection_component
}
format.js
flash[:notice] = 'Componente a sido creado con éxito.'
else
format.html { render :new }
format.json {
render json: @inspection_component.errors,
status: :unprocessable_entity
}
end
end
end
<%= bootstrap_form_for(inspection_component, remote: true, multipart: true) do |f| %>
<%= f.select(:score, score_values, { :class => "form-control",label:"Puntuación" }) %>
<%= f.text_area :comment, label:"Comentarios"%>
<%= f.file_field :photo, hide_label: true %>
<%= f.submit 'Guardar', class: "btn btn-success" %>
<%end%>
inspection_section_inspection_components GET /inspection_sections/:inspection_section_id/inspection_components(.:format) inspection_components#index
POST /inspection_sections/:inspection_section_id/inspection_components(.:format) inspection_components#create
new_inspection_section_inspection_component GET /inspection_sections/:inspection_section_id/inspection_components/new(.:format) inspection_components#new
edit_inspection_component GET /inspection_components/:id/edit(.:format) inspection_components#edit
inspection_component GET /inspection_components/:id(.:format) inspection_components#show
PATCH /inspection_components/:id(.:format) inspection_components#update
PUT /inspection_components/:id(.:format) inspection_components#update
DELETE /inspection_components/:id(.:format) inspection_components#destroy
def update
@path = @inspection_component
respond_to do |format|
InspectionComponent.transaction do
begin
@inspection_component.update(inspection_component_params)
score = 0
i = 0
@inspection_section.inspection_components.each do |component|
if component.score != nil
i+=1
score+=component.score
end
end
@inspection_section.update(overall_score: score.to_d/i)
format.html {
redirect_to @inspection_component,
notice: 'Componente de Inspección se ha actualizado correctamente.'
}
format.json { render :show, status: :ok, location: @inspection_component }
format.js { render :show, status: :ok, location: @inspection_component }
rescue ActiveRecord::StatementInvalid
format.html { render :edit }
format.json {
render json: @inspection_component.errors,
status: :unprocessable_entity
}
end
end
end
end
<% if remotipart_submitted? %>
alert('submitted via remotipart')
<% else %>
alert('submitted via native jquery-ujs')
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment