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

  • Home
  • SEARCH
  • 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 6220847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:01:49+00:00 2026-05-24T08:01:49+00:00

This is a preference question I’m sure. EDIT Recently, I’ve noticed this code in

  • 0

This is a preference question I’m sure.

EDIT
Recently, I’ve noticed this code in a few public examples of VIEW code:

f.collection_select :my_method, AddressTypes.all, :name, :name

or

f.select :my_method, ['Option 1', 'Option 2', 'Option 3']

instead of …

class MyController < ApplicationController

  def new
    @address_types = AddressTypes.all
  end

end

Obviously, in the view:

f.collection_select :my_method, @address_types, :name, :name

Is this just personal preference? Or is there another reason, of which I am not aware?

  • 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-05-24T08:01:51+00:00Added an answer on May 24, 2026 at 8:01 am

    While I think it comes down to personal preference, even the Rails guides use Model.all right in the view rather than pulling that back to the controller.

    My preference is that as soon as I’m doing anything more than Model.all, maybe a Model.where(:foo => "bar") or something, the query should be abstracted back to the controller, or preferably the model. The view shouldn’t be responsible for your model/data’s logic, it should just be concerned with presenting it.

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

Sidebar

Related Questions

EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying
This is more a question of style and preference but here goes: when should
edit typos Hi, This is possibly a moronic question, but if it helps me
This question is similar in spirit to : https://stackoverflow.com/questions/492178/links-between-personality-types-and-language-technology-preferences But it is based specifically
This may be a question about convention, best practices and/or personal preferences: So I'm
This is in reference to a question I asked earlier. Aside from viewing the
This is in reference to the question previously asked The problem here is, each
I'm writing this question with reference to this one which I wrote yesterday. After
This is in reference to my other question Auto Clearing Textbox . If I
This is with reference to the below question: Execute program from within a C

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.