similar to: Erubis / Rails Question

Displaying 20 results from an estimated 4000 matches similar to: "Erubis / Rails Question"

2010 Nov 20
0
Enabling preprocessing in Erubis makes views much faster
I wrote a 5 line hack that you can drop into your initializers directory to enable preprocessing in Erubis. This will run code in < %=== %> brackets at compile time making views considerably faster for rails helpers that only need to be evaluated once instead of on each render (the Erubis docs mention 20-40% speed increase but obviously it depends on the amount you precompile). For example:
2006 Dec 22
2
erubis on rails
Hey, Just thought I''d see how easy it was to use erubis rather than erb in rails, and so far all seems to be pretty easy. Just added a few lines in environment.rb and everything works as before. However, one page is causing a problem. It is a partial that is being passed a local variable. erubis doesn''t seem to see the local, and gives the following error? undefined local
2008 Aug 19
5
RSpec raising routing errors where Rails doesn''t?
Hopefully someone here can help me figure out why the ERB: <% form_for(@fund, :url => {:host => PRIVATE_HOST}, :html => {:class => ''fund'', :multipart => true}) do |f| %> raises an error in my specs: No route matches {:action=>"index"} but works fine in my app and generates the following, desired HTML: <form
2010 Apr 06
3
(Rails3-master) erubis: how to use things like preprocessing?
(Rails3 latest git master) Subject says it. I''m trying to figure out how to use erubis features described here: http://www.kuwata-lab.com/erubis/users-guide.05.html#rails, especially preprocessing. My question is, where do I place the Erubis::Helpers::RailsHelper.preprocessing=true Not in application.rb, at that point the object does not exist yet it seems. I wonder why I
2007 Apr 03
4
Replacing ERB with Erubis
Hey guys, I''ve been hearing a lot about erubis: http://www.kuwata-lab.com/erubis/ Especially about how much faster it is than straight ERB. In their Ruby on Rails support docs: http://www.kuwata-lab.com/erubis/users-guide.05.html#topics-rails They state that with a few added lines to your environment.rb it will replace ERB completely. I''m wondering if anyone has done this in
2009 Feb 03
2
Rails 2.3 problem...
When moving to Rails 2.3.0RC1 I get an error with concat!? I can''t figure it out. See the dump below: ActionView::TemplateError (You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<<) on line #158 of app/views/places/show.html.erb: 158: <div
2008 Jan 25
1
form error with datetime select
Hi, Im trying to build a form using: <% facebook_form_for(:task, at task,:url => create_task_path) do |f| %> Assign Task To: <%= fb_friend_selector %> <%=f.text_field :ttype, :label=> "Title"%> <%=f.datetime_select :duedate, :label=> "Due Date"%> <%=f.buttons "Add" %> <% end %> But im getting an
2007 Feb 27
14
Stop browser from "form filling" fields.
Hi all, I have a user login form which the browser keeps populating because of its form fill feature. So when anyone goes to log in it shows the previous login''s username and password. How can I stop the browser from populating a text field? Thanks in advance. Cheers, Diego --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and
2007 Aug 29
11
Non-Erubis Templates
Trunk Issue: Because of the use of ''autoload'', template handlers other than Erubis are not loaded automatically (Haml, XMLBuilder). Either this should be fixed, or the documentation should be updated to instruct people how to use non-Erb template engines. Apparently the solution is to do something like this in merb_init.rb: ::Merb::AbstractController.register_engine
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY out the repeated parts of my forms and put them in common/form and render the form elements via another partial in controller_name/_form. Here''s the first form # app/views/common/form <% form_for ... do |f| -%> <%= render :partial => "params[:controller]/form", :object => f
2009 Feb 26
0
Using form_for and has_many associations with a controller in its own subdirectory
Hi, I''m trying to create a Blog in it''s own subdirectory for an E-commerce site. Everything is hooked up just fine for the basic posting, but when I try to add Comments, I''m getting all sorts of headaches! I''m referring to the screencast by Ryan Bates on the rubyonrails.org site. Basically, my controller is Blog::Comments, in my Blog::Post comment form I have
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all, I cannot figure out how to correctly use the with_output_buffer helper method (located in ActionView::Helpers::CaptureHelper) inside a custom FormBuilder. Below follows a simplified example. I''m trying to achieve the following behavior in an ERB as suggested in the form_for helper docs in the Rails source: ========== <%= form_for @object, :builder => MyFormBuilder do
2011 Nov 02
3
form_for text_field
I have a form ... html ..... <% form_for @person do |f| %> ... html ..... <%= f.text_field :last_name %> ... html ..... <% end %> When last_name field of @person doesn''t contains french special symbols like ''é'', all characters are displayed in the input control (f.text_field :last_name ). Else only symbols before french special symbol are
2006 Oct 31
12
Moving page_cache_directory
Howdy. I''m working on a RoR CMS and need cached pages to all be in public/cache rather than public [in order to set svn:ignore on all the files properly]. I can get page_cache_directory set correctly and the pages are cached in the right place but Mongrel isn''t serving them because it''s only looking for them in public. During development I know I can set -r public/cache
2007 Jan 23
11
dynamic tablenames
Hi List! May I tap into your combined common sense ? I have a legacy logging app that needs to be modernized. At the moment, Data is going to be stored in 5 tables, one table is going to contain more than 200 million and 2 others about 60 million rows. Mysql will be used, unless someone sees a major advantage in using something else (at the moment data is stored in a raw positioned file format,
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello - I am fairly new to Ruby on Rails, but feel like I am learning quick. I have what seems to be a fairly unique issue as I cannot find much out there that describes what I''m seeing. Hopefully it''s a very simple fix, and I simply can''t see the forest through all the trees! I am attempting to create 2 related drop-down lists in the same form_for, both using
2012 Sep 04
0
dynamic route generation
In polymorphic_routes.rb, line 131, a name route that has been built (e.g. post_users_path) gets invoked on self (assuming there was not RoutesProxy instance appended as the first element of the array passed as the first argument to form_for, then send() would be invoked on self, which is PolymorphicRoutes module, which belongs to ActionDispatch::Routing): (proxy || self).send(named_route, *args)
2008 May 12
0
Problems with form_for, STI, and polymorphic routing
I''m stumped on how to get past this. It''s Rails 2.0.2. I have a class, Show. Using STI, I''m using that as a base class, and have DayShow and NightShow that inherit from it. ### class Show < ActiveRecord::Base end class DayShow < Show end ### In my shows/edit.html.erb, I have: <% form_for(@show) do |f| %> However, when I use it with a @show that has
2010 Jun 18
0
[PATCH] form_for without :html and with :remote causes an error
If you run form_for(@post, :remote => true) {|f| ... } you will get "ActionView::Template::Error (You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[]=)" My patch fixes this error.