You know what method is being and you want to figure out how it got there. Raising an exception is a bit harsh since all you want is a stack trace
puts caller
Seriously. It's that easy. If you're getting too much information you could
| # When calling a method with a splat then the parameters are passed as a comma separated list | |
| # When receiving arguments with a splat then they are converted into an Array | |
| # When using a double splat (2.0+) then the argument is converted into a Hash (i.e. named parameters) | |
| def foo(*args) | |
| p args | |
| end | |
| foo 'a', 'b', 'c' | |
| # => ["a", "b", "c"] |
You know what method is being and you want to figure out how it got there. Raising an exception is a bit harsh since all you want is a stack trace
puts caller
Seriously. It's that easy. If you're getting too much information you could
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
| class Avatar < ActiveRecord::Base | |
| attr_accessor :content_type, :original_filename, :image_data | |
| before_save :decode_base64_image | |
| has_attached_file :image, | |
| PAPERCLIP_CONFIG.merge( | |
| :styles => { | |
| :thumb => '32x32#', | |
| :medium => '64x64#', |