Need to avoid SQL Injection in Rails3
问题 I need the following code to be rewritten by avoiding SQL Injection in Rails 3. some_table_name.joins("inner join #{table_name} on linked_config_items.linked_type = '#{class_name}' and linked_config_items.linked_id = #{table_name}.id"). where("#{table_name}.saved is true and #{table_name}.deleted_at is null") Here, table_name is dynamic and it will vary. 回答1: SQL identifiers like table names and column names cannot be replaced with bound parameters, which is the more common method to ensure