* Add response templates controller, routes, and view * Add response templates settings page * Remove dead code * Use proper variable oops * Use proper indentation * Use before action for checking current_user * Remove index action temporarily * Use url helpers for redirects * Use form_with over form_tag and form_for * Persist previous content if edit fails * Use exists for performance * Remove index spec and add CRUD specs * Memoize @response_template * Use workaround for sad paths b/c render doesn't work * Refactor and extract permitted_attributes into var * Use present over exists to preload into memory * Use last over first * Lint for codeclimate * Use two redirects for happy and sad create path * Remove proper index route oops * Codeclimate comma sigh
8 lines
325 B
Ruby
8 lines
325 B
Ruby
json.array!(@response_templates) do |response_template|
|
|
json.id response_template.id
|
|
json.type_of response_template.type_of
|
|
json.user_id response_template.user_id
|
|
json.title response_template.title
|
|
json.content response_template.content
|
|
json.content_truncated truncate(response_template.content, length: 200)
|
|
end
|