my code stock.com

Snippet options

Download: Download snippet as get-ru-types.rb.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

    groups_of_current_user = current_user.groups
    groups_ids = []
    groups_of_current_user.each do |group_obj|
      groups_ids << group_obj.id
    end
    
    operator_technology_band_ids = Group_Feature_Module.find(:all,
                              :select =>"gfcotb.operator_technology_band_id",
                              :from => "Group_Feature_Module gfm ",
                              :joins => "inner join Group_Feature_Country_Operator_Technology_band gfcotb on 
                                         gfm.group_id = gfcotb.group_id AND gfm.feature_id = gfcotb.feature_id",
                              :conditions => "gfm.group_id in 
                              (#{groups_ids.join(',')}) AND gfcotb.country_region_id = #{project.country_region_id} AND gfm.feature_id = #{params[:selected_feature]}")
    
    
    supported_bands_ids = OperatorTechnologyBand.find(:all, 
                                  :select =>"op_tech_bands.band_id",
                                  :from => "operator_technology_bands op_tech_bands ",
                                  :conditions => "id in (#{operator_technology_band_ids.join(',')})")
    
    supproted_hw_modules_ids = BandModuleSpec.find(:all,
                                     :select => "bms.hw_module_id",
                                     :from => "Band_Module_Spec bms",
                                     :conditions  => "bms.band_id in (#{supported_bands_ids.join(',')})") 
    
    @ru_types = Element.find(:all,
                             :select => "DISTINCT(e.id), e.element_variant_id, e.element_type, e.manufacture, e.ident_num, e.layout_image_url, e.schematic_image_url, e.description, e.name",
                             :from => "elements e",
                             :joins => "inner join hw_modules hw on e.id = hw.element_id",
                             :conditions => "element_variant_id in (#{ids.join(',')}) AND hw.id in (#{supproted_hw_modules_ids.join(',')})")                                 
   

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.