Displaying 20 results from an estimated 300 matches similar to: "calling method on base intended to simulate initialize on instances?"
2006 Mar 12
0
ERB and Builder template engines shouldn''t be so heavily wired in ActionView::Base
Problem:
1. ERB and Builder template engines are heavily wired in ActionView::Base
2. Should be optional. If we use different engine - why load all their
stuff if not needed?
3. There are template engines which expect files in their own locations
and cache them in their own way. For instance a template engine may
store templates in a database. These engines don''t need any central
source
2012 Sep 09
2
mattr_accessor inside a class
Rails extends Ruby with mattr_accessor (Module accessor). As Ruby''s
attr_accessor generates getter/setter methods for instances,
mattr_accessor provide getter/setter methods at the module level. In
below example, you see that mattr_accessor declared in the class
context of LookupContext. It''s declared in class, not module. However,
modules are defined in LookupContext, for
2012 Sep 11
1
define_method vs module_eval
Rails code:
Accessors.send :define_method, :"default_#{name}", &block
Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{name}
-ISKimRw02aC5oVgD8gxYQQ@public.gmane.org(:#{name}, [])
end
def #{name}=(value)
value = value.present? ? Array(value) : default_#{name}
_set_detail(:#{name}, value) if value != @details[:#{name}]
end
2009 Jan 20
5
Problem running rake test
I''m using the One-click 1.8.7rc2 Ruby Windows installer, everything
has been working fine up till now, when i want to start getting into
testing, i got this error, any reason why?
C:/Ruby/bin/ruby -Ilib;test "C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/
lib/rake/rake_test_loader.rb" "test/unit/word_test.rb"
C:/Ruby/lib/ruby/1.8/erb.rb:469:in `scan'': You have a
2006 Jan 22
2
Using register_template_handler to serve CSS files (Making ActionView handle .css as .rhtml)
Hi,
I wanted to be able to use some Rails code inside CSS files, so I set up
a controller (StylesController) to serve CSS files that reside inside
the controller''s view folder when the browser requests /stylesheets/:action
So in the controller I just define empty actions with the names I want
my style sheets in (ie: def cooleffects end - that would respond to
2010 Jul 04
2
Rendering a different format in the implementation of a renderer
Yehuda has a nice article on implementing a custom renderer for PDF at
http://www.engineyard.com/blog/2010/render-options-in-rails-3/
I''ve tried to follow the example and I''m not sure I see how to get it to
work. If I understand things correctly, the format(s) usable in this
render call
respond_with(@resource) do |format|
format.xyz { render :xyz => ... }
end
2008 Jun 30
1
Help with form_for
Hello, I had an app running on RoR 1.1, now I''m migrating it to 2.1.
In a view I have:
<div id="user_management">
<fieldset>
<legend>Please log in</legend>
<% form_for(:user, :url => sessions_path) do |f| %>
<p>Username: <span class="notice"><%= flash[:notice]%></
span></p>
2006 Mar 09
0
markably in instance_var mungling
this bug is similar to something i see already discussed on why''s
blogpost comments, which was reported fixed, but that was before the gem
was made available (which is what im using since i cant seem to access
the C.WTLS SVN)
my guess is one of 3 things: fix didnt propagate to gem, my own failure
to make an educated guess on proper setup (1), or a genuine bug
essentially,
for
2007 Jun 26
0
Best way to render KML files using RXML templates
I want to produce google maps KML files which are baiscally XML files
with a KML extention. I''m using restful routes and respond_to. The
best way I''ve found is to use
respond_to do |format|
format.kml { render :action => "kml" }
will render a kml.rxml template I have but really I want to have
action.rxml rendered for kml files.
Is there are way to acheive this,
2007 Dec 17
0
[CruiseControl] RubyOnRails build 8425 failed
The build failed.
CHANGES
-------
Revision 8422 committed by david on 2007-12-16 23:53:45
Add tests for html_escape, and remove an unneeded backslash (closes #10511) [fxn]
M /trunk/actionpack/lib/action_view/template_handlers/erb.rb
A /trunk/actionpack/test/template/erb_util_test.rb
Revision 8423 committed by david on 2007-12-16 23:55:22
Fix doc (closes #10526)
M
2008 Oct 31
10
Strange dependency error after going Ruby1.8.6, Rails 2.1.0 -> Ruby1.8.7, Rails 2.1.2
Hi,
I''m getting an error I just can''t find any cause for.
The error is "A copy of ApplicationHelper has been removed from the
module tree but is still active!" and gets thrown
in a Template that uses a method defined in my ApplicationHelper. The
error occurs only in development mode.
The error did not occur before my switch to Ruby 1.8.7 and Rails 2.1.2
minutes ago.
I
2009 Apr 04
11
rake aborted! undefined method `empty?' for nil:NilClass
Hi,
I''m getting the next errors, would anyone have any suggestions?
Thanks.
[~/rails/hip]# rake --trace db:migrate RAILS_ENV="production"
(in /home/domain/rails/hip)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `empty?'' for nil:NilClass
/usr/lib/ruby/1.8/erb.rb:469:in `scan''
2005 Dec 19
1
Preserving fallback with RJS
Hi guys,
I really like RJS. I think they''ll replace partials in alot of
instances. Unfortunately, because they''re automatically used like
.rhtml and .rxml and are hard to specifically specify it makes it
messy to preserve fallbacks when using them. For instance, using
partials instead of rjs, my create method might look like:
def create
post = Post.new(params[:post])
...
2009 May 20
8
ctionView::TemplateError (undefined method `start_form_tag'
I upgrade my version of ruby on rails And my SO
Free BSD was working with Ruby 1.8 + 1.2.6
and now Mandriva Linux with Ruby 1.8 + Rails 2.1.1 it''s not working
ERROR:
Processing LoginController#fazer_login (for 192.168.3.210 at 2009-05-20
09:20:53) [GET]
Session ID:
BAh7BzoNYWRtaW5faWQwIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpG
2007 Aug 18
1
problem with file_column url generator
Hi,
I have the following in a viewer
Here, @lst = Homework.find(:all) is an array of homeworks. I checked
this this is correct.
Based on the error below, somehow, the url_for_file_colum does not
like to act on the model element.
I checked the source code to url_for_file_column, and the problem is
with instance_variable_get().
I have no idea wat is going on! Any help is appreciated. Gordon.
2005 Dec 27
0
Re: RESOLVED: Overloading error_message_on method in ActiveRecordHelper
Leaving the body of the method the same as the default still throws
the "stack level too deep" error. As a matter of fact, it only
disappears if I comment out the ''require'' in line 1.
As it turned out, it was the method definiton itself that caused
problems. Ruby doesn''t have keyword arguments, but I tried calling the
method as if it had. But when I changed
2008 Dec 01
2
strange rails error on ubuntu 8.10
Just upgraded from 8.04 to 8.10, which bumped my Ruby version to
1.8.7, and my Rails app (frozen to 2.2.2) gets a strange error on
startup. I can easily reproduce just by running script/about:
$ script/about
/vendor/rails/actionpack/lib/action_view/template_handler.rb:11:in
`initialize'': wrong number of arguments (0 for 1) (ArgumentError)
Anyone else having trouble with Rails on Ubuntu
2008 Jan 16
1
session data and user stories
hello there,
i have been trying my hand at this rbehave material, specifically in terms
of integration testing a rails application, and i am curious about the most
friendly way to deal with session data.
currently, the only way i have found to simulate a session is to open a
session and refer to everything afterward via the @session variable stored
after open_session. it seems to be workable,
2007 Jul 15
0
errors_for
Been playing with merb.
One of the helpers I liked in rails was on form validations. Found
this was real easy to port over, so I thought I''d share.
It doesn''t highlight the field with the error, but it gives that same
nice little div on top.
Say I had an articles controller
def create
@article = Article.new(params[:article])
@article.save!
redirect
2006 May 03
0
Newbie Help
Is it my environment? Is something wrong, cause I thought this should
just work?
I have a simple table and I created a model and a controller:
ruby script/generate controller Restaurant
ruby script/generate model Restaurant
I edited the controller to this:
class RestaurantController < ApplicationController
scaffold :Restaurant
end
I run it and:
http://0.0.0.0:3000/Restaurant works