-
Notifications
You must be signed in to change notification settings - Fork 385
Common Issues & Errors
Mirv edited this page Nov 2, 2017
·
2 revisions
For trouble shooting help, please see the end ...
Entries not saving - also known as "Mass assignment protection", or "Strong Param(s)" / "Strong Parameters"
There are mass assignment checks in rails. Rails 4 & 5 use Strong Parameters. Older versions of Rails used attr_accessible
.
How to recognize
- Your project is in Rails 3 or newer.
- You might have accidently used a guide for an older version of Rails (pre-2014 date normally, but the gem was available 2012)
- Your Jquery stuff (dynamic forms and effects, etc) work, looks pretty & return in console
- See main guide for trouble shooting this type of issue - https://github.com/nathanvda/cocoon#strong-parameters-gotcha
- Official edge guide from Rails - http://edgeguides.rubyonrails.org/action_controller_overview.html#strong-parameters
Just because Cocoon gem is adding / removing fields, does not mean that the Jquery library is working. With Jquery, there's 5 or 6 places it can go wrong OR everything can be "right", but duplicate code base can cause conflicts.
How to recognize
- You can see buttons/tabs/links, but click something & nothing happens
- Not everything you programmed is happening
- Other Jquery stuff (bootstrap, widgets, etc) stop working
- You might or might not see your assets in the Chrome web console in the
elements
section - If you try logging something to the web browser console, it doesn't show up
Classes of Jquery issues
-
Rails asset pipe line - assets not loading (in webconsole)
- lack of
javascript_include_tag
- too many gemfile entries of the different Jquery libraries
- Use of CDN alongside gemfile or Jquery file stored on your server in `app/assets/javascript or even <script> in the views
-
javascript_include_tag
not side the header or header tag not closed - lack of
//= .
at the end of theapplication.js
- your files are not in the
app/assets/javascript
directory to be included - new changes aren't being reflected in the Chrome web browser
elements
or the code base via web - automatically generated
.coffee
files in the assets directory, conflicting with.js
files if you don't use coffeescript - Sporadic or random issues
- lack of
-
Non-responsive / Conflicts
- Duplicates of the Jquery source files
- Slow loads
- Sudden flashes or effects
- Most of the time there is no sign, your cocoon fields will appear, but none of the effects will work
- Duplicates of the Jquery source files
Resources ...
- Trouble shooting guide for Jquery - Jquery Trouble shooting
- Strong Parameters
- Cocoon - Readme - pay attention to the nesting
- Official Rails - Scroll to 4.5.2 Nested Parameters