Class: Thredded::EditTopicForm
- Inherits:
-
Object
- Object
- Thredded::EditTopicForm
- Includes:
- ActiveModel::Model
- Defined in:
- app/forms/thredded/edit_topic_form.rb
Class Method Summary collapse
Instance Method Summary collapse
- #category_options ⇒ Object
- #edit_path ⇒ Object
-
#initialize(user:, topic:) ⇒ EditTopicForm
constructor
A new instance of EditTopicForm.
- #messageboard_options ⇒ Object
- #messageboard_path ⇒ Object
- #path ⇒ Object
- #persisted? ⇒ Boolean
- #save ⇒ Object
Constructor Details
permalink #initialize(user:, topic:) ⇒ EditTopicForm
Returns a new instance of EditTopicForm.
12 13 14 15 |
# File 'app/forms/thredded/edit_topic_form.rb', line 12 def initialize(user:, topic:) @user = user @topic = topic end |
Class Method Details
permalink .model_name ⇒ Object
[View source]
17 18 19 |
# File 'app/forms/thredded/edit_topic_form.rb', line 17 def self.model_name Thredded::Topic.model_name end |
Instance Method Details
permalink #category_options ⇒ Object
[View source]
21 22 23 |
# File 'app/forms/thredded/edit_topic_form.rb', line 21 def @topic..categories.map { |cat| [cat.name, cat.id] } end |
permalink #edit_path ⇒ Object
[View source]
43 44 45 |
# File 'app/forms/thredded/edit_topic_form.rb', line 43 def edit_path Thredded::UrlsHelper.(@topic., @topic) end |
permalink #messageboard_options ⇒ Object
[View source]
25 26 27 |
# File 'app/forms/thredded/edit_topic_form.rb', line 25 def @user..map { || [.name, .id] } end |
permalink #messageboard_path ⇒ Object
[View source]
47 48 49 |
# File 'app/forms/thredded/edit_topic_form.rb', line 47 def Thredded::UrlsHelper.(@topic.) end |
permalink #path ⇒ Object
[View source]
39 40 41 |
# File 'app/forms/thredded/edit_topic_form.rb', line 39 def path Thredded::UrlsHelper.(@topic., @topic) end |
permalink #persisted? ⇒ Boolean
35 36 37 |
# File 'app/forms/thredded/edit_topic_form.rb', line 35 def persisted? true end |
permalink #save ⇒ Object
[View source]
29 30 31 32 33 |
# File 'app/forms/thredded/edit_topic_form.rb', line 29 def save return false unless valid? @topic.save! true end |