I might be missing something but it should be as simple as using the
name of the method:
''self.foobar'' or ''foobar'' should return
whatever the method returns.
On Oct 8, 1:54 am, Christian Fazzini
<christian.fazz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''ve got an artist form. In this form I''ve got attributes
that do not
> exist in the model that the form belongs to. However, I would like to
> submit these values for later processing.
>
> My virtual attributes in the form are:
>
> <%= f.label :foobar %>
> <%= f.text_field :foobar %>
>
> In the artist model, I created a getter:
>
> def foobar
> end
>
> When the form is submitted, I am able to access the value of the
> virtual attribute by doing, for example: puts params[:artist][:foobar]
> in the controller (in the create method):
>
> def create
> @artist = Artist.new(params[:artist])
>
> # return the value of the virtual attribute
> puts params[:artist][:foobar]
> ...
> end
>
> I would like to do the same thing in the model? How can foobar be
> accessed in the model? Or is this not possible?
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
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.