Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7019

Where is the good place for adding custom datas when sending form (insert/update)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From jacki <collector@idealan.pl>
Newsgroups comp.lang.ruby
Subject Where is the good place for adding custom datas when sending form (insert/update)
Date Wed, 03 Sep 2014 10:58:31 +0200
Organization ATMAN - ATM S.A.
Lines 28
Message-ID <lu6l7f$b61$1@node2.news.atman.pl> (permalink)
NNTP-Posting-Host biuro.idealan.pl
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace node2.news.atman.pl 1409734704 11457 178.212.148.2 (3 Sep 2014 08:58:24 GMT)
X-Complaints-To usenet@atman.pl
NNTP-Posting-Date Wed, 3 Sep 2014 08:58:24 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
Xref csiph.com comp.lang.ruby:7019

Show key headers only | View raw


Hi,

I'm new to rails. I'm learning and don't always know if i'm doing right.
So, let's assume that i that have table in the database:
table X:
field1
field2
custom_field

i've done
# rails g scaffold X field1:somethin field2:something custom_field:something

I've deleted a custom_field entries from _form.html.erb because i need
to fill this field depending on the field1. So i need to check what have
been sent in field1 and based on that fill the custom_field.

Ok, so i think i need to do this in the controller, but i do not fully
understand where.

x.update(x_params)

so do i need to modyfy x_params method whitch looks like:

def x_params
      params.require(:x).permit(:field1, :field2)
end

i'm so confused :)

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar


Thread

Where is the good place for adding custom datas when sending form (insert/update) jacki <collector@idealan.pl> - 2014-09-03 10:58 +0200
  Re: Where is the good place for adding custom datas when sending form   (insert/update) Robert Klemme <shortcutter@googlemail.com> - 2014-09-03 19:50 +0200

csiph-web