Skip to content

Instantly share code, notes, and snippets.

@markoh
Created June 22, 2012 21:41
Show Gist options
  • Save markoh/2975355 to your computer and use it in GitHub Desktop.
Save markoh/2975355 to your computer and use it in GitHub Desktop.
(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
I18n.locale = lang
if defined?(Refinery::User)
Refinery::User.all.each do |user|
if user.plugins.where(:name => 'refinerycms-cars').blank?
user.plugins.create(:name => 'refinerycms-cars',
:position => (user.plugins.maximum(:position) || -1) +1)
end
end
end
url = "/cars"
if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
page = Refinery::Page.create(
:title => 'Cars',
:link_url => url,
:deletable => false,
:menu_match => "^#{url}(\/|\/.+?|)$"
)
Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
page.parts.create(:title => default_page_part, :body => nil, :position => index)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment