Skip to content

Commit

Permalink
Drop ENV['RAILS_ASSETS_PRECOMPILE'] hack because the same thing can n…
Browse files Browse the repository at this point in the history
…ow achieved using Rails config - config.assets.initialize_on_precompile = false.
  • Loading branch information
ugisozols committed Feb 6, 2012
1 parent 5002500 commit 9f8f8ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
2 changes: 1 addition & 1 deletion authentication/app/models/refinery/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class User < Refinery::Core::Base
has_and_belongs_to_many :roles, :join_table => ::Refinery::RolesUsers.table_name

has_many :plugins, :class_name => "UserPlugin", :order => "position ASC", :dependent => :destroy
has_friendly_id :username, :use_slug => true unless ENV['RAILS_ASSETS_PRECOMPILE']
has_friendly_id :username, :use_slug => true

# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
Expand Down
17 changes: 0 additions & 17 deletions core/lib/tasks/assets.rake

This file was deleted.

20 changes: 9 additions & 11 deletions pages/app/models/refinery/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ class Page < Refinery::Core::Base

# Docs for acts_as_nested_set https://github.com/collectiveidea/awesome_nested_set
# rather than :delete_all we want :destroy
unless ENV['RAILS_ASSETS_PRECOMPILE']
acts_as_nested_set :dependent => :destroy

# Docs for friendly_id http://github.com/norman/friendly_id
has_friendly_id :custom_slug_or_title, :use_slug => true,
:default_locale => (::Refinery::I18n.default_frontend_locale rescue :en),
:reserved_words => %w(index new session login logout users refinery admin images wymiframe),
:approximate_ascii => Refinery::Pages.approximate_ascii,
:strip_non_ascii => Refinery::Pages.strip_non_ascii,
:scope => :parent
end
acts_as_nested_set :dependent => :destroy

# Docs for friendly_id http://github.com/norman/friendly_id
has_friendly_id :custom_slug_or_title, :use_slug => true,
:default_locale => (::Refinery::I18n.default_frontend_locale rescue :en),
:reserved_words => %w(index new session login logout users refinery admin images wymiframe),
:approximate_ascii => Refinery::Pages.approximate_ascii,
:strip_non_ascii => Refinery::Pages.strip_non_ascii,
:scope => :parent

# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:title, :meta_keywords, :meta_description,
Expand Down
6 changes: 2 additions & 4 deletions pages/lib/refinery/pages/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Engine < ::Rails::Engine
config.autoload_paths += %W( #{config.root}/lib )

config.to_prepare do |app|
Refinery::Page.translation_class.send(:is_seo_meta) unless ENV['RAILS_ASSETS_PRECOMPILE']
Refinery::Page.translation_class.send(:is_seo_meta)
Refinery::Page.translation_class.send(:attr_accessible, :browser_title, :meta_description, :meta_keywords, :locale)
end

Expand Down Expand Up @@ -39,9 +39,7 @@ class Engine < ::Rails::Engine

initializer "add marketable route parts to reserved words", :after => :set_routes_reloader_hook do |app|
if Refinery::Pages.marketable_urls
# ENV['RAILS_ASSETS_PRECOMPILE'] is a temporary hack to avoid initializing the database during
# assets precompile for issue https://github.com/resolve/refinerycms/issues/1059
add_route_parts_as_reserved_words(app) unless ENV['RAILS_ASSETS_PRECOMPILE']
add_route_parts_as_reserved_words(app)
end
end

Expand Down

0 comments on commit 9f8f8ef

Please sign in to comment.