Re: [Rails] ask remove json after create(crud) manual

15 views
Skip to first unread message
Message has been deleted

Colin Law

unread,
Oct 11, 2016, 4:06:27 AM10/11/16
to Ruby on Rails: Talk
On 11 October 2016 at 08:42, kinoe - <kin...@gmail.com> wrote:
> this step''
> 1.mke contrl Article index create new
> 2.mke mdel save title:string isi:text
> 3.in ArticelControl
> def index
> @sav = Save.all
> end
> def new
> @sav = Save.new
> end
> def create
> @sav = Save.new(article_params)
> @sav.save
> redirect_to :action => index
> end
>
>
> this too long.problem.after create method finish and data in. above table in index.html.erb show to like json otherwise i cant make json?

Sorry, I cannot understand your question, I assume English is not your
first language. Please try to ask it again, possibly you could ask
someone to help you to translate it.

Colin

>
> --
> 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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ff49c569-a7cc-48ed-bfc7-17d5aaf90ff9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Colin Law

unread,
Oct 12, 2016, 9:26:35 AM10/12/16
to Ruby on Rails: Talk
On 12 October 2016 at 01:53, kinoe - <kin...@gmail.com> wrote:

I am sorry for my langguage. this above screenshot: what is wrong. I can't using 'rails g scaffold'. thanks.Colin Law


Please copy/paste your index.html.erb file here.  That is the file that generates the html for the page.

Colin
 
Message has been deleted
Message has been deleted

Colin Law

unread,
Oct 13, 2016, 6:09:12 PM10/13/16
to Ruby on Rails: Talk
On 13 October 2016 at 03:17, kinoe - <kin...@gmail.com> wrote:
this code:
<h1>Artikel#index</h1>

<% if @save.blank? %>
<p>data nothing</p>
<br>
<%= link_to "buat baru", artikel_new_path %>
<% else %>

<table border="1px">
 <tr>
  <td width="80px">Title</td>
  <td width="100px">Isi</td>
  <td width="50px">Desc</td>
  </tr>

<%= @save.each do |ss| %>


You have <%= instead of <%  so it is displaying the return value from the line.  Try it without the =

Colin

 
  <tr>
  <td><%= ss.title %></td>
  <td><%= ss.isi %></td>
  <td><%= link_to "Desc", {:action => "show",:id => ss.id} %></td>
  </tr>
<% end %>
</table>
<br><br>
<% end %>
  
<%= link_to "buat baru", artikel_new_path %>




 

--
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/9fb2fe04-e761-48f1-affb-488b44cdfbd4%40googlegroups.com.
Message has been deleted

Colin Law

unread,
Oct 14, 2016, 4:56:15 AM10/14/16
to Ruby on Rails: Talk
On 14 October 2016 at 07:23, kinoe - <kin...@gmail.com> wrote:
it's correct.thanks colin.i think if i want using ruby on rails, i have not using = after <%. like statement.

Do you understand the difference?  if not then make sure you read up on it so you know when to use <%= and when to use <%

Colin
 

--
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.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages