content_tag :ul, class: 'fancy' do
hashtags.map(&:to_s).map do |hashtag|
# XXX transitional
url = h.hashtag_page_enabled? && h.logged_out? ? h.tag_path(hashtag.downcase) : h.hashtag_friends_path(q: hashtag.downcase)
content_tag :li do
link_to "##{hashtag}", url, dir: h.html_dir(hashtag)
end
end.join.html_safe
end
environment.plugins.set(
'Provide',
new webpack.ProvidePlugin({
...
Bloodhound: 'typeahead.js/dist/bloodhound.js' // полный путь к вашей библиотеке
})
)
class Place
include Mongoid::Document
field :current_position, type: Boolean, default: "false"
validates :user_id, presence: true
belongs_to :user, touch: true
after_save :update_position_for_other, if: :current_position_changed?
private
def update_position_for_other
Place.where(:id.ne => id, user_id: user_id).update_all(current_position: false) if current_position
end
end
# app/constraints/version_constraint.rb
class VersionConstraint
def initialize
@versions = %w[ v1 v2 ]
end
def matches?(request)
@versions.include? request.path_parameters[:version].to_s
end
end
#routes.rb
scope ':version', constraints: VersionConstraint.new do
concerns :versioned_api_methods
end