Friday, January 10, 2014

Re: [Rails] Refactor question




On Fri, Jan 10, 2014 at 8:55 AM, Dave Castellano <lists@ruby-forum.com> wrote:
Hi,
The code below works perfectly but is so repetitive I feel there must be
a standard way to refactor it in this situation.  I am learning on my
own so am wondering how more experienced programmers would do this.  Any
examples would be appreciated.


def reset_to_previous
      contents_history = Profile.find(:first, conditions: [ "user_id =
?", current_user.id])

What version of Rails is this? Rails 2? Did Rails 3 use conditions? (It has been sooo lonnnggg)
 

--
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/CAHUC_t_R%2B9eZ_cXc%3D%2BYxNKxWuk-AnVxh32ubwu1MSDzcQMHRVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate