Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Advanced Social Features in Ruby on Rails Activity Feeds Controllers, Parameters and Methods

Create the params hash if it doesn't exist.

???

albums_controller.rb
class AlbumsController < ApplicationController

  def index
    params.new(:status) if params[:status].nil?
  end

end

3 Answers

Challenge Link:

http://teamtreehouse.com/library/programming/advanced-social-features-in-ruby-on-rails/activity-feeds/controllers-parameters-and-methods

The second part of the same challenge:

Challenge Task 2 of 2

Assign the @activities variable to a call of Activity.for_user(current_user) and send in the params.

class AlbumsController < ApplicationController

  def index
    # Write your code here.
    params[:page] ||= 1
    @activities = Activity.for_user(current_user, params)
  end

end

I found the needed second line of code on this Github page:

https://github.com/Rockstage/treebook/blob/master/app/controllers/activities_controller.rb

:stuck_out_tongue:

I don't know what I have to do in this exercise ?

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Around 3:36 you will get a hint. Something like params[:page] ||= 1