Mamadou Touré wrote:
[…]
Hi Marnen, here is my controller code (the method ‘generer’ is triggered
once a user hit a submit button)
I don’t see offhand why your render statement isn’t working well, but
you’ve got a lot of other problems in your code.
First of all, the entire method may be too long. You may want to split
it up.
def generer
vue = getvue(params[:id])
Why not an ActiveRecord query? And why getvue instead of get_vue ?
arr_doc = Array.new()
That line is unnecessary, since the split in the next line already
creates the array.
arr_doc = params[:arr].split(",")
params[:arr].gsub!(/[,]/, '^')
The brackets in the regex are unnecessary. Actually, the regex itself
can just be a string. Anyway, the whole line is probably unnecessary,
since it doesn’t look like params[:arr] gets referred to after this.
vaat_val_lang = vue.langue
if vaat_val_lang.eql?("F")
Why eql? ? It’s perfectly fine to use == with strings.
vaat_id_lang = 5
else
vaat_id_lang = 6
end
You could probably replace this with an AR query.
plsql = nil
plsql = connection.parse('begin
corr_pck_formul_intellgnt.prc_fi_sous(:p_dect_id
,:p_vaat_id_langue_docu
,:p_list_doc
,
:p_drive); end;')
plsql.bind_param(':p_dect_id', vue.dect_id, Integer)
plsql.bind_param(':p_vaat_id_langue_docu', vaat_id_lang, Integer)
plsql.bind_param(':p_list_doc', params[:arr], String)
plsql.bind_param(':p_drive',path_drive, String)
plsql.exec
Why not just find_by_sql or connection.execute ?
render :js => "alert('Test !');"
This should work. In fact, it sounds like it is working – it’s
sending the text to the browser just like it should. What it may not be
doing properly is setting the MIME type. Can you check the MIME type of
the response?
end
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]