tispratik / bs

BS
1 stars 0 forks source link

Sergey - question ... why does before_filter :find_project work in calendar_controller? #42

Closed TheHumaneClub closed 14 years ago

svarks commented 14 years ago

but heres no this filter.. not sure i understand

TheHumaneClub commented 14 years ago

This is what I want to do in EventsController => Index method

if @calendarable.is_a?(User) @project = nil else @project = find_project end

However find_project is nil. How do we get project in this method?

svarks commented 14 years ago

you already have it here

def find_calendarable
  if params[:project_id]
    find_project
    @calendarable = @project
  elsif params[:user_id]
    @calendarable = @user = User.find_by_username(params[:user_id])
  else
    @calendarable = @user = current_user
  end
end
TheHumaneClub commented 14 years ago

rt. thanks