Ruby on Rails Wednesday, February 19, 2014

On Wed, Feb 19, 2014 at 11:21 AM, Bob Kendall <lists@ruby-forum.com> wrote:
> am trying to refactor an app that I have inherited that was not coded
> using rails best practices. I am fairly new to rails and I am doing the
> tutorials and book thing, but I also need to keep making process on the
> project.

Uh, well. Not sure that's a good idea, but whatever. Does this app
have decent test coverage? If not (and I'd bet I know the answer)
then that might be a better place to spend time to start...

Anyway,

> I have a model that I have refactored:

> def email
> @weboe123 = WEBOEL23

The line above makes zero sense.

> WEBOEL23.where(ACT223: act223).first.email

> the error that it is returning is - NoMethodError (Undefined method
> 'email' for nil:NilClass): - does this mean that the email record is
> returning blank?

It means no records were found, so there's no 'first' to examine.

You might want to learn about using the console (irb, or better yet
pry) and trying out that line to see what it does, because I'd also bet
it's not what you're expecting :-)

Good luck,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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/CACmC4yDaLZV22XJqXoDTnpSVT4NLqR0gyhzqUtoho6khbEyzfw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment