Just a note: What happened when I built the "Gettings Started with
Rails" sample app, was that the "Deleting Articles" method did not work
also, as I indicate below. The issue involved a parameter in the
"production.rb" file, where a parameter is coded by default as false.
This parameter is: "config.assets.compile = false". If you have not
"precompiled" your assets, this value set to "false" prevents the
javascript from being sent from the WEBrick rails server to your
browser. You get *no* javascript generated. (Note: I am using Ruby
version 2.3.0p0,rev. 53290, i686-linux, and rails 4.2.5.1, with sqlite3
1.3.11).
The solution for my experimental website, was to toggle
this value to "true". This means that in "../Weblog/config/environments"
directory, you can simply edit the "production.rb" file, and set the
"config.assets.compile = true", and your javascript will now be sent
from the WEBrick rails server, to your browser, as you would expect.
You
can then start the WEBrick rails server in production mode, and the
example website should work, assuming your target browser has javascript
enabled. (For Firefox, check with "about:config", search for
javascript, confirm it is set to "enabled".). On the Rails server
side, if running on a Linux box, (in my example), I start the default
rails server from a terminal window, in the Weblog directory, with:
"export SSL=true" and then "rails server -b 0.0.0.0 -p 3000 -e
production".
With the "production.rb" parameter
"config.assets.compile = true" your website should work. (This means
the "Destroy" option should bring up the dialog box, and then if
confirmed, invoke the delete method, and remove the selected article
from your SQLite database. ) It also means that images that you put in
"../Weblog/app/assets/images" directory, will actually render, if you
use the rails "image_tag" verb. (I think Rails calls these verbs
"helpers"). For example, you can render a .jpg or .png file, by just
dropping the file into the images directory, and then putting "<%=
image_tag 'ImageFileName.jpg' %> in your "index.html.erb" file, which
lives in the "../Weblog/app/views/welcome" directory. But without the
"config.assets.compile = true" line in your "production.rb" file, you
just see the actual image-filename rendered in your browser, instead of
the seeing the image.
Basically, the "Getting Started with
Rails" tutorial is correct. But one has to confirm that the many
Rails parameters are set correctly, to ensure the javascript code is sent from
the WEBrick rails server (- or server "Thin" or "Unicorn" or "Apache" /
whatever web-server you are using) - to the browser. For large production systems, you will want to pre-compile your "assets" - ie. javascript, images, etc. See Rails Guide:
http://guides.rubyonrails.org/asset_pipeline.html#in-productionHope this is useful. There are a fair bit of obsolete suggestions on others sites about how to fix this problem, which appears to have
been successfully addressed in current versions of Rails. :)