Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEEDS TO BE IN RUBY. Using Cloud 9. Trying to do the RottenPotatoes. Basically follow along with this link that provides all the documentation: https://github.com/saasbook/rottenpotatoes-rails-intro

NEEDS TO BE IN RUBY. Using Cloud 9. Trying to do the RottenPotatoes. Basically follow along with this link that provides all the documentation:

https://github.com/saasbook/rottenpotatoes-rails-intro

USING THAT LINK, the Homework requirements are:

On the list of all movies page, make the column headings for "Movie Title" and "Release Date" into clickable links. Clicking one of them should cause the list to be reloaded but sorted in ascending order on that column. For example, clicking the "release date" column heading should redisplay the list of movies with the earliest-released movies first; clicking the "title" header should list the movies alphabetically by title. (For movies whose names begin with non-letters, the sort order should match the behavior of String#<=>.)

When the listing page is redisplayed with sorting-on-a-column enabled, the column header that was selected for sorting should appear with a yellow background, as shown below. You should do this by setting controller variables that are used to conditionally set the CSS class of the appropriate table heading to hilite.

GIVEN:

table#movies th.hilite { background-color: yellow; } 

which was placed inside one of our files. We do not have to access anything else in their for this problem, except for that code that was given.

We were also given:

class MoviesController < ApplicationController def movie_params params.require(:movie).permit(:title, :rating, :description, :release_date) end

def show id = params[:id] # retrieve movie ID from URI route @movie = Movie.find(id) # look up movie by unique ID # will render app/views/movies/show. by default end

def index @movies = Movie.all #find([1,3]) - this finds the movies based on their id number end

def new # default: render 'new' template end

def create @movie = Movie.create!(movie_params) flash[:notice] = "#{@movie.title} was successfully created." redirect_to movies_path end #flash keeps track of particular information #params, sessions not hashes

def edit @movie = Movie.find params[:id] end

def update @movie = Movie.find params[:id] @movie.update_attributes!(movie_params) flash[:notice] = "#{@movie.title} was successfully updated." redirect_to movie_path(@movie) end

def destroy @movie = Movie.find(params[:id]) @movie.destroy flash[:notice] = "Movie '#{@movie.title}' deleted." redirect_to movies_path end end

INSIDE OF def index is where we are supposed to place a sort method that sorts the list each time you click on either movie title or release date. Then, the column you click on, needs to become highlighted. Need help to do this. Please and thank you. Please specify which files you are needing to work in. Thank you.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

The Nature of Nonverbal Communication

Answered: 1 week ago

Question

Functions of Nonverbal Communication

Answered: 1 week ago

Question

Nonverbal Communication Codes

Answered: 1 week ago