This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<form name="sform" action="" style="display:inline;"> | |
<label for="item_name">Filter on item name : </label> | |
<%= text_field_tag("query", params['query'], :size => 10 ) %> | |
</form> | |
<%= image_tag("spinner.gif", | |
:align => "absmiddle", | |
:border => 0, | |
:id => "spinner", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@esi_dev = Kernel.const_get("Esi#{self.model_name}").new(@device.attributes.delete_if{|k,v|!Kernel.const_get("Esi#{self.model_name}").respond_to?(k)}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will associate ANY device type with an ESI and create the | |
# associated EsiDeviceType record properly populated. | |
def add_device | |
#Look up device to add | |
@device = Kernel.const_get(self.model_name).find(params[:id]) | |
#Ok, this line is some serious black magic and needs explained... | |
# 1. Extract the name of the model (device type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The object: | |
EsiElectricMeter(esi_electric_meter_id: integer, electric_meter_id: integer, esi_id: integer, device_mq_id: integer, name: string, status: string, comments: text, active_flag: string, delete_flag: string, initial_meter_reading: integer, final_meter_reading: integer, meter_reading_delta: integer, submeter_flag: string, ct_factor: integer, esi_electric_meter_history_id: integer, date_created: timestamp, date_updated: timestamp) | |
irb(main):126:0* EsiElectricMeter.respond_to?("esi_electric_meter_id") | |
=> false | |
irb(main):127:0> | |
irb(main):128:0* EsiElectricMeter.respond_to?("electric_meter_id") | |
=> false |