Advertisement
gennady_novoselov

RoR_0

Nov 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.39 KB | None | 0 0
  1.  class MyController < ApplicationController
  2.       def options
  3.         options = {}
  4.         available_option_keys = [:first_option, :second_option, :third_option]
  5.         all_keys = params.keys.map(&:to_sym)
  6.         set_option_keys = all_keys & available_option_keys
  7.         set_option_keys.each do |key|
  8.           options[key] = params[key]
  9.         end
  10.         options
  11.       end
  12.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement