Yu-Chieh’s Blog (Y.C. Chang)

Ruby on Rails / Rubygems / FullStack / Git / Mac notes.

How to Use All View and Helper Methods in Rails Console

run and preview a view helper

1
2
3
> YourController.helpers.my_helper

> ApplicationController.helpers.content_tag(:div, "Hello World!")

create params in rails console

1
2
3
4
5
6
7
8
# ActionController::Parameters.new
params = ActionController::Parameters.new({
  person: {
    name: 'Francesco',
    age:  22,
    role: 'admin'
  }
})

Comments