How to modify dryml tags for child data.

20 views
Skip to first unread message

Donald Ziesig

unread,
Jan 6, 2017, 11:01:40 AM1/6/17
to Hobo Users

Hi All!

It has been a while since I did this (and hobo has changed significantly in the interim), so my memory is fading (happens when you reach 74 ;-) ).

I have a model Attachments that belongs to model Email such that:

model Attachments:

  fields do

    filename : string;
    contents : binary;
    datatype : string;

  end

  belongs_to :email

controller Attachment:

  auto_actions_for :email, [ :index, :new, :create ]

  def index_for_email
    * * *
    hobo_index_for_email #????????? Is this right?
  end

# etc. for new, create

model Email:

  has_many :attachments, :accessible=>true, :dependent => :destroy

  children :attachments # <<< Doesn't seem to change anything whether present or not

The new and edit actions for Email show a list of Attachments as expected (a series of text and textarea fields), but I really want to change the underlying dryml so that it uses

  <input ... type="file">

(the results of which will populate the fields of the attachment record) instead of the series of input fields for filename, content and datatype.

Here is where my memory fails me.  What dryml tags (auto generated?) apply to the index_for_email, new_for_email, create_for_email methods?  When are these methods called (so far my log code doesn't show any sign of invocation)?  I have looked through all of the hobo documentation without finding the answers.

I can do the upload using my own file input tags from the Attachment pages themselves, but I don't want those exposed to the users (for test purposes I must manually enter the index of the associated email).  All of the rest of the app works fine using the data from the Attachment pages.  i.e., emails are sent with the specified attachments and received by the recipients with valid files.  All I need is the appropriate user interface to finish this part of the project.

I would really like the list shown by index to be series of attachment file names with the ability to edit and a "+" button to add or a "-" button to delete.   The file name field would use html <input  ... type="file"...>

Thanks,

Don Ziesig

kevinpfromnm

unread,
Jun 30, 2017, 7:30:01 PM6/30/17
to Hobo Users
You didn't want to use paperclip and paperclip_for_hobo?
Reply all
Reply to author
Forward
0 new messages