Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
easy_globalize_accessors
Advanced tools
= EasyGlobalizeAccessors
== Introduction
Generator of easy accessor methods for models using Globalize.
Use globalize_accessors with list of translated fields you want easily access to and extra :locales array listing locales for which you want the accessors to be generated.
This way a single form can be used to edit given model fields with all anticipated translations.
== Installation
gem install easy_globalize_accessors
== Example
Definition like this:
class Product translates :title, :description globalize_accessors :locales => [:en, :pl], :attributes => [:title] end
Gives you access to methods: title_pl, title_en, title_pl=, title_en= (and similar set of description_* methods). And they work seamlessly with Globalize (not even touching the "core" title, title= methods used by Globalize itself).
:locales and :attributes are optional. Default values are: :locales => I18n.available_locales :attributes => translated_attribute_names
which means that skipping all options will generate you accessor method for all translated fields and available languages.
You can also get locales for class with "globalize_locales" method: Product.globalize_locales # => [:en, :pl]
== Always define accessors
If you wish to always define accessors and don't want to call globalize_accessors method in every class, you can extend ActiveRecord::Base with such module:
module TranslatesWithAccessors
def translates(*params)
options = params.extract_options!
options.reverse_merge!(:globalize_accessors => true)
accessors = options.delete(:globalize_accessors)
super
globalize_accessors if accessors
end
end
== Licence
Copyright (c) 2009-2010 Tomek "Tomash" Stachewicz (http://tomash.wrug.eu), Robert Pankowecki (http://robert.pankowecki.pl) released under the MIT license
FAQs
Unknown package
We found that easy_globalize_accessors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.