cards and section get proper belongs_to associations

This commit is contained in:
Torsten 2022-12-17 14:28:01 +02:00
parent cdb9a3466a
commit 609ca0d57d
5 changed files with 45 additions and 2 deletions

View File

@ -1,4 +1,4 @@
require "mini_magick" require "mini_magick"
module Merged module Merged
class Image < ActiveYaml::Base class Image < ActiveYaml::Base

View File

@ -103,5 +103,12 @@ module Merged
Section.reload Section.reload
end end
def self.transform
Section.all.each do |card|
card.image = card.image_old
card.save
end
end
end end
end end

View File

@ -8,6 +8,8 @@ module Merged
set_root_path Rails.root #ouside engines not necessary set_root_path Rails.root #ouside engines not necessary
include ActiveHash::Associations include ActiveHash::Associations
belongs_to :image , class_name: "Merged::Image"
fields :options , :updated_at , :updated_by fields :options , :updated_at , :updated_by
def has_option?(option) def has_option?(option)
@ -61,7 +63,7 @@ module Merged
template_style.fields.collect{|f| f.to_sym} template_style.fields.collect{|f| f.to_sym}
end end
def image def image_old
Image.find_by_name(self.image_name) Image.find_by_name(self.image_name)
end end
end end

View File

@ -12,6 +12,7 @@
:updated_at: &1 2022-12-09 17:50:02.733622073 +02:00 :updated_at: &1 2022-12-09 17:50:02.733622073 +02:00
:section_id: 11 :section_id: 11
:index: 1 :index: 1
:image_id: 35
- :header: Large - :header: Large
:text: The old four patient rooms are basically twice the size as the small. They :text: The old four patient rooms are basically twice the size as the small. They
are large enough to be shared. The size is about 30m2 and the cost 240e. Like are large enough to be shared. The size is about 30m2 and the cost 240e. Like
@ -25,6 +26,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 11 :section_id: 11
:index: 2 :index: 2
:image_id: 17
- :id: 8 - :id: 8
:header: Non standard :header: Non standard
:text: There are smaller, rooms, and some connected rooms. If your needs are small, :text: There are smaller, rooms, and some connected rooms. If your needs are small,
@ -38,6 +40,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 11 :section_id: 11
:index: 3 :index: 3
:image_id: 25
- :id: 9 - :id: 9
:header: Wet spaces :header: Wet spaces
:text: If your work requires you to get dirty, we have different size wet rooms. :text: If your work requires you to get dirty, we have different size wet rooms.
@ -51,6 +54,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 11 :section_id: 11
:index: 4 :index: 4
:image_id: 40
- :id: 10 - :id: 10
:header: Common spaces :header: Common spaces
:text: Each floor has it's own large common space. Also, Hub Feenix offers great :text: Each floor has it's own large common space. Also, Hub Feenix offers great
@ -62,6 +66,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 12 :section_id: 12
:index: 1 :index: 1
:image_id: 4
- :id: 11 - :id: 11
:header: En suite and fold out :header: En suite and fold out
:text: "Some rooms have attached (or shared) bathrooms. Also, you have the option :text: "Some rooms have attached (or shared) bathrooms. Also, you have the option
@ -73,6 +78,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 12 :section_id: 12
:index: 2 :index: 2
:image_id: 12
- :id: 12 - :id: 12
:header: Shared kitchen, own sink :header: Shared kitchen, own sink
:text: Each floor has it's own common kitchen. This is especially useful if you :text: Each floor has it's own common kitchen. This is especially useful if you
@ -85,6 +91,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 12 :section_id: 12
:index: 3 :index: 3
:image_id: 36
- :id: 13 - :id: 13
:header: Name :header: Name
:text: '' :text: ''
@ -94,6 +101,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 13 :section_id: 13
:index: 1 :index: 1
:image_id:
- :id: 14 - :id: 14
:header: Email :header: Email
:text: '' :text: ''
@ -103,6 +111,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 13 :section_id: 13
:index: 2 :index: 2
:image_id:
- :id: 15 - :id: 15
:header: Phone :header: Phone
:text: '' :text: ''
@ -112,12 +121,14 @@
:updated_at: *1 :updated_at: *1
:section_id: 13 :section_id: 13
:index: 3 :index: 3
:image_id:
- :id: 16 - :id: 16
:header: Space requirements :header: Space requirements
:text: '' :text: ''
:updated_at: *1 :updated_at: *1
:section_id: 13 :section_id: 13
:index: 4 :index: 4
:image_id:
- :id: 17 - :id: 17
:header: Message :header: Message
:text: '' :text: ''
@ -127,6 +138,7 @@
:updated_at: *1 :updated_at: *1
:section_id: 13 :section_id: 13
:index: 5 :index: 5
:image_id:
- :id: 39 - :id: 39
:header: Cafe :header: Cafe
:text: Our cafe serves vegan and vegetarian light food and great tea and coffee. :text: Our cafe serves vegan and vegetarian light food and great tea and coffee.
@ -139,6 +151,7 @@
:updated_at: &2 2022-12-10 20:28:17.967357225 +02:00 :updated_at: &2 2022-12-10 20:28:17.967357225 +02:00
:section_id: 39 :section_id: 39
:index: 1 :index: 1
:image_id: 29
- :id: 40 - :id: 40
:header: Treatments :header: Treatments
:text: In our healery you can get professional help from osteopathy, shiatsu, acupuncture :text: In our healery you can get professional help from osteopathy, shiatsu, acupuncture
@ -152,6 +165,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 39 :section_id: 39
:index: 2 :index: 2
:image_id: 30
- :id: 41 - :id: 41
:header: Boutique and Gallery :header: Boutique and Gallery
:text: In our Boutique, you can find organic cosmetics, buy our great hub feenix :text: In our Boutique, you can find organic cosmetics, buy our great hub feenix
@ -165,6 +179,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 39 :section_id: 39
:index: 3 :index: 3
:image_id: 28
- :id: 42 - :id: 42
:header: Name :header: Name
:text: '' :text: ''
@ -174,6 +189,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 40 :section_id: 40
:index: 1 :index: 1
:image_id:
- :id: 43 - :id: 43
:header: Email :header: Email
:text: '' :text: ''
@ -183,6 +199,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 40 :section_id: 40
:index: 2 :index: 2
:image_id:
- :id: 44 - :id: 44
:header: Phone :header: Phone
:text: '' :text: ''
@ -192,6 +209,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 40 :section_id: 40
:index: 3 :index: 3
:image_id:
- :id: 45 - :id: 45
:header: Subject :header: Subject
:text: TEXT :text: TEXT
@ -201,6 +219,7 @@
:updated_at: *2 :updated_at: *2
:section_id: 40 :section_id: 40
:index: 4 :index: 4
:image_id:
- :id: 46 - :id: 46
:header: Message :header: Message
:text: '' :text: ''
@ -210,3 +229,4 @@
:updated_at: *2 :updated_at: *2
:section_id: 40 :section_id: 40
:index: 5 :index: 5
:image_id:

View File

@ -15,6 +15,7 @@
:updated_at: &1 2022-12-09 17:50:02.733622073 +02:00 :updated_at: &1 2022-12-09 17:50:02.733622073 +02:00
:page_id: 2 :page_id: 2
:index: 1 :index: 1
:image_id: 37
- :template: section_cards - :template: section_cards
:header: Sizes and kinds :header: Sizes and kinds
:text: We offer different sizes and different types of studios for artists. There :text: We offer different sizes and different types of studios for artists. There
@ -33,6 +34,7 @@
:updated_at: *1 :updated_at: *1
:page_id: 2 :page_id: 2
:index: 2 :index: 2
:image_id:
- :template: section_cards - :template: section_cards
:id: 12 :id: 12
:card_template: card_normal_square :card_template: card_normal_square
@ -47,6 +49,7 @@
:updated_at: *1 :updated_at: *1
:page_id: 2 :page_id: 2
:index: 3 :index: 3
:image_id:
- :template: form_section - :template: form_section
:id: 13 :id: 13
:card_template: form_field :card_template: form_field
@ -62,6 +65,7 @@
:updated_at: *1 :updated_at: *1
:page_id: 2 :page_id: 2
:index: 4 :index: 4
:image_id:
- :template: section_full_image - :template: section_full_image
:header: HUB FEENIX :header: HUB FEENIX
:text: Only an hour west of Helsinki, the Feenix rises from an old sanatorium. The :text: Only an hour west of Helsinki, the Feenix rises from an old sanatorium. The
@ -76,11 +80,13 @@
:updated_at: &2 2022-12-10 20:28:17.967357225 +02:00 :updated_at: &2 2022-12-10 20:28:17.967357225 +02:00
:page_id: 6 :page_id: 6
:index: 2 :index: 2
:image_id: 16
- :template: section_spacer - :template: section_spacer
:id: 32 :id: 32
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 1 :index: 1
:image_id:
- :template: section_half_image - :template: section_half_image
:header: Retreats :header: Retreats
:text: Hub Feenix is a beautiful place, ideally situated in the country, but close :text: Hub Feenix is a beautiful place, ideally situated in the country, but close
@ -96,6 +102,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 3 :index: 3
:image_id: 27
- :template: section_half_image - :template: section_half_image
:header: Studios :header: Studios
:text: We offer different size and different type of studios for artists. There :text: We offer different size and different type of studios for artists. There
@ -111,6 +118,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 4 :index: 4
:image_id: 37
- :template: section_half_image - :template: section_half_image
:header: Makerspace :header: Makerspace
:text: The hub encourages all people to be creative in any way they choose. We provide :text: The hub encourages all people to be creative in any way they choose. We provide
@ -126,6 +134,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 5 :index: 5
:image_id: 20
- :template: section_half_image - :template: section_half_image
:id: 36 :id: 36
:header: Coworking and offices :header: Coworking and offices
@ -145,6 +154,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 6 :index: 6
:image_id: 8
- :template: section_half_image - :template: section_half_image
:id: 37 :id: 37
:header: Conferences and buisness events :header: Conferences and buisness events
@ -164,6 +174,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 7 :index: 7
:image_id: 7
- :template: section_half_image - :template: section_half_image
:id: 38 :id: 38
:header: Residency and Accommodation :header: Residency and Accommodation
@ -184,6 +195,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 8 :index: 8
:image_id: 26
- :template: section_cards - :template: section_cards
:id: 39 :id: 39
:card_template: card_normal_square :card_template: card_normal_square
@ -196,6 +208,7 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 9 :index: 9
:image_id:
- :template: form_section - :template: form_section
:id: 40 :id: 40
:card_template: form_field :card_template: form_field
@ -208,3 +221,4 @@
:updated_at: *2 :updated_at: *2
:page_id: 6 :page_id: 6
:index: 10 :index: 10
:image_id: