db/seeds.rb in refinerycms-inquiries-2.1.0 vs db/seeds.rb in refinerycms-inquiries-3.0.0
- old
+ new
@@ -1,19 +1,17 @@
::Refinery::User.all.each do |user|
- if user.plugins.where(:name => 'refinery_inquiries').blank?
- user.plugins.create(:name => "refinery_inquiries")
- end
+ user.plugins.where(:name => 'refinery_inquiries').first_or_create!
end if defined?(::Refinery::User)
if defined?(::Refinery::Page)
- contact_us_page = Refinery::Page.where(:link_url => '/contact').first
+ contact_us_page = Refinery::Page.find_by(:link_url => Refinery::Inquiries.page_path_new)
unless contact_us_page
contact_us_page = ::Refinery::Page.create({
:title => "Contact",
- :link_url => "/contact",
- :menu_match => "^/(inquiries|contact).*$",
+ :link_url => Refinery::Inquiries.page_path_new,
+ :menu_match => "^(/inquiries.*)|#{Refinery::Inquiries.page_path_new}$",
:deletable => false
})
contact_us_page.parts.create({
:title => "Body",
:body => "<p>Get in touch with us. Just use the form below and we'll get back to you as soon as we can.</p>",
@@ -24,15 +22,15 @@
:body => "",
:position => 1
})
end
- unless Refinery::Page.where(:link_url => '/contact/thank_you').any?
+ unless Refinery::Page.where(:link_url => Refinery::Inquiries.page_path_thank_you).any?
thank_you_page = contact_us_page.children.create({
:title => "Thank You",
- :link_url => "/contact/thank_you",
- :menu_match => "^/(inquiries|contact)/thank_you$",
+ :link_url => Refinery::Inquiries.page_path_thank_you,
+ :menu_match => "^(/inquiries/thank_you)|#{Refinery::Inquiries.page_path_thank_you}$",
:show_in_menu => false,
:deletable => false
})
thank_you_page.parts.create({
:title => "Body",
@@ -53,8 +51,8 @@
:position => 0
})
end
end
-(Refinery::Inquiries::Setting.methods.sort - ActiveRecord::Base.methods).each do |setting|
- Refinery::Inquiries::Setting.send(setting) unless setting.to_s =~ /=$/
+(Refinery::Inquiries::Setting.methods.sort - Refinery::Setting.methods).each do |setting|
+ Refinery::Inquiries::Setting.send(setting) if setting.to_s !~ /=\z/
end