Displaying 20 results from an estimated 7000 matches similar to: "(Rails3-master) erubis: how to use things like preprocessing?"
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
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
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
2006 Dec 20
0
Erubis / Rails Question
I''m trying to figure out whether the fix for an error I get when using
Erubis belongs to Erubis or Rails so I can submit a bug/patch/whatever. When
you use form_for in an Erubis template the instance_eval uses _erbout
instead of _buf. I found the solution [adding
ActionView::Base.erb_variable= "_buf" to the setup in
app/controllers/application.rb] but in searching
out
2006 Oct 27
1
link_to
Hi there.
Is there a way i can have my link_to refer outsite the current controler
?
I have a path /refrences/ wich lists the refrences, and i want a link_to
in this template, to refer to the path /companies/show/company.id is
this possible ?
I have tried using: ink_to ''link'', :action => ''/companies/show'', :id =>
company.id
but with no luck, is
2010 Oct 21
4
Authlogic + Rails3 - undefined method `Login' for nil:NilClass
Im new to Rails, and decided to start of with Rails3. After a lot of
searching ive managed to get a little bit of Authlogic working. I''m able
to register a user, login & logout.
Now, I would like to add more features, get more of authlogic working.
I''m using Railscast EP 160 as my reference.
Portions of the code found on the tutorial throw errors: Eg:
<!--
2010 Nov 05
9
[patch] Let's use <%== %> instead of <%= raw() %>
I''ve submitted a small patch to make Rails behave properly with the
Erubis <%== %> construct. For some reason the current behaviour of
that tag in Rails 3 is to escape the contents _twice_ which is
probably a bug.
I offer three suggestions why this is a good idea:
- The syntax is cleaner. It can avoid a lot of .html_safe and raw in
your views. I especially like the conciseness of
2011 Mar 16
19
Uninitialized constant Files::Magick -still around
Hi there,
I''m solving the problem about the plugin Magick. In my app in Gemfile
I''ve follwoing:
require ''rubygems''
require ''mongo''
require ''RMagick''
include Magick
and in a model Files:
class Files
def self.save(upload)
...
img = Magick::Image.read(''public/data/nature6.jpg'').first
end
end
2010 May 13
1
link_to using smart API
Trying to use the "smart" API for link_to
def create_link(object, label = nil)
label ||= auth_labels[:new]
link = link_to(label, [:new, object]) if can?(:create, object)
link.sub /new\./, ''new/''
end
But this generates a link like /projects/new.1 , instead of /projects/
new
I would assume it would make sense to pass it the class instead, like
this, sense in
2010 Jul 24
23
How to disable ORM in Rails 3
Is there any way to prevent Rails 3 from using an ORM? In Rails 2, it
used to have a description in environments.rb explaining how to do that.
In Rails 3, is there any way to tell it to not use any database? I was
trying to make some benchmarks from situations that don''t require a
database...
Thanks in advance,
Rodrigo.
--
You received this message because you are subscribed to
2011 Jun 15
1
uninitialized class variable @@env in OCI8
Can anyone help me with the uninitialized class variable @@env in OCI8
error raised in my app\views\xxxx index.html.erb file
Thanks in advance
Below is the code and the result of bundle show. I am using Windows 7
<h1>Listing comics</h1>
<table>
<tr>
<th>Title</th>
<th>Issue</th>
<th>Publisher</th>
2011 Feb 10
2
Help using "tm" text mining package - preprocessing
Thanks all for your help. I fear text mining is an abstract little corner of
"R".
I have imported 3228 text (.txt) files, each a news story, into R using
[tm]:
textd <- Corpus(DirSource("other/docs"), readerControl = list(reader
=readPlain))
I can pre-process each individual document using tolower(textd[[1]])
however, when I try to run tmTolower() I get a no such command
2011 Jan 28
5
mysql quotation wonky
Why would, in an upgrade from 3.0.1 to 3.0.3, a rake db:migrate run
this:
SELECT "schema_migrations"."version" FROM "schema_migrations"
vs this ?
SELECT `schema_migrations`.`version` FROM `schema_migrations`
__ rake db:migrate output __
rake aborted!
Mysql::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version
2006 Jun 30
2
Eruby.import -> "uninitialized constant" error
I''m working on porting a dynamic website done in PHP over to mod_ruby. I
have everything set up and working nicely (I can make a .rhtml page, put
ruby code between <% %> and it works etc), but when I try to use
"Eruby.import" as a sort of analog to PHP''s "require_once()", I run into
trouble.
1) eruby is in my cgi-bin
2) here''s a sample of
2006 Feb 06
10
Urgently Need Solution
I''m using scriptaculous'' SlideUp and SlideDown effects to animate a menu.
Specifically, I SlideUp, make some CSS changes, and SlideDown. All works
well, except that for a split second in between, the element''s display
becomes ''none'' and the other menu item jump into the space. I haven''t been
able to find any way to force an element to retain
2011 Feb 25
7
Rspec2 for rails 2.3.8?
Hi experts,
I picked up a copy of the rspec book and wrote some tests in spec/lib
and spec/models for my Rails 2.3.8 code.
I was using rspec 2.5.1, rspec-core 2.5.0, rspec-expectations 2.5.0 et.
al.
But I realised that the rspec-rails version I am using is meant for
Rails3.
Which version of rspec-rails should I use for Rails 2.3.8?
Best,
Radhesh
--
Posted via http://www.ruby-forum.com/.
2008 Jan 03
3
Whats the merb equivilant of this?
Hey All
Quick question, what''s the merb equivalent of this:
ActionView::Base.new([template_root], assigns, self)
in merb? Ive found
Merb::Template::Erubis.transform(:file => ''/path/to/file'')
But I''ve no idea if thats the correct thing to be calling? It doesn''t
''feel'' right, so im not sure it is?
Thanks
Tim
2011 Apr 30
1
Could not autoload inventory_active_record: uninitialized constant ActiveRecord
Trying to set up the inventory service on puppet 2.6.8, pretty sure
I''ve met all the dependencies but puppetmaster logs
Could not autoload inventory_active_record: uninitialized constant
ActiveRecord
When clients attempt to connect.
local gems:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.7, 2.2.3)
actionpack (3.0.7, 2.2.3)
activemodel (3.0.7)
activerecord (3.0.7)
2007 Sep 28
2
RoR uses something rather than erb or eRuby?
it seems that RoR doesn''t use erb or eRuby to generate its output for
rhtml?
the program erb and the description of eRuby at
http://www.eruby.info
both said that
<% print "foo bar" %> or <% puts "hello" %>
will be placed into the output...
but currently for RoR, it won''t...
only <%= expr %> is doing it and it cannot be print or