top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

errors.on equilvalent on Rails 4

+1 vote
300 views
article.errors.on(:title)

does not works in Rails 4. What is equivalent on( ) method?

posted Sep 23, 2013 by Anderson

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

On was deprecated and removed in Rails 4... to address your issue now you simply do errors[:title] to pull your error. If you are looking for it to return true or false then you should do errors[:title].present? or you can use blank?

answer Sep 23, 2013 by Jai Prakash
Similar Questions
0 votes

I am getting certificate errors on the https:\rubygems.org web site using 2.1.5 Rails install environment objects.
Any ideas? This is Windows 7 VM machine installation.

+2 votes

I have a rails application, in which I am using delayed_job_active_record gem for running background jobs. While using the method .delay with an object, I am getting the following mysql error:

"INCORRECT STRING VALUE: \'XE2X9CX93"X0A ...\' FOR COLUMN \'HANDLER\' AT ROW 1"

I already searched for the above error and found that its because of the difference in encoding in mysql and rails. The solution suggested by many programmers is to alter the encoding in mysql database to utf8. But I also read that MySQL's utf8 charset only partially implements proper UTF-8 encoding. It can only store UTF-8-encoded symbols that consist of one to three bytes; encoded symbols that take up four bytes aren't supported. Which might cause trouble in some other cases. Also, when I tried to insert the value directly in mysql, it worked like a charm. Suggesting that the issue might lie elsewhere. So, can anyone please suggest the right method to rectify this problem?

Any help would be greatly appreciated.

0 votes

Is it is possible to share a Rails 4 session with a Rails 4.1 application with the same secret key base on the same domain name. This works with Rails 4 to Rails 4 but it appears that my cookies are being encrypted differently between the two versions.

Any suggestions?

...