Displaying 20 results from an estimated 1000 matches similar to: "map.root doesn't do anything, index.html can't be changed"
2006 Mar 15
1
An Association Problem: AR::Base.find{:include} and n-deep association traversal
Dear List,
I''m using Edge Rails.
I have a Model with Items for purchase. Each Item is of a certain brand.
Class Brand < ActiveRecord::Base
end
Class Item < ActiveRecord::Base
belongs_to :brand
end
The problem domain is that I''d like to create a separate Inventory
list of Items. This includes the date of entry into inventory and
date of exit from inventory (ie
2008 Apr 04
5
First call to worker method doesn''t work
I have a worker as follows:
class SampleWorker < BackgrounDRb::MetaWorker
set_worker_name :sample_worker
def create(args = nil)
# this method is called, when worker is loaded for the first time
end
def my_method
# Deliver test e-mail message
Notifications.deliver_message(1, "DM")
end
end
I have a rails controller that calls the following code:
worker =
2007 Nov 16
3
Route Information
Is there a method to return a hash of the route configuration based on
a path?
For example:
magic_method(''/my_controller/my_action/my_id'')
=>
{:controller => ''my_controller'', :action => ''my_action'', :id =>
''my_id''}
Thanks!
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message
2006 Dec 02
3
Scoping expectations and more ...
Hello!
I''m new to Mocha and through experimentation I found out something
that is not explicitly stated in the documentation: If you need to
mock the same function call with different parameters and results, you
can set the scope of expectations with a begin ... end block.
I also made up an example on how to expect more than one function call
with different parameters and return values.
2006 Feb 21
11
helper for models?
Is there such a thing?
I have some duplicate methods in my models, can I place them somewhere
and call them in to my models, thus keeping DRY?
--
Posted via http://www.ruby-forum.com/.
2008 Feb 02
3
Question abt redirect_to..
I found a reference to using attachment_fu and followed the lead of it
but having an issue with the redirect_to that renders the fb:render
tag - In my form I''m setting the canvas to false, file is being
uploaded / save fine but when I attempt to redirect:
redirect_to :action => :new, :canvas => true
Unfortunatly it looks like my callback URL is getting printed twice, e.g.
2013 Nov 29
1
How to catch warnings sent by arguments of s4 methods ?
Hello,
I apologized if this had already been addressed, and I also submitted
this problem on SO:
http://stackoverflow.com/questions/20268021/how-to-catch-warnings-sent-during-s4-method-selection
Example code:
setGeneric('my_method', function(x) standardGeneric('my_method') )
setMethod('my_method', 'ANY', function(x) invisible())
2007 Feb 21
6
Problem with url_for and https - overrides all options
I have a piece of code like this in one of my views:
<%=link_to "link here", :action=>''my_action'', :id=>1 %>
It works fine on my local development machine, running Webrick over http
and it works fine on my testing server which is running single mongrel
instance behind Apache 1.3 as a proxy. On both the outcome link is this:
<a
2005 Sep 27
2
No Custom Validation
Hi,
Correct me if I am wrong but there doesn''t seem to be an easy way to add
validation outside the pre-built ones (validates_presence_of,
validates_lenght_of, etc.).
Ideally there should be something like:
Class Person < ActiveRecord::Base
validates :my_method, :on => create, :message => ''was not valid''
def my_method(param)
false unless
2005 Dec 30
6
call a method once per page request
Hi,
I''m wondering if there is a simple solution to call a method once per
page request.
I tried to place my call in a before_filter in ApplicationController but
it''d called a second time if I use render_component from a view.
Seems to me that a hook should be added in Dispatcher#prepare_application.
Context: working on i18n, I''m trying to check lang either from uri,
2006 Jun 19
1
AJAX - Image output to an IMG tag ?
Hi,
I''m using the "link_to_remote" AJAX function call from my "view", and
what i want is after i get the results from the function call, I want to
update the result
directly into to an image ie. <IMG> tag, how to do this.??
ie. if we want to update the result into a ''div'' element we do like
this, which works fine..
link_to_remote(:update
2004 Mar 02
3
error() and C++ destructors
Hi,
I am writing C++ functions that are to be called via .Call() interface.
I'd been using error() (from R.h) to return to R if there is an error,
but then I realized that this might be not safe as supposedly error()
doesn't throw an exception and therefore some destructors do not get
called and some memory may leak. Here is a simple example
extern "C" void foo() {
string
2005 Oct 16
13
More than one parameter with link_to_remote
Hi all,
I''m trying to pass more than one parameters using link_to_remote, but I''m
getting a behaviour that seems quite strange to me. Here''s the code:
link_to_remote ''some text'',
:update => ''form'',
:method => ''get'',
:url => { :action =>
2006 Jun 17
1
magic disappearing parameters
I have a method in application_helper.rb like this:
def my_method(arg1, arg2 = {})
...
end
when I call this method from an rhtml file like this:
my_method @var
I get this message:
wrong number of arguments (1 for 0)
When I call the method without arguments like this:
my_method
I get this message:
wrong number of arguments (0 for 1)
I am new to Ruby and Rails so I presume that
2006 Jan 14
3
link_to_remote where the url contain a javascript variable
Ok, so I am basically trying to use ''link_to_remote'' and pass the value
of a javascript variable as an argument. Something like that:
link_to_remote "my_link",
:update => ''my_div'',
:url => { :action => "my_action", :var =>
''my_var'' }
Basically,
2006 Jun 21
2
access to application.rb methods
Why can''t I access the utility methods defined in applicaion.rb from the
model classes? If that does not work, where is the best place to put
common utility methods that must be available to all the models.
thanks
--
Posted via http://www.ruby-forum.com/.
2007 Jul 16
4
Set the return value to "same as block"
It would be good to be able to set the return value to be the same as
the return value of the block. I am trying to test opening a file in a
block and reading from it. It would be nice to use code like this:
object.stubs(:open).with("/path/to/file", "r").yields(
stub(:read => "The file contents")
).returns(from_block)
Which would make open() take the return
2006 Dec 06
10
Stem Analyzer
Hi all,
I am trying to implement a search that will use the Stem Analyzer. I
added the Stem Anaylzer from the examples shown in another post
http://ruby-forum.com/topic/80178#147014
module Ferret::Analysis
class StemmingAnalyzer
def token_stream(field, text)
StemFilter.new(StandardTokenizer.new(text))
end
end
end
The problem with the Stem analyzer is that when I search for a
2006 May 09
1
Reusing a model to form and link_to.
Hy guys,
Inside my app I have a form which contains user information.
Sometimes a have a form with a text_field as above:
<%= form_remote_tag(:html => { :action => url_for(:controller =>
"my_controller", :action => "my_action") }) %>
<%= text_field(''my_object'', ''my_parameter'', :maxlength =>
2006 Aug 15
6
try creating a table for your model
Railers:
Greetings from the low end of the learning curve. I have installed all
the prerequisites on Win32, including a lite MySQL database with a
table in it called Inventory.
Then I run this command line...
ruby script/generate ajax_scaffold Inventory
...and I get this error message:
error Before updating scaffolding from new DB schema, try creating
a table for your model