Reputation: 177
I'm trying to simply list the methods for a model. As you can see it returns something unexpected. I'm not sure exactly what I'm doing wrong.
[4] pry(Event):1> ls -m
Object.methods: yaml_tag
ActiveModel::Naming#methods: model_name
ActiveSupport::Benchmarkable#methods: benchmark
ActiveSupport::DescendantsTracker#methods: descendants direct_descendants
ActiveRecord::ConnectionHandling#methods: clear_cache! connection_id connection_id= mysql2_connection
ActiveRecord::QueryCache::ClassMethods#methods: cache uncached
ActiveRecord::Querying#methods:
any? distinct find_each forty_two last pluck take
average eager_load find_in_batches forty_two! last! preload take!
calculate except find_or_create_by fourth limit readonly third
count exists? find_or_create_by! fourth! lock references third!
count_by_sql fifth find_or_initialize_by from many? reorder uniq
create_with fifth! first group maximum rewhere unscope
delete find first! having minimum second update
delete_all find_by first_or_create ids none second! update_all
destroy find_by! first_or_create! includes offset select where
destroy_all find_by_sql first_or_initialize joins order sum
ActiveModel::Translation#methods: human_attribute_name
ActiveRecord::Translation#methods: i18n_scope lookup_ancestors
ActiveRecord::DynamicMatchers#methods: respond_to?
ActiveRecord::Explain#methods: collecting_queries_for_explain exec_explain
ActiveRecord::Enum#methods: enum
ActiveRecord::Delegation::DelegateCache#methods: initialize_relation_delegate_cache relation_delegate_class
ActiveRecord::Core::ClassMethods#methods: === arel_engine arel_table generated_association_methods inspect
ActiveRecord::Persistence::ClassMethods#methods: create instantiate
ActiveRecord::ReadonlyAttributes::ClassMethods#methods: attr_readonly readonly_attributes
ActiveRecord::ModelSchema::ClassMethods#methods:
column_names content_columns inheritance_column= reset_sequence_name table_exists?
column_types decorate_columns initialize_attributes reset_table_name table_name=
columns full_table_name_prefix quoted_table_name sequence_name
How do I show the methods for this specific model?
Upvotes: 1
Views: 314
Reputation: 34336
You can use ModelName
.methods
in pry
console which will give you all the methods for that Model
.
So, for you, it is:
ls Event.methods
For more similar commands, see here.
Upvotes: 2