SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    object type and flash

    Hello buddies, I have a page that works with several models (type1, type2, type3) with STI. When I save a object I would like to have a feedback message on my flash.
    How can I catch the model type in order to show the name.
    For instance when I save a type1 object the message should be "type1 has been saved" and when I save a type2 object the message should be "type1 has been saved" .

    Something like

    Code:
    @type.save
    flash[:notice]=@type.name+"has been saved"
    Thanks
    Alla prossima ...

  2. #2
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I understand you correctly, you want to show the class name for the object?

    Code:
      flash[:notice] = "#{@type.class} has been saved"
    If you give someone a program,
    you will frustrate them for a day;
    if you teach them how to program,
    you will frustrate them for a lifetime.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •