questions
---------
id
topic_id
created_by
created_at
question_text
closed_by
closed_at
response_text
It appears in a nested table under the topics
table.
I can easily create a question
, I just have to exclude :created_by, created_at, closed_by, closed_at, response_text
from config.create.columns
. (created_at
and created_by
is filled with before_create_save()
. So the only field the user actually fills is question_text
.
The next step would be to create a "Respond" action (instead of "Edit") which would be very similar to an :update
with a few differences. The form of this action would exclude all fields, except response_text
. The before开发者_开发知识库_respond_save()
would do the filling of closed_by
and closed_at
.
Is there any way of doing this without creating custom views (.erb
, .rhtml
) with hand?
(In short: Is there any way to escape from "CRUD" a little-bit, but not doing everything by hand?)
EDIT: Example for exclude
active_scaffold do |config|
# ...
config.create.columns.exclude [:created_by, :created_at, :closed_by, :closed_at, :response_text]
# ...
end
I gave up on solving the problem this way. As I believe the current environment does not support my approach. Instead, I went on with writing forms. See RoR: How to handle custom nested form's submit
精彩评论