This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assuming Mobility is already configured. if one wishes to properly synch up and migrate existing values from the class table attribute to the default locale | |
following example with attributes `description_short, description_long, description_search` and default_locale `de` | |
@articles.all each do |article| | |
article.update(description_short_de: article[:description_short], description_long_de: article[:description_long], description_search_de: article[:description_search]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When https in the browser has its TLS updated and is properly serving up pages, but curl fails: | |
1. download from https://curl.haxx.se/ca/cacert.pem to get the latest file | |
2. add '--cacert /path/to/cacert.pem' option to the curl command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is intended as a 'minimal amount of steps' to get Mobility running properly | |
• rails generate mobility:install | |
• edit `config/initializers/mobility.rb` | |
- uncomment `dirty`</li> | |
- uncomment `locale_accessors` and set desired locales | |
• rails db:migrate | |
• setup model | |
extend Mobility | |
translates :synopsis, type: :string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getting innumerable "already initialized constant" warnings? | |
Run "bundle clean --force" from the root of the Rails app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Notes: | |
1 - Not going the full 9 yards here - I prefer to see the CSS structures and thus have them available, so not handing them off to webpacker. | |
2 - Autocomplete is often required. js-autocomplete has no dependencies and has a small footprint. So what's wrong with going the old route and only calling the scripts on the pages that require it? | |
yarn add jquery | |
yarn add foundation-sites | |
** application.js ** | |
comment out rails generated initial and close bits, replace with single start call: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Memo for when testing with clients. | |
Browser versions have different access requirements to devices, location, etc. | |
As this author likes to use older OSes, there are threshholds that can be problematic when testing. | |
Fail | |
- google Chrome 60 (latest valid for 10.9) | |
- opera 49 (10.9 enabled, chromium) | |
- safari 9.1.3 (10.9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Any form, no object, just data to send, all you need is the target action route | |
form_with url: posts_path do |form| | |
Form for object, you add it **generically** to the tag. But `@post` still needs to be defined in the controller action | |
form_with scope: :post, url: posts_path do |form| | |
Form for object, safe for both post and patch paths. define `@post` in the controller action | |
form_with(model: @post) do |form| | |
Form for object, but you want to be lazy and not define `@post` in the controller action |
NewerOlder