Jump to content

The ultimate community for Ruby on Rails developers.


Photo

image_url:string


  • Please log in to reply
2 replies to this topic

#1 DvDj

DvDj

    Signalman

  • Members
  • 20 posts
  • LocationUnited Kingdom

Posted 01 July 2014 - 04:37 PM

If within a table i have the column 'image_url' and set its datatype as a string i can populate the field for it within the create form view with an images url.

 

Is there a way of populating this field with multiple url's? and if so how.



#2 Ohm

Ohm

    Driver

  • Moderators
  • 479 posts
  • LocationCopenhagen

Posted 01 July 2014 - 05:57 PM

If you want multiple things in one field, what you usually do is make the field serialisable (http://apidock.com/r...serialize/class)

 

This way, you can do

class User < ActiveRecord::Base
  serialize(:image_urls, Array)
end

and store multiple urls in the image_urls array.


Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk


#3 DvDj

DvDj

    Signalman

  • Members
  • 20 posts
  • LocationUnited Kingdom

Posted 04 July 2014 - 08:51 AM   Best Answer

Thanks Guard,

 

Your help is much appreciated.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users