I am learning ruby on rails (Version 4.2). I am working on spree making a web commerce. I have to make a Inspiration page which will contain description(globalize system), a video link, published_on and multiple images. I don't go to use paperclip/carrierwave gem or other gem.
I want to use spree product image uploading system. I have made a Inspiration Model and Inspiration_images model.
Inspiration.rb
class Inspiration < ActiveRecord::Base
validates :video_link, presence: true # validation for video attributes
# attributes for description field with globalize
translates :description
globalize_accessors locales: [:en, :de, :fr], attributes: [:description]
# iamges
has_many :images, -> { order(:position) }, as: :viewable, dependent: :destroy, class_name: "Spree::Image"
# scopes for inspiration
scope :publishable, -> { where('published_on <= ?', Time.zone.today) }
end
Inspiration_images.rb:
class InspirationImage < ActiveRecord::Base
belongs_to :inspiration
end
But now, How to make a form and controller(create method) regarding using this model ? I want to make this as like as Spree Image uploading system. Please help me.