Render a file

Im trying render a file 404 from public folder Is possible to render a
file from ruby code i have a separate code in the lib file.i got a
error like undefined method `render’ for AdminController:Class

On Aug 20, 5:09 am, mahesh [email protected] wrote:

Im trying render a file 404 from public folder Is possible to render a
file from ruby code i have a separate code in the lib file.i got a
error like undefined method `render’ for AdminController:Class

Well other than saying that you are calling render from somewhere that
you shouldn’t there’s not a lot more to be said without seeing what
you have done.

Fred

ok This my module which in lib folder
module Rakelimit
def self.included(controller)

    controller.extend(ClassMethods)

   end

   module ClassMethods

    def acts_as_rakelimit
         ip = request.remote_ip
        puts ip = local_ip
       minute= (Time.now.to_i / 60).to_i
        checks = Ipcheck.find(:first, :conditions =>[ "ipaddress = ?

and time_min =?", ip,minute] )
puts checks.inspect
if checks == nil

Ipcheck.create!(:ipaddress=>ip,:time_min=>minute,:ip_count=>1)
else
checks.increment(:ip_count,1).save
if checks.ip_count >3

                render_404

       end
        end
    end

     def render_404
           render :file =>"#{RAILS_ROOT}/public/404.html", :status 

=>
“404 Not Found”

         return false
     end

it’s for susbend the process when the person trying more then 3 time if
it
increased more then 3 then i would like render 404 error

On Thu, Aug 20, 2009 at 1:28 PM, Frederick C. <

ok what will be the solution for me

On Thu, Aug 20, 2009 at 2:01 PM, Frederick C. <

On Aug 20, 9:26 am, mahesh s [email protected] wrote:

     def render_404
           render :file =>"#{RAILS_ROOT}/public/404.html", :status =>

“404 Not Found”

         return false
     end

it’s for susbend the process when the person trying more then 3 time if it
increased more then 3 then i would like render 404 error

These shouldn’t be class methods. This is all about dealing with an
individual request, which only makes sense in the context of an
instance method

Fred