Ruby on Rails Monday, May 26, 2014

Walter Davis wrote in post #1147113:
> ActiveRecord already has a finder that can do all this in one line:
> Assuming that's the only thing needed to create or find an existing
> Dict, you should be all good there.

No, it should not create one. If there is no suitable record, I want to
display an error message to the user. Hence, find_or_create isn't
suitable for me.

BTW, I also tried

Dict.find(:dictname => dict_name)

but this too complained that there is a hash, which can't be converted
to an integer.

Ronald

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/27a85af7e65236ed0636ef2941572b0a%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment