I don't know from which language you come from but you definitively don't use the ruby and rails Style.
- First of all, you use
find_email_by_account act223
and you assign a variable so why to you call this method. - Secondly,
d= ""
, what isd
. In ruby, and in programation in general, is better to use explicit name. - For
!act223.blank?
, there is this methodact223.present?
. - What is
s
ins = @email.where ["EMAL23=?" ]
? - Where come from variable
@email
oract223
?
For you error, a file called weboel23
must define a model called Weboel123
.
You should probably do an instance method callable like this @account.email
.
I suggest to build a model like this :
class WEBOEL23 < ActiceRecord::Base
establish_connection "as400_#{RAILS_ENV}"
set_table_name "WEBOEL23"
def email
WEBOEL23.where(ACT223: act223).first.email
end
end
So you can use it like this :
@weboel23.email
I don't know if this is the best practice because I don't know what is ACT223 or weboel23.
I agree with the comment of @bjhaid. Take a pause and read about ruby and rails.