Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8402299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:01:11+00:00 2026-06-09T22:01:11+00:00

I have following code in my view: # panel.html.erb <% if content.content_type == image

  • 0

I have following code in my view:

# panel.html.erb
<% if content.content_type == "image" && content.content_image_url =~ URI::ABS_URI %>
  <%= image_tag content.content_image.pinboard_thumb %>
<% elsif content.content_image? == false && content.content_value =~ URI::ABS_URI %>
  <%= image_tag content.content_value %>
<% else %>
  <%= auto_link content.content_value %>
<% end %>

I`m thinking where should I move this logic from if else block. How to do that Rails Way. Move that to helper??

Or is better way? Code below isn`t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:01:12+00:00Added an answer on June 9, 2026 at 10:01 pm

    Yes, a helper is the right place as the code seems to be about rendering only. So there is no business logic there. If you see yourself putting a lot of stuff like this into helpers, you could have a look at http://github.com/jcasimir/draper which is a gem that implements the presenter pattern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in my view located in \app\views\deployment_group named make_deployment_group.html.erb <%=
I have the following code in a view: <div class=wrap_select> @Html.DropDownList(dateRange, new SelectList(Model.DateRange, Value,Text),
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have the following code- View- <% Html.BeginForm(); %> <div> <%= Html.DropDownList(DropDownSelectList, new SelectList(
I have following code in my MVC2 view: <tr class=edit style=display:none> <td> <%= Html.DropDownList(drpFields,
I have the following code to view a remotely hosted video file: startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(article.getLink())));
I have following line code in my view: <td> Model.some_instance_method(args) </td> I would like
I have the following code in my view: <%= form_for :command_selected, :method => get,
I have the following code in my view .fields = f.label :minimum_mpg %br =
I have the following code in a view to get some of the information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.