Skip to content

Instantly share code, notes, and snippets.

@bmsolutions
Created February 4, 2011 17:23
Show Gist options
  • Save bmsolutions/811409 to your computer and use it in GitHub Desktop.
Save bmsolutions/811409 to your computer and use it in GitHub Desktop.
return false from filter
class ProfilesController < ApplicationController
before_filter :set_current_account
def index
@hours = BusinessHour.find_hours_for_id(@business.id)
@services = Service.find_services_for_business(@business.id)
@staffs = Staff.find_staff_for_business(@business.id)
respond_to do |format|
format.js
format.html
end
end
end
class ApplicationController < ActionController::Base
...
def set_current_account
Rails.logger.debug { "set_current_account" }
@business = Business.where( "lower(business_name) = ?", current_subdomain.downcase ).first
Rails.logger.debug { "@business: " + @business.nil?.to_s }
render_404 if @business.nil?
end
...
end
@bmsolutions
Copy link
Author

class ProfilesController < ApplicationController

before_filter :set_current_account

def index
@Hours = BusinessHour.find_hours_for_id(@business.id)
@services = Service.find_services_for_business(@business.id)
@staffs = Staff.find_staff_for_business(@business.id)

respond_to do |format|
    format.js
    format.html
end

end

end

class ApplicationController < ActionController::Base

...

def set_current_account
Rails.logger.debug { "set_current_account" }
@business = Business.where( "lower(business_name) = ?", current_subdomain.downcase ).first
Rails.logger.debug { "@business: " + @business.nil?.to_s }
render_404 && return false if @business.nil?
end

...
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment