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
#initialize(user:, topic:) ⇒ EditTopicForm
Returns a new instance of EditTopicForm.
13 14 15 16 |
# File 'app/forms/thredded/edit_topic_form.rb', line 13 def initialize(user:, topic:) @user = user @topic = topic end |
Class Method Details
Instance Method Details
#category_options ⇒ Object
22 23 24 |
# File 'app/forms/thredded/edit_topic_form.rb', line 22 def @topic..categories.map { |cat| [cat.name, cat.id] } end |
#edit_path ⇒ Object
44 45 46 |
# File 'app/forms/thredded/edit_topic_form.rb', line 44 def edit_path Thredded::UrlsHelper.(@topic., @topic) end |
#messageboard_options ⇒ Object
26 27 28 |
# File 'app/forms/thredded/edit_topic_form.rb', line 26 def @user..map { || [.name, .id] } end |
#messageboard_path ⇒ Object
48 49 50 |
# File 'app/forms/thredded/edit_topic_form.rb', line 48 def Thredded::UrlsHelper.(@topic.) end |
#path ⇒ Object
40 41 42 |
# File 'app/forms/thredded/edit_topic_form.rb', line 40 def path Thredded::UrlsHelper.(@topic., @topic) end |
#persisted? ⇒ Boolean
36 37 38 |
# File 'app/forms/thredded/edit_topic_form.rb', line 36 def persisted? true end |
#save ⇒ Object
30 31 32 33 34 |
# File 'app/forms/thredded/edit_topic_form.rb', line 30 def save return false unless valid? @topic.save! true end |