Displaying 4 results from an estimated 4 matches for "displaycontroller".
2006 Feb 16
10
Ruby class variables and access from view templates
I have an app that requires me to define a class variable (actually an
array) in a controller and then access it from within a view. It seems
that the class variables aren''t working right. Here is an example of
what I''m trying to do.
class DisplayController < ApplicationController
@@thumbnail_array = Array.new
...
def some_method
@@thumbnail_array = SomeModel.find_all
...
end
.....
end
Then in the view for some_method,
<% for thumb in @@thumbnail_array %>
...
do something interesting
But my app blows up at that point giving me an un...
2006 Feb 20
3
Rewriting with an after_filter
...omer/>", is
exactly the simple task I''m trying to accomplish, however I can''t find
how to do it.
I think what I want to do is gsub(/UserName/, ''Matthew''), however, I''m
clearly missing something. Here''s what I use:
<code>
class DisplayController < ApplicationController
after_filter :customerize
def show
@contentdivs = Contentdiv.thispage(params[:page])
end
def customerize
@contentdivs.gsub(/UserName/, ''Matthew'')
end
end
</code>
@contentdivs contains bits of html that show.rhtml nicely forma...
2007 Apr 09
2
Errno::EACCES in Controller / Permission denied
...l: Review
My only line of code added for ferret is:
class Review < ActiveRecord::Base
acts_as_ferret
...( more stuff not related )...
end
Below is the error information. Any thoughts on how to troubleshoot
this?
thanks,
Sean
==========================================
Errno::EACCES in DisplayController#index
Permission denied - /www/shelikes/index
RAILS_ROOT: /www/shelikes/public/../config/..
Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/1.8/fileutils.rb:243:in `mkdir''
/usr/local/lib/ruby/1.8/fileutils.rb:243:in `fu_mkdir''
/usr/local/lib/ruby/1.8/fileut...
2005 Nov 11
0
cache_page throwing "undefined method merge" error
rails (0.14.2), OSX, webrick (right now - lighttpd in production)
I''m trying to cache pages with different file extensions and am having
a heck of a time.
This controller does nothing but display @cache.data (which can be XML or HTML)
Here''s the controller:
class DisplayController < ApplicationController
caches_page :xml, :html
session :off
def xml
@cache = Cache.find(params[:id])
response.headers[''content-type''] = @cache.browser_content_type
#cache_page @cache.data, "/display/xml/#{@params[''id'']}.xml"
end...