Why do I get an error when trying to use a method in application_controller?

user4227507

In my Ruby on Rails application I have a cinema application and am trying to populate a drop down menu with films that have showing dates that are not in the past.

In my _form.html.erb I have this dropdown menu that is trying to use the live_films method:

<%= f.grouped_collection_select :showing_id, Film.order(:title).live_films, :showings, :title, :id,  :showing_times %>

The method is in application_controller:

helper_method :active_menu, :live_films 

def live_films 
    Film.includes(:showings).where.not(showings.show_date < Date.today)
end

I also suspect that my method wouldn't work so I welcome suggestions for getting it to function.

What am I doing wrong?

vee

You should be calling order on result of live_films method call as:

<%= f.grouped_collection_select :showing_id, live_films.order(:title), :showings, :title, :id,  :showing_times %>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Why do I get a BootstrapMethodError when trying to call a super class's protected method using method reference from an inner class?

From Dev

Why do I get this error when trying to map on a list of lists?

From Dev

Why I get error while trying to use LaTeX in plots' label

From Dev

Why do I get a compile error when calling start method?

From Dev

Why do I get an argument type mismatch when I use arguments with PowerMockito mocked static method?

From Dev

Why do I get an OpenSSL error when trying to connect to Apple Push Notification Service?

From Dev

Why do I get a None when trying to use a class function as element of a dict?

From Dev

Why do I get segmentation fault when trying to print an array?

From Dev

Why do I get an authorization error from Docker when I'm trying to pull a public image?

From Dev

Why do I get a "the location is not a folder" error when trying to open files using Dash or Synapse?

From Dev

Why do I get a BootstrapMethodError when trying to call a super class's protected method using method reference from an inner class?

From Dev

Why do I get an error when trying to give a lexer as input of CommonTokenStream in ANTLRv4

From Dev

Why do I get a "the location is not a folder" error when trying to open files using Dash or Synapse?

From Dev

Ruby RubyGems: Why do I always get error messages when trying to install gems?

From Dev

Why do I get a "indexed columns are not unique" error when trying to add a UNIQUE INDEX to a SQLite Table?

From Dev

Why do I get Hash Sum mismatch error when trying to install mono on debian

From Dev

Why do i get this error when trying to check if in Corona sdk?

From Dev

Why do I get an undefined variable error when trying to use PHP in two sections of a page?

From Dev

Why do I get TypeError when trying to do dot product?

From Dev

Why do I get an error when trying to sum values of a column retrieved in a ResultSet?

From Dev

Why do I get a PHP error 406 when trying to use file_get_contents() function and how to solve it?

From Dev

Why do I get error on flurry when trying to compile to release on Android?

From Dev

Why do I get error on ABS expression when trying to print band footer?

From Dev

Why do I get an undefined local variable or method error when using a constant, but not when using a method?

From Dev

error C4996: visual studio: why do I get an error when I use fopen in c?

From Dev

Why do I get "Could not push back" error when trying to use the IBM Bluemix Document Conversion service?

From Dev

Why do I get an error when running a method from a jsp page, but not from a main method?

From Dev

Why do I get an error for trying to access a builtin class method attribute but not the same builtin function attribute

From Dev

Why do i get a Overflow Exception when trying to run the same method with same parameters?

Related Related

  1. 1

    Why do I get a BootstrapMethodError when trying to call a super class's protected method using method reference from an inner class?

  2. 2

    Why do I get this error when trying to map on a list of lists?

  3. 3

    Why I get error while trying to use LaTeX in plots' label

  4. 4

    Why do I get a compile error when calling start method?

  5. 5

    Why do I get an argument type mismatch when I use arguments with PowerMockito mocked static method?

  6. 6

    Why do I get an OpenSSL error when trying to connect to Apple Push Notification Service?

  7. 7

    Why do I get a None when trying to use a class function as element of a dict?

  8. 8

    Why do I get segmentation fault when trying to print an array?

  9. 9

    Why do I get an authorization error from Docker when I'm trying to pull a public image?

  10. 10

    Why do I get a "the location is not a folder" error when trying to open files using Dash or Synapse?

  11. 11

    Why do I get a BootstrapMethodError when trying to call a super class's protected method using method reference from an inner class?

  12. 12

    Why do I get an error when trying to give a lexer as input of CommonTokenStream in ANTLRv4

  13. 13

    Why do I get a "the location is not a folder" error when trying to open files using Dash or Synapse?

  14. 14

    Ruby RubyGems: Why do I always get error messages when trying to install gems?

  15. 15

    Why do I get a "indexed columns are not unique" error when trying to add a UNIQUE INDEX to a SQLite Table?

  16. 16

    Why do I get Hash Sum mismatch error when trying to install mono on debian

  17. 17

    Why do i get this error when trying to check if in Corona sdk?

  18. 18

    Why do I get an undefined variable error when trying to use PHP in two sections of a page?

  19. 19

    Why do I get TypeError when trying to do dot product?

  20. 20

    Why do I get an error when trying to sum values of a column retrieved in a ResultSet?

  21. 21

    Why do I get a PHP error 406 when trying to use file_get_contents() function and how to solve it?

  22. 22

    Why do I get error on flurry when trying to compile to release on Android?

  23. 23

    Why do I get error on ABS expression when trying to print band footer?

  24. 24

    Why do I get an undefined local variable or method error when using a constant, but not when using a method?

  25. 25

    error C4996: visual studio: why do I get an error when I use fopen in c?

  26. 26

    Why do I get "Could not push back" error when trying to use the IBM Bluemix Document Conversion service?

  27. 27

    Why do I get an error when running a method from a jsp page, but not from a main method?

  28. 28

    Why do I get an error for trying to access a builtin class method attribute but not the same builtin function attribute

  29. 29

    Why do i get a Overflow Exception when trying to run the same method with same parameters?

HotTag

Archive