Last active
July 27, 2016 02:53
-
-
Save malgorath/1dcb5f245e245b19b0be00f6b280b3b4 to your computer and use it in GitHub Desktop.
ActiveRecord::AssociationTypeMismatch in TaskListsController#create ProcessStepsCategory(#47262720562860) expected, got String(#47262609621080)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= labelled_tabular_form_for @task_list, :url => submit_url do |f| %> | |
<% if @task_list.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@task_list.errors.count, "error") %> prohibited this task_list from being saved:</h2> | |
<ul> | |
<% @task_list.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> | |
<div class="form--field"> | |
<%= f.text_field :title, required: true, tabindex: 1 %> | |
</div> | |
<div class="form--field"> | |
<%= f.text_area :description, rows: (@task_list.description.blank? ? 10 : [[10, @task_list.description.length / 50].max, 100].min), cols: 60, tabindex: 2 %> | |
</div> | |
<div class="form--field"> | |
<%= f.text_field :revision, tabindex: 3 %> | |
</div> | |
<% if @task_list.process_steps_category.nil? %> | |
<%= f.hidden_field :process_steps_category, value: params[:process_steps_category_id] %> | |
<% else %> | |
<%= f.hidden_field :process_steps_category %> | |
<% end %> | |
<%= wikitoolbar_for 'task_list_description' %> | |
<div class="generic-table--action-buttons"> | |
<%= f.submit class: 'button -alt-highlight -with-icon icon-context icon-add' %> | |
</div> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::AssociationTypeMismatch in TaskListsController#create | |
ProcessStepsCategory(#47262720562860) expected, got String(#47262609621080) | |
Extracted source (around line #47): | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
def call(env) | |
reset_current_user! | |
app.call env | |
end | |
def reset_current_user! | |
Rails.root: /home/ssanders/RubyOnRails/openproject/src | |
Application Trace | Framework Trace | Full Trace | |
activerecord (4.2.6) lib/active_record/associations/association.rb:218:in `raise_on_type_mismatch!' | |
activerecord (4.2.6) lib/active_record/associations/belongs_to_association.rb:12:in `replace' | |
activerecord (4.2.6) lib/active_record/associations/singular_association.rb:17:in `writer' | |
activerecord (4.2.6) lib/active_record/associations/builder/association.rb:123:in `process_steps_category=' | |
activerecord (4.2.6) lib/active_record/attribute_assignment.rb:54:in `public_send' | |
activerecord (4.2.6) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute' | |
activerecord (4.2.6) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes' | |
actionpack (4.2.6) lib/action_controller/metal/strong_parameters.rb:185:in `each_pair' | |
actionpack (4.2.6) lib/action_controller/metal/strong_parameters.rb:185:in `each_pair' | |
activerecord (4.2.6) lib/active_record/attribute_assignment.rb:35:in `assign_attributes' | |
activerecord (4.2.6) lib/active_record/core.rb:566:in `init_attributes' | |
activerecord (4.2.6) lib/active_record/core.rb:281:in `initialize' | |
activerecord (4.2.6) lib/active_record/inheritance.rb:61:in `new' | |
activerecord (4.2.6) lib/active_record/inheritance.rb:61:in `new' | |
/home/ssanders/RubyOnRails/openproject/plugins/openproject-ProcessSteps/app/controllers/task_lists_controller.rb:73:in `create' | |
actionpack (4.2.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action' | |
actionpack (4.2.6) lib/abstract_controller/base.rb:198:in `process_action' | |
actionpack (4.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action' | |
actionpack (4.2.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:117:in `call' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:505:in `call' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:92:in `__run_callbacks__' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
actionpack (4.2.6) lib/abstract_controller/callbacks.rb:19:in `process_action' | |
actionpack (4.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action' | |
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | |
activesupport (4.2.6) lib/active_support/notifications.rb:164:in `block in instrument' | |
activesupport (4.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument' | |
activesupport (4.2.6) lib/active_support/notifications.rb:164:in `instrument' | |
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action' | |
actionpack (4.2.6) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' | |
activerecord (4.2.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action' | |
actionpack (4.2.6) lib/abstract_controller/base.rb:137:in `process' | |
actionview (4.2.6) lib/action_view/rendering.rb:30:in `process' | |
actionpack (4.2.6) lib/action_controller/metal.rb:196:in `dispatch' | |
actionpack (4.2.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' | |
actionpack (4.2.6) lib/action_controller/metal.rb:237:in `block in action' | |
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:74:in `dispatch' | |
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:43:in `serve' | |
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:43:in `block in serve' | |
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `each' | |
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `serve' | |
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:817:in `call' | |
/home/ssanders/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/omniauth-8385bc0da47e/lib/omniauth/strategy.rb:186:in `call!' | |
/home/ssanders/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/omniauth-8385bc0da47e/lib/omniauth/strategy.rb:164:in `call' | |
/home/ssanders/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/omniauth-8385bc0da47e/lib/omniauth/builder.rb:63:in `call' | |
i18n-js (3.0.0.rc13) lib/i18n/js/middleware.rb:12:in `call' | |
app/middleware/reset_current_user.rb:47:in `call' | |
rack-attack (4.4.1) lib/rack/attack.rb:107:in `call' | |
rack (1.6.4) lib/rack/etag.rb:24:in `call' | |
rack (1.6.4) lib/rack/deflater.rb:35:in `call' | |
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call' | |
rack (1.6.4) lib/rack/head.rb:13:in `call' | |
actionpack-xml_parser (1.0.2) lib/action_dispatch/xml_params_parser.rb:16:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call' | |
app/middleware/params_parser_with_exclusion.rb:40:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/flash.rb:260:in `call' | |
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context' | |
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/cookies.rb:560:in `call' | |
activerecord (4.2.6) lib/active_record/query_cache.rb:36:in `call' | |
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' | |
activerecord (4.2.6) lib/active_record/migration.rb:377:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:88:in `__run_callbacks__' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_call_callbacks' | |
activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/reloader.rb:73:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' | |
railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app' | |
railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call' | |
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' | |
activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged' | |
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged' | |
railties (4.2.6) lib/rails/rack/logger.rb:20:in `call' | |
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets' | |
request_store (1.3.0) lib/request_store/middleware.rb:9:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' | |
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call' | |
rack (1.6.4) lib/rack/runtime.rb:18:in `call' | |
activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' | |
rack (1.6.4) lib/rack/lock.rb:17:in `call' | |
actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call' | |
rack (1.6.4) lib/rack/sendfile.rb:113:in `call' | |
railties (4.2.6) lib/rails/engine.rb:518:in `call' | |
railties (4.2.6) lib/rails/application.rb:165:in `call' | |
railties (4.2.6) lib/rails/railtie.rb:194:in `public_send' | |
railties (4.2.6) lib/rails/railtie.rb:194:in `method_missing' | |
/home/ssanders/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/rack-protection-5a7d1bd2f05c/lib/rack/protection/frame_options.rb:31:in `call' | |
/home/ssanders/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/rack-protection-5a7d1bd2f05c/lib/rack/protection/json_csrf.rb:18:in `call' | |
rack (1.6.4) lib/rack/urlmap.rb:66:in `block in call' | |
rack (1.6.4) lib/rack/urlmap.rb:50:in `each' | |
rack (1.6.4) lib/rack/urlmap.rb:50:in `call' | |
rack (1.6.4) lib/rack/content_length.rb:15:in `call' | |
thin (1.7.0) lib/thin/connection.rb:86:in `block in pre_process' | |
thin (1.7.0) lib/thin/connection.rb:84:in `catch' | |
thin (1.7.0) lib/thin/connection.rb:84:in `pre_process' | |
thin (1.7.0) lib/thin/connection.rb:53:in `process' | |
thin (1.7.0) lib/thin/connection.rb:39:in `receive_data' | |
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run_machine' | |
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run' | |
thin (1.7.0) lib/thin/backends/base.rb:73:in `start' | |
thin (1.7.0) lib/thin/server.rb:162:in `start' | |
rack (1.6.4) lib/rack/handler/thin.rb:19:in `run' | |
rack (1.6.4) lib/rack/server.rb:286:in `start' | |
railties (4.2.6) lib/rails/commands/server.rb:80:in `start' | |
railties (4.2.6) lib/rails/commands/commands_tasks.rb:80:in `block in server' | |
railties (4.2.6) lib/rails/commands/commands_tasks.rb:75:in `tap' | |
railties (4.2.6) lib/rails/commands/commands_tasks.rb:75:in `server' | |
railties (4.2.6) lib/rails/commands/commands_tasks.rb:39:in `run_command!' | |
railties (4.2.6) lib/rails/commands.rb:17:in `<top (required)>' | |
bin/rails:4:in `require' | |
bin/rails:4:in `<main>' | |
Request | |
Parameters: | |
{"utf8"=>"✓", | |
"authenticity_token"=>"zX37i47tyyNwxOMPrL4f6xEUUMlhuMZ+S362oewQZKXxnFXV7j/M9wxeFPIIm/HkDWgDAI6BsvK897MEwy+OMA==", | |
"task_list"=>{"title"=>"This is Test List #1334324234asdfadsf", | |
"description"=>"*asdfasdf*", | |
"revision"=>"1", | |
"process_steps_category"=>"1"}, | |
"commit"=>"Create Task list", | |
"id"=>"1", | |
"process_steps_category_id"=>"1"} | |
Toggle session dump | |
Toggle env dump | |
Response | |
Headers: | |
None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% html_title(t('New Task List')) %> | |
<%= toolbar title: t('New Task List') do %> | |
<%= link_to ' Back', { :controller => 'task_lists', :action => 'index', :id => @project.id}, :class => 'info button --with-icon -icon-content icon-home ' %> | |
<% end %> | |
<%= render partial: 'form', | |
locals: { | |
task_list: @task_list, | |
submit_url: projects_process_steps_category_task_lists_path | |
} %> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
# TaskList Main Controller for all Process Lists | |
class TaskListsController < ApplicationController | |
menu_item :work_packages | |
before_filter :find_project | |
before_filter :set_process_steps_category | |
before_action :set_task_list, only: [:show, | |
:edit, | |
:destroy, | |
:update, | |
:clone_me, | |
:clone_task_list] | |
def index | |
@task_lists = TaskList.where('process_steps_category = ?', params[:process_steps_category_id]) | |
@glist = ProcessListGroup.all | |
end | |
# GET /task_lists/1 | |
def show | |
end | |
def clone_me | |
new_task_list = @task_list.deep_clone(include: :todo_lists) | |
if @task_list.revision.nil? | |
v = 0 | |
else | |
v = @task_list.revision.to_i | |
end | |
new_task_list.revision = v + 1 | |
new_task_list.save | |
redirect_to projects_task_lists_path, notice: 'Item was cloned' | |
end | |
def clone_list | |
@task_lists = TaskList.all | |
end | |
def clone_task_list | |
new_task_list = @task_list.deep_clone(include: :todo_lists) | |
new_task_list.project = @project | |
new_task_list.save | |
redirect_to projects_task_lists_path, notice: 'Task List cloned' | |
end | |
def moveup | |
todolist = TodoList.where(id: params[:todo_list_id]).first | |
todolist.position = todolist.position.to_i - 1 | |
todolist.save | |
redirect_to projects_task_lists_path, notice: 'Item Moved Up' | |
end | |
def movedown | |
todolist = TodoList.where(id: params[:todo_list_id]).first | |
todolist.position = todolist.position.to_i + 1 | |
todolist.save | |
redirect_to projects_task_lists_path, notice: 'Item Moved down' | |
end | |
# GET /task_lists/new | |
def new | |
@task_list = TaskList.new | |
end | |
# GET /task_lists/1/edit | |
def edit | |
end | |
# POST /task_lists | |
def create | |
@task_list = TaskList.new(task_list_params) | |
@task_list.user_id = User.current.id | |
msg = if @task_list.save | |
'Task list was successfully created.' | |
else | |
'Task list was <b>NOT</b> successfully created.' | |
end | |
redirect_to projects_process_steps_category_task_lists_path, notice: msg | |
end | |
# PATCH/PUT /task_lists/1 | |
def update | |
if @task_list.update(task_list_params) | |
redirect_to projects_task_lists_path, | |
notice: 'Task list was successfully updated.' | |
else | |
render :edit | |
end | |
end | |
# DELETE /task_lists/1 | |
def destroy | |
@task_list.destroy | |
redirect_to projects_task_lists_path, | |
notice: 'Task list was successfully destroyed.' | |
end | |
private | |
def set_task_list | |
if !params[:tlid].blank? | |
@task_list = TaskList.find(params[:tlid]) | |
elsif !params[:task_list_id].blank? | |
@task_list = TaskList.find(params[:task_list_id]) | |
end | |
end | |
# Only allow a trusted parameter "white list" through. | |
def task_list_params | |
params.require(:task_list).permit( | |
:title, | |
:description, | |
:user_id, | |
:process_steps_category, | |
:revision | |
) | |
end | |
def set_process_steps_category | |
@process_steps_category = ProcessStepsCategory.where('id = ?', params[:process_steps_category_id]) | |
end | |
def helpers | |
ActionController::Base.helpers | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment