Displaying 18 results from an estimated 18 matches for "view_path".
Did you mean:
view_paths
2007 Aug 15
5
Misc notes concerning view_paths
Hi all,
I''ve been playing in the trunk with putting stuff in different dirs
to keep files from a reusable framework separate from the app files.
Here are a few considerations regarding the view_paths setting:
config.view_path is used to set both action_controller.view_paths and
action_mailer.template_root. We get some buggy/unexpected behavior
here because action_controller.view_paths can be an array or a
string, while template_root is a single string. config.view_path can
be set to e...
2007 Aug 18
0
Tests for render when changing view_paths
Hi there,
I''ve been getting into RSpec recently and I must say what a fantastic
product I think it is. But, I''ve hit a bit of a problem. In my
ApplicationHelper I have a method which changes the view_paths in a
controller so a partial can be rendered from a different base
directory. It simply takes an array of view_paths that a partial
could be in, updates the view_paths for the controller doing the
initial rendering, does the rendering, then removes the paths at the
end. Here''s...
2007 Oct 02
19
Per-Request View Paths
...multiple controller view paths
recently. My original patch attempt was:
http://dev.rubyonrails.org/ticket/8582
It was rejected due to the fact that it was fixing the symptom more than the
problem.
However, I think it''s critical that this problem get fixed, otherwise the
whole concept of view_paths is severely neutered and doesn''t even live up to
the use case advertised in the announcement on the official blog (ie.
productization). The way view_paths currently work is only suitable as a
sort of half-measure towards providing Engines functionality. That''s a
worthy goal, bu...
2007 Dec 23
5
prepend_view_path not working
Now that controllers can have multiple view paths I''ve been playing with
themes over the weekend. Running into a view issues. I have a
before_filter in the ApplicationController that calls prepend_view_path
to add the path of my theme. I even log the view_paths in an
after_filter to make sure it made it all the way through. The output
looks something like:
/path/to/rails_project/themes/default/views:/path/to/rails_project/app/views
Yet nothing loads. In the docs it says calling prepend_view_path...
2009 Jul 20
0
how to use view_paths() and why you need to use.
how to use view_paths() and why you need to use. What is the
purpose. can you explain and give some sample code.
2008 Mar 14
1
Rails App freezes when accessed
Hi All,
I just had this problem come up today and so far I''m stumped. This
morning, my mongrels were all completely unresponsive. I had to kill
-9 them to get them to go away. I restarted them, but the first time
that they were accessed they froze again. Nothing gets printed to the
logs. I tried starting a single mongrel and accessing it directly.
If I hit CTRL-C before accessing
2005 Nov 05
4
Changing plugins_path in Rails::Configuration
I have two apps sharing a common model and lib. I''d like to share my
plugins as well, however I noticed that the plugins_path in the
Rails::Configuration (0.14.2) is not accessible as is view_path or
log_path. What would be the best way to go about accomplishing this?
Thanks.
--Ryan
2011 Feb 21
2
self.prepend_view_path - am I missing something
...being accessed. Some of the domain characteristics are
supported in the model but it is easier varying static text in the
views and then sharing the form templates via partials etc.
Rails 2.3.10 and looking at the documentation at
http://rubydoc.info/docs/rails/2.3.8/ActionController/Base#prepend_view_path-instance_method
application_controller.rb
before_filter :domain_lookup, :set_view_paths
protected
def set_view_paths
self.prepend_view_path "app/views/#{controller_name}/
#{@domain.policy.policy_type}"
end
according to the documentation this should add this path to the fron...
2008 Dec 03
5
How to test a plugin
Guys,
I''ve created a plugin, i wanna put my automated test there.
However, I got bad file descriptor error when i run the test like normal
unit test file:
"ruby plugins/acts_as_fox/test/acts_as_fox_test.rb"
How to test a plugin?
Also, is it right to say that I should only put my unit tests (but not
functional test for example) for the plugin in the plugin test folder?
2008 Mar 24
2
render not able to locate template in publisher
Hi guys,
I have a publisher called UserPublisher setup in models directory of
my app. The reason I have it in a model is because its then possible
for me to invoke publisher methods in after_callbacks of my other
models, just the way we do it for ActionMailer.
My problem is that when I try to update a users profile specifying
location of the view template as a paramater to "profile"
2007 Apr 05
5
Odd error handling in ActionView#compile_template causes WSOD
...name
|| template, @assigns, template, e)
...which appears to have a few things wrong with it.
First off, file_name is always absolute here - eg /Users/jon/
Developer/Stacker/app/views/kittens/index.rhtml. find_base_path_for
is going to fail since it tries to append that path onto the path from
@view_paths - typically /Users/jon/Developer/Stacker/app/views.
So, find_base_path_for returns nil. I *think* what happens is that
code inside template_error.rb later raises a second exception when it
tries to use that path as a string and finds it''s nil, and that
exception isn''t caught pro...
2011 Jul 23
0
Rendering of Javascript updates with Rails > 2.1
Hey,
i am currently upgrading a Rails 2.1 app to 2.3 to benefit from Rails
engines.
The app requires rendering javascript updates to strings, which does
not work
with 2.3 anymore:
data =
ActionView::Base.new(Rails::Configuration.new.view_path).render(:update)
do |page|
page["div[id=''foo'']"].removeClass("bar")
end
whihc results in an error because the @template variable is nil.
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/
whiny_nil.rb:52:in `method_missing'': und...
2006 Feb 15
3
See Rails::Configuration for more options?
In config/environment.rb it states:
# See Rails::Configuration for more options
See where exactly? I can''t find any docs for it, not at
api.rubyonrails.com anyway.
Joe
--
Posted via http://www.ruby-forum.com/.
2007 Aug 15
2
need help on writing a plugin
Hey all,
I''ve just "script/generate plugin my_plugin" and I would like to
"overload" one of my view. Say I have app/views/sessions/new.html.erb
and I would like to rewrite that file without touching it using the
plugin. Any idea how to do this? I would also like to do the same
thing with models and controllers of my application. I couldn''t find a
tutorial
2007 Aug 23
2
Render partial from Backgroundrb worker?
Hi,
I have a long running task which generates JavaScript to files and I am
hoping to move this to a backgroundrb worker. The javascript is
currently generated with call to render_to_string:
File.open(File.join(target_folder, ''all.js''), "w") do |file|
file.puts(render_to_string :partial =>
''partials/shared/javascript/tags'', :locals => {
2008 Jun 14
0
does BackgrounDRB not "know" the rails environment it is running within/in parallel with?]
...s
# Renders a template to a string with the included variable assignments
def self.render_string(template, assigns)
viewer = Class.new(ApplicationController)
view = Class.new(ActionView::Base)
view.send(:include, viewer.master_helper_module)
path = ActionController::Base.view_paths rescue
ActionController::Base.view_root
view.new(path, assigns, viewer).render(template) end
I have a show.html.erb under app/views/invoices which holds the HTML to
go with the show action on the InvoicesController.
Everything is working perfectly if I open the script/console and cal...
2010 Oct 20
7
How can I render a template outside of a controller in Rails 3?
...m/rails-rendering-templates-outside-of-a-contro.
However, this seems to be broken in Rails 3. Does anyone have any ideas how
I can fix this method or perhaps know of a better approach?
My method:
def render_erb(template_path, params)
view = ActionView::Base.new(ActionController::Base.view_paths, {})
class << view
include ApplicationHelper
end
view.render(:file => "#{template_path}.html.erb", :locals => params)
end
The error:
ActionView::Template::Error: ActionView::Template::Error
from
/Library/Ruby/Gems/1.8/gems/a...
2009 Jan 20
4
Shared templates across controllers
Hey all,
Here''s my situation: I have a pair of controllers with associated
models (called Services and Testimonials) that are quite similar.
Because their CRUD behavior is executed via AJAX, the "templates" for
the actions are all short .rjs files. Now, because of the similarity
of the models, most of the templates are exactly the same, with only
the object names changed. That