So something is definitely broken in your Javascripts, or the views - the scaffold code there is what I am used to seeing, just referencing the record rather than the explicit ID you pass in.
I am at a loss as to why Windows is complaining when you change the name, or indeed why it would not respond to the standard name of application.js - which has no meaning to Windows that I am aware of
> On 28 Jan 2016, at 17:24, Bob Tian <lists@ruby-forum.com> wrote:
>
> I actually did not rename it to default.js, but when I try to do that
> and access localhost I get an error:
>
> ExecJS::ProgramError in People#index
> Showing: /app/views/layouts/application.html.erb where line #6 raised:
> TypeError: Object doesn't support this property or method
>
> and line 6 which is:
>
> <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
>
>
> I tried using scaffold and it does the same thing, it can add, but it
> does not delete, it directs me to /posts/1 where it just displays the
> data for id:1
>
> The code in views is different from mine:
>
> index:
>
> <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are
> you sure?' } %></td>
>
> controller:
>
> def destroy
> @post.destroy
> respond_to do |format|
> format.html { redirect_to posts_url, notice: 'Post was
> successfully destroyed.' }
> format.json { head :no_content }
> end
> end
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/Kf-1pDBEmK0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/460fe4de0315f223782195ada5312029%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/C350179F-CABF-4FA1-BC4A-271585E1ABF2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment