- Dec 2020
-
github.com github.com
Tags
Annotators
URL
-
- Nov 2020
-
-
In short, I think the idea of public methods being actions works just fine as an api.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
You can use the match method with the :via option to match multiple verbs at once:
-
-
github.com github.com
Tags
Annotators
URL
-
-
-
-
I was confused as to why there is a dual system running on, there might be reasons for that but let's fix this situation by only using Webpacker to generate our assets.
-
- Sep 2020
-
github.com github.com
-
-
Kiosk provides APIs for integrating WordPress content into a Rails
Tags
Annotators
URL
-
-
github.com github.com
-
<html lang="<%= I18n.locale %>">
-
def svelte_compontent(name, props) content_tag(:div, nil, id: "svelte-#{name.dasherize}-root", 'data-props': props.to_json) end
-
-
-
github.com github.com
Tags
Annotators
URL
-
- Aug 2020
-
www.onthegosystems.com www.onthegosystems.com
-
Ruby is the programming language used in Translation Proxy. For Sarah, Object Oriented Design “done the Ruby way” is so enjoyable and is the part of her work that she likes most.
-
- Jul 2020
-
guides.rubyonrails.org guides.rubyonrails.org
Tags
Annotators
URL
-
-
-
RAILS_ENV determines which Webpacker YAML settings are used and NODE_ENV determines which webpack configuration is used.
-
This finally brings us to the use case for NODE_ENV=test: JavaScript unit testing By this I mean executing tests, written in JavaScript, against your application JavaScript code within a Node.js process.
-
-
www.reddit.com www.reddit.com
-
You can also just throw<% yield :javascript_packs %>somewhere in your layout, and use<%= content_for :javascript_packs do %><%= javascript_pack_tag 'visitor' %><% end %>
-
-
api.rubyonrails.org api.rubyonrails.org
-
Why did Rails team decide they need to implement their own "version" of Timecop?
On the one hand, that's great to reduce dependencies, but on the other hand, small dependencies are great (and rails already has lots of them), it just bloats ActiveSupport more, and creates a needless "duplication" of an already popular de facto standard for this problem -- one which (unlike Timecop) can't be easily used outside of the Rails/ActiveSupport ecosystem. It doesn't seem different enough to warrant creating it...
Timecop: Works with Rails and non-Rails
ActiveSupport::Testing::TimeHelpers: for use outside rails, requires dependency on bigger gem, AS.
-
-
api.rubyonrails.org api.rubyonrails.org
-
(Note that you rarely want to deal with Time.now, or Date.today, in order to honor the application time zone please always use Time.current and Date.current.)
-
-
github.com github.com
Tags
Annotators
URL
-
-
ruby-prof.github.io ruby-prof.github.io
-
The best way to do this is create a new Rails environment, profile.rb.
-
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
Actually, thats the one thing I’ve always thought Middleman got better than Rails: instead of eg, calling ‘render :admin’ in the general layout, you would ‘wrap_layout :application’ inside the specific (admin) one. It’s much more ergonomic this way.
-
- Jun 2020
-
stackoverflow.com stackoverflow.com
-
gist.github.com gist.github.com
-
edgeguides.rubyonrails.org edgeguides.rubyonrails.org
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
rails.lighthouseapp.com rails.lighthouseapp.com
-
I ran in to what I thought was this issue, but I was using fragment caching. Since the partial was not executed again, the content_for was not called. content_for could be written differently to handle this.
-
-
gist.github.com gist.github.com
-
Supports nested 'cache do' blocks and some fixes
-
-
rails.lighthouseapp.com rails.lighthouseapp.com
-
stackoverflow.com stackoverflow.com
- May 2020
- Apr 2020
-
www.rubydoc.info www.rubydoc.info
-
As mentioned in StateMachines::Machine#state, you can define behaviors, like validations, that only execute for certain states. One important caveat here is that, due to a constraint in ActiveRecord's validation framework, custom validators will not work as expected when defined to run in multiple states.
-
-
guides.rubyonrails.org guides.rubyonrails.org
Tags
Annotators
URL
-
-
github.com github.com
-
For Rails 5, note that protect_from_forgery is no longer prepended to the before_action chain, so if you have set authenticate_user before protect_from_forgery, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use protect_from_forgery prepend: true.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
stackoverflow.com stackoverflow.com
-
github.com github.com
-
guides.rubyonrails.org guides.rubyonrails.org
-
Rails also adds a test method that takes a test name and a block. It generates a normal Minitest::Unit test with method names prefixed with test_. So you don't have to worry about naming the methods, and you can write something like:
Or you could use the "it" format mentioned on https://devhints.io/minitest.
Or better yet, just use rspec...
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
The translated model name, translated attribute name, and value are always available for interpolation as model, attribute and value respectively.
Tags
Annotators
URL
-
-
blog.bigbinary.com blog.bigbinary.com
-
github.com github.com
-
Similar to: form_for, but not actually for forms, apparently
Tags
Annotators
URL
-
-
github.com github.com
-
There are few ways to build forms with objects that don't inherit from Active Record, as follows:
Tags
Annotators
URL
-
-
thepugautomatic.com thepugautomatic.com
-
the /rails/info/properties page
Cool. First I'd heard of the /rails/info/properties page!
-
- 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