Ruby on Rails Sunday, October 16, 2016

Hi,

On Sun, Oct 16, 2016, at 22:34, kinoe - wrote:
> I'm assuming you want if
> @admin.save then a render or
> redirect afterwards.
> #correct,i assuming here i want input data to db with defference name.
> #means:if i have field name with value "cow" on db, i not want not have
> two "cow" name on table Box,because that i use @n as checker,are there
> name with 'cow'.'quotes'(i want make sign up with manual but here i
> assuming def create as login for my ask today).

What you're looking for is probably uniqueness check, either at model
level (validates_uniqueness_of) and/or database (unique index).

> if @n

Here, @n will always be true because you have:

> @n = Box.where(name: params[:name])

which always return trueish value even when there's no result. You need
either call `take` or use `find_by` instead or do it properly as I wrote
above.

> #i am using hp,i hope you understand that has give.
> (:-) my english less)
>

Try learning English (for example, using https://id.duolingo.com/ ).

--
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/1476625430.2663335.757473465.55CC4541%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment