Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread edit: not possible to add a topic #61

Closed
numeroteca opened this issue Nov 29, 2012 · 2 comments
Closed

Thread edit: not possible to add a topic #61

numeroteca opened this issue Nov 29, 2012 · 2 comments

Comments

@numeroteca
Copy link
Member

It is not possible to add a topic. When editing a topic it is only possible to edit them. Related to https://github.com/numeroteca/PageOneX-ruby/issues/62

@ghost ghost assigned numeroteca Mar 19, 2013
@numeroteca
Copy link
Member Author

At threads_controller.rb the new codes/topic created in the edit view don't get saved. What else should I use instead of "update_attributes"?

In the update method:

#it should iterate through the recently created codes
@thread.codes.to_enum.with_index.each do |code,index|
                if params["topic_deleted_#{index}"] == '1'
                    code.destroy()
                else #To Do: it should save the new codes created
                    code.update_attributes({code_text: params["topic_name_#{index}"], color: params["topic_color_#{index}"], code_description: params["topic_description_#{index}"]})
                end
            end

besides "params[:topic_count].to_i" was not working and I used "@thread.codes.length" in the update method.

@elplatt
Copy link
Collaborator

elplatt commented Mar 19, 2013

@thread.codes will only contain previously created codes, so you'll want to update the code to loop over params instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants