Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Would this code change at all if User belonged to many Accounts? And Accounts would select whether they want to support a certain data_key, and the users in that account would have data_values on those data_keys Commented Sep 26, 2014 at 0:29
  • I am getting this error: "NoMethodError: undefined method `find_by_data_key' for #<User:0x00000109a7da00>" Commented Sep 26, 2014 at 4:30
  • @kibaekr, User model has has_many :accounts And find_by_data_key method is not for User object but it is for Account model. Commented Sep 26, 2014 at 5:08
  • Yes, so i modified your example a bit, to get it working without account first. this is what i did gist.github.com/kibaekr/3225f20dbcb0858a0558 Commented Sep 26, 2014 at 5:22
  • @kibaekr, data_key column is in accounts table and not in users table. Commented Sep 26, 2014 at 7:08