Sha256: 7fa43e564a6c515401598fadf60261358b3deeefba88389206502747cd159e54

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

Answers::I18n.frontend_locales.each do |lang|
  I18n.locale = lang

  Answers::User.find_each do |user|
    user.plugins.where(name: 'answers-<%= namespacing.underscore %>').first_or_create!(
      position: (user.plugins.maximum(:position) || -1) +1
    )
  end if defined?(Answers::User)

<% unless skip_frontend? -%>
  Answers::Page.where(link_url: (url = "/<%= [(namespacing.underscore if namespacing.underscore != plural_name), plural_name].compact.join('/') %>")).first_or_create!(
    title: '<%= class_name.pluralize.underscore.titleize %>',
    deletable: false,
    menu_match: "^#{url}(\/|\/.+?|)$"
  ) do |page|
    Answers::Pages.default_parts.each_with_index do |part, index|
      page.parts.build title: part, body: nil, position: index
    end
  end if defined?(Answers::Page)
<% end -%>
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
answers-core-0.0.0.2 lib/generators/answers/engine/templates/db/seeds.rb.erb
answers-core-0.0.0 lib/generators/answers/engine/templates/db/seeds.rb.erb