-
Notifications
You must be signed in to change notification settings - Fork 4
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
Finished CRUD for Article #5
Conversation
hardikupadhyay16
commented
Sep 21, 2016
- Created CRUD for article
- changed column type for long description in article model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make changes to code structure
@@ -0,0 +1,2 @@ | |||
json.extract! article, :id, :created_at, :updated_at | |||
json.url article_url(article, format: :json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need Space Here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hardikupadhyay16 @uzaif313 I think we don't need this at all...
@@ -0,0 +1 @@ | |||
json.array! @articles, partial: 'articles/article', as: :article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space here at the end of file
@@ -0,0 +1 @@ | |||
json.partial! "articles/article", article: @article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space here at the end of file
@article = current_user.articles.build(article_params) | ||
respond_to do |format| | ||
if @article.save | ||
if params[:images].present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uzaif313 can you please extract this code to new private method i.e. save_image(image_param) ?
respond_to do |format| | ||
if @article.update(article_params) | ||
if params[:images].present? | ||
@article.pictures.destroy_all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uzaif313 same here..
@uzaif313 @hardikupadhyay16 @chaudharyprakash Do we need view template any more ?? |
@hardikupadhyay16 @uzaif313 @chaudharyprakash also resolve this issue within this branch only.. |
this branch is for web not for API |
Done |