Ruby on Rails Wednesday, March 2, 2011

Hi,

In order to trim my controllers down and keep the code in the correct
place, I am trying to refactor:

@user.travels.create(:name => ..., :date => ..., :ip => request....,
etc)

to:

@user.travels.register(params, request)


So my questions are:

1) is create() an instance method of Travel? I have doubts, since
Travel.create is a class method.

2) how to write my register method() so that it behaves like create()?


Thanks for your help.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment