Saturday, October 5, 2013

[Rails] save attachments to database and Rails application public directory

I am new to ROR and learning it.I am using Rails 2.3.5. I have a form
where I can attach multiple files. I need to save these attachments in
my db and also in a directory in my application directory. I dont want
to use paperclip plugin as I need to learn File system as well as how to
create dir and save these attachments into it. So any
references/tutorials would be highly appreciated. Please help.
When I submit the form I get the params in the console as

Processing ReminderPluginController#create_reminder (for 127.0.0.1
at 2013-10-05 19:52:14) [POST]
Parameters: {"reminder"=>{"subject"=>"Hello", "email"=>"",
"body"=>"<p>My first thing</p>"},
"attachments"=>[#<File:/tmp/RackMultipart20131005-8107-o8osmj-0>,
#<File:/tmp/RackMultipart20131005-8107-1n1k7pz-0>],
"controller"=>"reminder_plugin", "select_batch"=>{"batch"=>"2"},
"recipients"=>"20", "select_department"=>{"department"=>""},
"commit"=>"Send",
"authenticity_token"=>"pKT8//ESD5SWvSuelVpOiHw3k30RxrqDOODckUToURs=",
"action"=>"create_reminder"}
But I have no idea about creating directory and saving attachments in
it..

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/190ae42b97ff756700ef0e7e2bac84e1%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate