On 09-Oct-2013, at 4:17 PM, Ryan Bigg <[email protected]> wrote:
> link_to "posts", [student.becomes(User), :posts]
:-( I don't find this very Object Oriented. It actually builds a User Object,
so methods on Student will not work.
Also it's bound to be forgotten
form_for professor.becomes(User) do |f|
f.text_field :name # Oh, I forgot that I had defaulted name to "Prof." in the
Professor class.
end
The way I've handled this in the past is to do a
class Student
def self.model_name
ActiveModel::Name.new(User) # or superclass.model_name if you are feeling
clever
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.