{"action":"created","issue":{"url":"https://api.github.com/repos/makandra/active_type/issues/32","labels_url":"https://api.github.com/repos/makandra/active_type/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/makandra/active_type/issues/32/comments","events_url":"https://api.github.com/repos/makandra/active_type/issues/32/events","html_url":"https://github.com/makandra/active_type/issues/32","id":57334169,"number":32,"title":"time_select does not work with :datetime-attributes","user":{"login":"fschwahn","id":57876,"avatar_url":"https://avatars.githubusercontent.com/u/57876?v=3","gravatar_id":"","url":"https://api.github.com/users/fschwahn","html_url":"https://github.com/fschwahn","followers_url":"https://api.github.com/users/fschwahn/followers","following_url":"https://api.github.com/users/fschwahn/following{/other_user}","gists_url":"https://api.github.com/users/fschwahn/gists{/gist_id}","starred_url":"https://api.github.com/users/fschwahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fschwahn/subscriptions","organizations_url":"https://api.github.com/users/fschwahn/orgs","repos_url":"https://api.github.com/users/fschwahn/repos","events_url":"https://api.github.com/users/fschwahn/events{/privacy}","received_events_url":"https://api.github.com/users/fschwahn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-11T15:53:33Z","updated_at":"2015-02-11T17:53:19Z","closed_at":null,"body":"Hi,\r\nI have an issue where `time_select` does not work with `:datetime`-attributes. When passing the params to the initializer (such as `{\"start_time(1i)\"=>\"2015\", \"start_time(2i)\"=>\"2\", \"start_time(3i)\"=>\"11\", \"start_time(4i)\"=>\"16\", ....`), rails returns a `ActiveRecord::MultiparameterAssignmentErrors`-exception.\r\n\r\nThis one just masks another exception, which is triggered here: https://github.com/rails/rails/blob/3-2-stable/activerecord/lib/active_record/attribute_assignment.rb#L149\r\n\r\nThe expression `(self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name))` evaluates to nil, which blows up when `klass` is called on it.\r\n\r\nI'm on rails 3.2.21 and active_type 0.3.3. Any idea?\r\n\r\nAll the best,\r\nFabian"},"comment":{"url":"https://api.github.com/repos/makandra/active_type/issues/comments/73928807","html_url":"https://github.com/makandra/active_type/issues/32#issuecomment-73928807","issue_url":"https://api.github.com/repos/makandra/active_type/issues/32","id":73928807,"user":{"login":"fschwahn","id":57876,"avatar_url":"https://avatars.githubusercontent.com/u/57876?v=3","gravatar_id":"","url":"https://api.github.com/users/fschwahn","html_url":"https://github.com/fschwahn","followers_url":"https://api.github.com/users/fschwahn/followers","following_url":"https://api.github.com/users/fschwahn/following{/other_user}","gists_url":"https://api.github.com/users/fschwahn/gists{/gist_id}","starred_url":"https://api.github.com/users/fschwahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fschwahn/subscriptions","organizations_url":"https://api.github.com/users/fschwahn/orgs","repos_url":"https://api.github.com/users/fschwahn/repos","events_url":"https://api.github.com/users/fschwahn/events{/privacy}","received_events_url":"https://api.github.com/users/fschwahn/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T17:53:19Z","updated_at":"2015-02-11T17:53:19Z","body":"Yes, I was sure that this would just work without any special code because of your approach. I looked quickly at the rails source, and `column_for_attribute` just looks at the class attribute `columns_hash` and returns the klass defined for it. So adding the following to my class made it work:\r\n\r\n```ruby\r\nself.columns_hash['start_time'] = OpenStruct.new(klass: Time)\r\n```\r\n\r\nI'm not deep in ActiveRecord, so I don't know what other implications that may have, but if there are no side effects it may make sense to populate the `columns_hash` when attributes are defined."}}