Advertisement
Guest User

Untitled

a guest
May 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.55 KB | None | 0 0
  1. [2] pry(main)> first_post = Post.first
  2. Post Load (0.2ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
  3. => #<Post:0x00000004cf8f38 id: 1, title: "First Post", body: "This is the first post in our system", created_at: Thu, 26 May 2016 00:58:20 UTC +00:00, updated_at: Thu, 26 May 2016 00:58:20 UTC +00:00>
  4. [3] pry(main)> p first_post
  5. #<Post id: 1, title: "First Post", body: "This is the first post in our system", created_at: "2016-05-26 00:58:20", updated_at: "2016-05-26 00:58:20">
  6. => #<Post:0x00000004cf8f38 id: 1, title: "First Post", body: "This is the first post in our system", created_at: Thu, 26 May 2016 00:58:20 UTC +00:00, updated_at: Thu, 26 May 2016 00:58:20 UTC +00:00>
  7. [4] pry(main)> cd Post.first
  8. Post Load (0.3ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
  9. [5] pry(#<Post>):1> self.methods.sort
  10. => [:!,
  11. :!=,
  12. :!~,
  13. :<=>,
  14. :==,
  15. :===,
  16. :=~,
  17. :[],
  18. :[]=,
  19. :__binding__,
  20. :__id__,
  21. :__pry__,
  22. :__send__,
  23. :_commit_callbacks,
  24. :_commit_callbacks=,
  25. :_commit_callbacks?,
  26. :_create_callbacks,
  27. :_create_callbacks=,
  28. :_create_callbacks?,
  29. :_destroy,
  30. :_destroy_callbacks,
  31. :_destroy_callbacks=,
  32. :_destroy_callbacks?,
  33. :_find_callbacks,
  34. :_find_callbacks=,
  35. :_find_callbacks?,
  36. :_initialize_callbacks,
  37. :_initialize_callbacks=,
  38. :_initialize_callbacks?,
  39. :_read_attribute,
  40. :_reflections,
  41. :_reflections=,
  42. :_reflections?,
  43. :_rollback_callbacks,
  44. :_rollback_callbacks=,
  45. :_rollback_callbacks?,
  46. :_run_commit_callbacks,
  47. :_run_create_callbacks,
  48. :_run_destroy_callbacks,
  49. :_run_find_callbacks,
  50. :_run_initialize_callbacks,
  51. :_run_rollback_callbacks,
  52. :_run_save_callbacks,
  53. :_run_touch_callbacks,
  54. :_run_update_callbacks,
  55. :_run_validate_callbacks,
  56. :_run_validation_callbacks,
  57. :_save_callbacks,
  58. :_save_callbacks=,
  59. :_save_callbacks?,
  60. :_touch_callbacks,
  61. :_touch_callbacks=,
  62. :_touch_callbacks?,
  63. :_update_callbacks,
  64. :_update_callbacks=,
  65. :_update_callbacks?,
  66. :_validate_callbacks,
  67. :_validate_callbacks=,
  68. :_validate_callbacks?,
  69. :_validation_callbacks,
  70. :_validation_callbacks=,
  71. :_validation_callbacks?,
  72. :_validators,
  73. :_validators=,
  74. :_validators?,
  75. :`,
  76. :acts_like?,
  77. :actually_destroyed?,
  78. :add_to_transaction,
  79. :after_add_for_comments,
  80. :after_add_for_comments=,
  81. :after_add_for_comments?,
  82. :after_remove_for_comments,
  83. :after_remove_for_comments=,
  84. :after_remove_for_comments?,
  85. :aggregate_reflections,
  86. :aggregate_reflections=,
  87. :aggregate_reflections?,
  88. :arel_attributes_with_values_for_create,
  89. :arel_attributes_with_values_for_update,
  90. :as_json,
  91. :assign_attributes,
  92. :association,
  93. :association_cache,
  94. :attribute_aliases,
  95. :attribute_aliases?,
  96. :attribute_changed?,
  97. :attribute_changed_in_place?,
  98. :attribute_for_inspect,
  99. :attribute_method?,
  100. :attribute_method_matchers,
  101. :attribute_method_matchers?,
  102. :attribute_missing,
  103. :attribute_names,
  104. :attribute_present?,
  105. :attribute_was,
  106. :attributes,
  107. :attributes=,
  108. :attributes_before_type_cast,
  109. :attributes_changed_by_setter,
  110. :autosave_associated_records_for_comments,
  111. :becomes,
  112. :becomes!,
  113. :before_add_for_comments,
  114. :before_add_for_comments=,
  115. :before_add_for_comments?,
  116. :before_remove_for_comments,
  117. :before_remove_for_comments=,
  118. :before_remove_for_comments?,
  119. :blank?,
  120. :body,
  121. :body=,
  122. :body?,
  123. :body_before_type_cast,
  124. :body_came_from_user?,
  125. :body_change,
  126. :body_changed?,
  127. :body_was,
  128. :body_will_change!,
  129. :cache_key,
  130. :cache_timestamp_format,
  131. :cache_timestamp_format?,
  132. :capture,
  133. :changed,
  134. :changed?,
  135. :changed_attributes,
  136. :changed_for_autosave?,
  137. :changes,
  138. :changes_applied,
  139. :class,
  140. :class_eval,
  141. :clear_aggregation_cache,
  142. :clear_association_cache,
  143. :clear_changes_information,
  144. :clear_destroy_state,
  145. :clear_transaction_record_state,
  146. :clone,
  147. :clone_attribute_value,
  148. :column_for_attribute,
  149. :comment_ids,
  150. :comment_ids=,
  151. :comments,
  152. :comments=,
  153. :committed!,
  154. :concern,
  155. :connection_handler,
  156. :created_at,
  157. :created_at=,
  158. :created_at?,
  159. :created_at_before_type_cast,
  160. :created_at_came_from_user?,
  161. :created_at_change,
  162. :created_at_changed?,
  163. :created_at_was,
  164. :created_at_will_change!,
  165. :decrement,
  166. :decrement!,
  167. :deep_dup,
  168. :default_connection_handler,
  169. :default_connection_handler?,
  170. :default_scopes,
  171. :default_timezone,
  172. :define_singleton_method,
  173. :defined_enums,
  174. :defined_enums=,
  175. :defined_enums?,
  176. :delete,
  177. :destroy,
  178. :destroy!,
  179. :destroyed?,
  180. :destroyed_by_association,
  181. :destroyed_by_association=,
  182. :display,
  183. :dump_schema_after_migration,
  184. :dup,
  185. :duplicable?,
  186. :enable_warnings,
  187. :encode_with,
  188. :enum_for,
  189. :eql?,
  190. :equal?,
  191. :errors,
  192. :extend,
  193. :find_by_statement_cache,
  194. :find_by_statement_cache=,
  195. :find_by_statement_cache?,
  196. :force_clear_transaction_record_state,
  197. :freeze,
  198. :from_json,
  199. :from_xml,
  200. :frozen?,
  201. :gem,
  202. :has_attribute?,
  203. :hash,
  204. :html_safe?,
  205. :id,
  206. :id=,
  207. :id?,
  208. :id_before_type_cast,
  209. :id_came_from_user?,
  210. :id_change,
  211. :id_changed?,
  212. :id_was,
  213. :id_will_change!,
  214. :in?,
  215. :include_root_in_json,
  216. :include_root_in_json=,
  217. :include_root_in_json?,
  218. :increment,
  219. :increment!,
  220. :init_with,
  221. :initialize_internals_callback,
  222. :inspect,
  223. :instance_eval,
  224. :instance_exec,
  225. :instance_of?,
  226. :instance_values,
  227. :instance_variable_defined?,
  228. :instance_variable_get,
  229. :instance_variable_names,
  230. :instance_variable_set,
  231. :instance_variables,
  232. :invalid?,
  233. :is_a?,
  234. :itself,
  235. :kind_of?,
  236. :load_dependency,
  237. :lock!,
  238. :lock_optimistically,
  239. :lock_optimistically?,
  240. :locking_enabled?,
  241. :logger,
  242. :mark_for_destruction,
  243. :marked_for_destruction?,
  244. :method,
  245. :method_missing,
  246. :methods,
  247. :model_name,
  248. :nested_attributes_options,
  249. :nested_attributes_options?,
  250. :new_record?,
  251. :nil?,
  252. :no_touching?,
  253. :object_id,
  254. :partial_writes,
  255. :partial_writes?,
  256. :perform_validations,
  257. :persistable_attribute_names,
  258. :persisted?,
  259. :pluralize_table_names,
  260. :pluralize_table_names?,
  261. :populate_with_current_scope_attributes,
  262. :presence,
  263. :presence_in,
  264. :present?,
  265. :pretty_inspect,
  266. :pretty_print,
  267. :pretty_print_cycle,
  268. :pretty_print_inspect,
  269. :pretty_print_instance_variables,
  270. :previous_changes,
  271. :primary_key_prefix_type,
  272. :private_methods,
  273. :protected_methods,
  274. :pry,
  275. :psych_to_yaml,
  276. :public_method,
  277. :public_methods,
  278. :public_send,
  279. :query_attribute,
  280. :quietly,
  281. :quoted_id,
  282. :raise_in_transactional_callbacks,
  283. :raise_record_invalid,
  284. :read_attribute,
  285. :read_attribute_before_type_cast,
  286. :read_attribute_for_serialization,
  287. :read_attribute_for_validation,
  288. :read_store_attribute,
  289. :readonly!,
  290. :readonly?,
  291. :record_timestamps,
  292. :record_timestamps=,
  293. :record_timestamps?,
  294. :reload,
  295. :remember_transaction_record_state,
  296. :remove_instance_variable,
  297. :require_dependency,
  298. :require_or_load,
  299. :reset_body!,
  300. :reset_created_at!,
  301. :reset_id!,
  302. :reset_title!,
  303. :reset_updated_at!,
  304. :respond_to?,
  305. :respond_to_without_attributes?,
  306. :restore_attributes,
  307. :restore_body!,
  308. :restore_created_at!,
  309. :restore_id!,
  310. :restore_title!,
  311. :restore_transaction_record_state,
  312. :restore_updated_at!,
  313. :rollback_active_record_state!,
  314. :rolledback!,
  315. :run_callbacks,
  316. :run_validations!,
  317. :sanitize_for_mass_assignment,
  318. :sanitize_forbidden_attributes,
  319. :save,
  320. :save!,
  321. :schema_format,
  322. :send,
  323. :serializable_hash,
  324. :silence,
  325. :silence_stderr,
  326. :silence_stream,
  327. :silence_warnings,
  328. :singleton_class,
  329. :singleton_method,
  330. :singleton_methods,
  331. :skip_time_zone_conversion_for_attributes,
  332. :skip_time_zone_conversion_for_attributes?,
  333. :slice,
  334. :store_full_sti_class,
  335. :store_full_sti_class?,
  336. :suppress,
  337. :suppress_warnings,
  338. :table_name_prefix,
  339. :table_name_prefix?,
  340. :table_name_suffix,
  341. :table_name_suffix?,
  342. :taint,
  343. :tainted?,
  344. :tap,
  345. :time_zone_aware_attributes,
  346. :timestamped_migrations,
  347. :title,
  348. :title=,
  349. :title?,
  350. :title_before_type_cast,
  351. :title_came_from_user?,
  352. :title_change,
  353. :title_changed?,
  354. :title_was,
  355. :title_will_change!,
  356. :to_enum,
  357. :to_gid,
  358. :to_gid_param,
  359. :to_global_id,
  360. :to_json,
  361. :to_json_with_active_support_encoder,
  362. :to_json_without_active_support_encoder,
  363. :to_key,
  364. :to_model,
  365. :to_param,
  366. :to_partial_path,
  367. :to_query,
  368. :to_s,
  369. :to_sgid,
  370. :to_sgid_param,
  371. :to_signed_global_id,
  372. :to_xml,
  373. :to_yaml,
  374. :to_xml,
  375. :to_yaml,
  376. :to_yaml_properties,
  377. :toggle,
  378. :toggle!,
  379. :touch,
  380. :transaction,
  381. :transaction_include_any_action?,
  382. :transaction_record_state,
  383. :trust,
  384. :try,
  385. :try!,
  386. :type_for_attribute,
  387. :unloadable,
  388. :untaint,
  389. :untrust,
  390. :untrusted?,
  391. :update,
  392. :update!,
  393. :update_attribute,
  394. :update_attributes,
  395. :update_attributes!,
  396. :update_column,
  397. :update_columns,
  398. :updated_at,
  399. :updated_at=,
  400. :updated_at?,
  401. :updated_at_before_type_cast,
  402. :updated_at_came_from_user?,
  403. :updated_at_change,
  404. :updated_at_changed?,
  405. :updated_at_was,
  406. :updated_at_will_change!,
  407. :valid?,
  408. :validate,
  409. :validate!,
  410. :validate_associated_records_for_comments,
  411. :validates_absence_of,
  412. :validates_acceptance_of,
  413. :validates_confirmation_of,
  414. :validates_exclusion_of,
  415. :validates_format_of,
  416. :validates_inclusion_of,
  417. :validates_length_of,
  418. :validates_numericality_of,
  419. :validates_presence_of,
  420. :validates_size_of,
  421. :validates_with,
  422. :validation_context,
  423. :validation_context=,
  424. :with_lock,
  425. :with_options,
  426. :with_transaction_returning_status,
  427. :with_warnings,
  428. :write_store_attribute]
  429. [6] pry(#<Post>):1> nesting
  430. Nesting status:
  431. --
  432. 0. main (Pry top level)
  433. 1. #<Post>
  434. [7] pry(#<Post>):1> self.title = "First Post Title"
  435. => "First Post Title"
  436. [8] pry(#<Post>):1> self.body = "First Post Body"
  437. => "First Post Body"
  438. [9] pry(#<Post>):1> save!
  439. (0.1ms) begin transaction
  440. SQL (2.2ms) UPDATE "posts" SET "title" = ?, "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "First Post Title"], ["body", "First Post Body"], ["updated_at", "2016-05-26 23:05:22.184535"], ["id", 1]]
  441. (120.2ms) commit transaction
  442. => true
  443. [10] pry(#<Post>):1> self
  444. => #<Post:0x00000004bb76b0 id: 1, title: "First Post Title", body: "First Post Body", created_at: Thu, 26 May 2016 00:58:20 UTC +00:00, updated_at: Thu, 26 May 2016 23:05:22 UTC +00:00>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement