- Mar 2020
-
thepugautomatic.com thepugautomatic.com
-
If you ever need to work with external translators, it’s a bit of a pain sending both your YML files and a bunch of views like index.en.html.erb. For one thing, you need some code to find all those files and send them, and put them back after receiving the translations. For another, your translator must respect the markup and code of the template, and know not to translate them. And if you want to use tools like WebTranslateIt, it’s easier to stick to YML.
Good point. Better to store translations in your I18n backend in the same place as your subject translations, etc. (which by default is in YAML file).
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
Action View has the ability to render different templates depending on the current locale.For example, suppose you have an ArticlesController with a show action. By default, calling this action will render app/views/articles/show.html.erb. But if you set I18n.locale = :de, then app/views/articles/show.de.html.erb will be rendered instead. If the localized template isn't present, the undecorated version will be used. This means you're not required to provide localized views for all cases, but they will be preferred and used if available.
This is one option, but there is another camp that says it's better to store translations in your I18n backend in the same place as your subject translations, etc.: https://thepugautomatic.com/2012/07/rails-i18n-tips/
-
-
stackoverflow.com stackoverflow.com
-
ActionController and ActionMailer default include AbstractController::Rendering directly or indirectly (ActionController::Metal::Rendering). AbstractController::Rendering uses ActionView as default library for its template rendering engine and includes AbstractController::ViewPaths and an instance of I18n proxy to find localized views. To learn more i'd like to refer to the ActionPack source code on github. To get to the point. ActionView allows you to use localisation in your templates: See Rails guide: Action View Overview , Chapter Localized views.
Not a very detailed or good code dissection, but is kind of one.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
For several reasons the Simple backend shipped with Active Support only does the "simplest thing that could possibly work" for Ruby on Rails3 ... which means that it is only guaranteed to work for English and, as a side effect, languages that are very similar to English. Also, the simple backend is only capable of reading translations but cannot dynamically store them to any format.That does not mean you're stuck with these limitations, though. The Ruby I18n gem makes it very easy to exchange the Simple backend implementation with something else that fits better for your needs, by passing a backend instance to the I18n.backend= setter.
-
-
github.com github.com
Tags
Annotators
URL
-
-
bernardic.ca bernardic.ca
-
it comes down to opportunities for code reuse. Will your system re-use more code if you use WordPress and its very usable admin area, myriad of available plugins and themes? Or can you re-use more code by harnessing the object-oriented design, DSLs and good software development practices mecca that is Ruby, Rails and the available libraries and tools?
-
-
github.com github.com
Tags
Annotators
URL
-
-
translation.io translation.io
Tags
Annotators
URL
-
- Feb 2020
-
guides.rubyonrails.org guides.rubyonrails.org
-
The :shallow_prefix option adds the specified parameter to the named route helpers:
-
You can also specify the :shallow option in the parent resource, in which case all of the nested resources will be shallow:
-
The shallow method of the DSL creates a scope inside of which every nesting is shallow. This generates the same routes as the previous example:
Tags
Annotators
URL
-
- Dec 2019
-
github.com github.com
-
github.com github.com
-
If you need more advanced React-integration, like server rendering, redux, or react-router, see shakacode/react_on_rails, react-rails, and webpacker-react.
-
-
github.com github.com
-
This gem also includes a responders controller generator, so your scaffold can be customized to use respond_with instead of default respond_to blocks. From 2.1, you need to explicitly opt-in to use this generator by adding the following to your config/application.rb: config.app_generators.scaffold_controller :responders_controller
-
Responders don't use valid? to check for errors in models to figure out if the request was successful or not, and relies on your controllers to call save or create to trigger the validations.
-
-
weblog.rubyonrails.org weblog.rubyonrails.org
-
stackoverflow.com stackoverflow.com
-
Arguably, the rails-team's choice of raising ArgumentError instead of validation error is correct in the sense that we have full control over what options a user can select from a radio buttons group, or can select over a select field, so if a programmer happens to add a new radio button that has a typo for its value, then it is good to raise an error as it is an application error, and not a user error. However, for APIs, this will not work because we do not have any control anymore on what values get sent to the server.
-
liberal_enum :kind
-
-
stackoverflow.com stackoverflow.com
-
When the controller creates the user, instead of adding a validation error to the record, it raises an exception. How to avoid this?
-
I really dislike the reasoning as stated in the issue listed above. Since the value is coming over the wire, it should be treated the same as a freetext input where the expectation is to validate in the model and not the controller. This is especially true in APIs where the developers have even less of a say as far as expected input coming from form data (for example).
-
In case anyone wants a hack, here is what I came up with.
-
-
stackoverflow.com stackoverflow.com
-
But now the first line throws an exception ArgumentError: '0' is not a valid audience
-
- Nov 2019
-
blog.codeship.com blog.codeship.com
-
vitobotta.com vitobotta.com
-
gist.github.com gist.github.com
-
github.com github.com
-
github.com github.com
- Sep 2019
- Aug 2019
-
www.reddit.com www.reddit.com
-
Websites where to find out challenges
-
-
github.com github.com
-
pluck_to_hash
-
- Jun 2019
-
www.railstutorial.org www.railstutorial.org
-
At each stage of developing the sample application, we will write small, bite-sized pieces of code—simple enough to understand, yet novel enough to be challenging. The cumulative effect will be a deeper, more flexible knowledge of Rails, giving you a good background for writing nearly any type of web application.
-
Following the scaffolding approach risks turning you into a virtuoso script generator with little (and brittle) actual knowledge of Rails.
Tags
Annotators
URL
-
- Nov 2016
-
sites.google.com sites.google.com
-
"American Idiot" - Green Day
Green Day's first number one album since 1994's multi-platinum Dookie--which is likely due to the fact that while the lyrics may have a deeper meaning, the hooks are still there, and they are played with the same intensity that made the group famous more than a decade ago. Spin said the title track was "Green Day's most epic song yet.
-
Now everybody do the propaganda,And sing along to the age of paranoia.
The work challenges listeners to dig deeper than the high-octane guitars and thundering drums that drive the record's jubilant pop sheen. This is a multi-layered, literate narrative that effectively wields anger, wit, and bombast to expose the ugliness that seeps below the surface of this country's patriotism, commercialism, and nationalism.
-
We're not the ones who're meant to follow.
"A lot of rock music lacks ambition. Rock has become stagnant. There are a lot of bands that aren't doing anything differently than what's currently going on in pop music--like issuing a single, putting out a record, making a video, and hopefully getting on a tour with a bigger band. I think the reason hip-hop has become so much bigger than rock lately is because those artists are much more ambitious, and they are making records that have a concept and characters. They sound like a script." ~Billy Joe Armstrong
-
Television dreams of tomorrow.
"All my songwriting is about creating a statement and taking action. On American Idiot, it's reflecting on what's going on in the world right now." ~Billy Joe Armstrong
Tags
- Porosky, Pamela. "Fear & loathing in a post-9/11 America: Green Day's Billie Joe Armstrong rails against idiocy and indifference." Guitar Player Feb. 2005: 70+. Student Resources in Context. Web. 27 Oct. 2016.
- "Green Day." UXL Biographies. Detroit: UXL, 2011. Student Resources in Context. Web. 27 Oct. 2016.
Annotators
URL
-
- Jan 2016
-
daniel-azuma.com daniel-azuma.com
-
require 'active_record/connection_adapters/postgis_adapter/railtie'
The following worked better in my setup:
require 'active_record/connection_adapters/postgis/railtie'
Tags
Annotators
URL
-
-
clarkdave.net clarkdave.net