You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have published news and archived news (thanks for archive widget). Sometimes you need to read archived news too. But you can not use controller show action like:
link_to item.title, refinery.news_item_path(item)
This will not work and also will crash the application.
In the controller, there is:
def find_news_item @item = Item.published.translated.find(params[:id])
end
Because of published scope find method will crash the app. Notice that find_by_id might not.
Proposition of change:
def find_news_item @item = Item.translated.find(params[:id])
end
You can not use any decorator for this case because of
before_filter :find_news_item
will be always called
I had to override the whole controller to see one archived news.
Is there anather way, shorter way?
If not then I can make a pull request but this is 1 line change.
The text was updated successfully, but these errors were encountered:
I just ran into this issue as well, and I view this as a bug.
There is a method in the controller find_published_news_items which finds published news items for the index view. If the news archive view includes a link to the full archived news article, then those links should actually work without throwing a 404 or crashing the app. There's no reason to use the published scope in the find_news_item method.
We have published news and archived news (thanks for archive widget). Sometimes you need to read archived news too. But you can not use controller show action like:
link_to item.title, refinery.news_item_path(item)
This will not work and also will crash the application.
In the controller, there is:
def find_news_item
@item = Item.published.translated.find(params[:id])
end
Because of published scope find method will crash the app. Notice that find_by_id might not.
Proposition of change:
def find_news_item
@item = Item.translated.find(params[:id])
end
You can not use any decorator for this case because of
before_filter :find_news_item
will be always called
I had to override the whole controller to see one archived news.
Is there anather way, shorter way?
If not then I can make a pull request but this is 1 line change.
The text was updated successfully, but these errors were encountered: