这是indexloc提供的服务,不要输入任何密码
Skip to content

Use the show action for archive news crashes the application #147

@szymon33

Description

@szymon33

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions