Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't Cast Hash to Date" when trying .update #47

Open
wolfkarl opened this issue Oct 19, 2015 · 0 comments
Open

"Can't Cast Hash to Date" when trying .update #47

wolfkarl opened this issue Oct 19, 2015 · 0 comments

Comments

@wolfkarl
Copy link

It seems that I can't update date fields in the parent class:

if @contract.update(contract_params) ...

gets me

*TypeError in ContractsController#update_contract *
can't cast Hash to date

StackTrace:

activerecord (4.2.4) lib/active_record/connection_adapters/abstract/quoting.rb:34:in `rescue in type_cast'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/quoting.rb:23:in `type_cast'
activerecord (4.2.4) lib/active_record/connection_adapters/sqlite3_adapter.rb:290:in `block in exec_query'
activerecord (4.2.4) lib/active_record/connection_adapters/sqlite3_adapter.rb:289:in `map'
activerecord (4.2.4) lib/active_record/connection_adapters/sqlite3_adapter.rb:289:in `exec_query'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/database_statements.rb:76:in `exec_insert'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
activerecord (4.2.4) lib/active_record/relation.rb:64:in `insert'
activerecord (4.2.4) lib/active_record/persistence.rb:524:in `_create_record'
...

Things work fine if I

  • use the same code but only change things for the parent element itsself
  • don't try to update the date (e.g. by removing it from permitted parameters)

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant