2009/5/12 Jim Burgess <rails-mailing-l...@andreas-s.net>

>
> Hi,
> I have written a method to map three 'virtual' fields in my form to one
> 'proper' field in my model.
> It looks like this:
>
> class Class
>  def map_three_fields(var1, var2, var3)
>    string_val = "...do stuff..."
>   self.class_eval string_val
>  end
> end
>
> At the moment it is sitting at the top of my model, but the method is
> quite long and this looks a bit ugly / cluttered.


You could put it down the end of the model, it should be in the private
section anyway, presumably.
If it is that ugly/cluttered you could refactor it.
Colin


>
> Is there anywhere else I can put this code?
> And if so, will it work out of the box or do I need to add a "require"
> somewhere or alter any configuration files.
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to