
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
This is a Rails plugin for MongoMapper that allows you to translate your models in a way that is similar to the Globalize gem for ActiveRecord.
After heading down this path for several days I found https://github.com/ahe/mongo_translation and decided I like their implimentation of the klass better but it needed a few changes to make it easier to use from a rails controller.
USAGE: First add to your Gemfile gem 'monglobal'
Then run bundle install
Then in your model:
class Post
include MongoMapper::Document
include Monglobal
translates :title, :body
key :title, String
key :body, String
end
Now your controller is pretty much the same with one difference to how you update a record. Instead of using update_attributes use this on your update method.
def create post = Post.new(params[:post]) if post.save redirect_to translate_posts_path(params[:locale]) end end
def update post = Post.find(params[:id]) post.update_translation(params[:locale], params[:post]) redirect_to translate_posts_path(params[:locale]) end
The sample app here might help with some of the details of switching the locale and setting up the default locale.
FAQs
Unknown package
We found that monglobal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.