Displaying 20 results from an estimated 90000 matches similar to: "How to call a controller class method via HTTP"
2006 Jul 14
3
Accessing the Model class from Controller
Hi,
I wonder if there''s an easy way to access the associated Model class
from its Controller. Something that would allow me to write snippets
like the following:
class PeopleController < ApplicationController
def some_method
person_model_class =
self.some_method_to_retrieve_the_person_model_class()
end
end
Cheers,
Marco
--
Posted via
2006 Apr 03
1
Best way to set custom Controller options
Hi All!
I''m searching a good way to set some options in my Controllers; I tried
defining a custom function, ie:
class PeopleController < ApplicationController
set_my_actions :action1, :action2
end
class ApplicationController
def self.set_my_actions(*args)
@@my_actions = args
end
end
But ''@@my_actions'' sets the class variable to _every_
2006 Jul 24
1
Injecting actions into controllers
Hi,
I''m trying to write a plugin that should inject an action into the controller.
Please note, not just an instance method, but also an _action_, one of those
that are listable by running ControllerClassName.action_methods.
I wrote the following code:
def render_field_search(name, object, controller, options = {})
controller.class.class_eval do
2006 May 17
0
class filter: cannot call protected controller methods
Greetins all,
I''m rewriting a filter from the method form to a class filter.(see
below)
Problem: some controller - redirect_to - and route - *_url - methods are
protected (redirect_to, f.ex.), and cannot be called.
Is this intended?
Is there a solution workaround?
TIA
Alain
BEFORE:
-----------
before_filter :login_required, :except => [:welcome,:login]
def
2006 Apr 14
2
Nested AJAX remote_form in form?
I''d like to achieve something that is better described by the following
code:
<%= start_form_tag :action => ''create'' %>
<%= text_area ''place'', ''description'', :cols => 100, :rows => 4 %>
<div id="categories">
<%= form_remote_tag :update => ''categories'',
2010 Jul 03
0
rspec controller test strange error: undefined method `call' for nil:NilClass
must be doing something dumb....
not sure, but the ''call'' appears to be on the block.call when the
respond_to block gets executed.
straight forward "channels" resource with a ''create'' action.... only
new thing is just assigning the current_user to the model.
def create
@channel = Channel.new(params[:channel])
@channel.user = @user
2007 Nov 23
3
call model method out of the controller => undefined method
Hi,
I''m a newby and I fight with the Rails convention - i think so.
I''ve done little tools and scripts in Ruby before.
I''ve successfully uploaded a textfile. And now i want to extract some
filecontent to pass it into a database.
My Problem:
I can not start a given method of a given Model (=>
Metadata.extract_content(fileuri)). The error message ''undefined
2006 Jun 16
3
Not able to recognize helper class method in controller!
Hi,
Not able to recognize helper class method in controller!
When I try to call some method "get_formatted()" in my controller, it
says local method not recognized.
Please help me out.
Thanks,
josua
--
Posted via http://www.ruby-forum.com/.
2006 Sep 05
1
using "session" method from a class other than a controller?
I''m relatively new to Rails, and am wondering if it''s possible to use
the "session" method from a class that does not extend
"ActionController::Base"? Can I just do a "require
''action_controller/???''" in order to use it? I would like to store
some session information from a UserService class being called via the
weborb plugin.
2006 Apr 06
4
Using RJS to call custom JavaScript class/method
The announcement for RoR 1.1 shows some nice examples of RJS calls. In
particular I am interested in this one:
# Call the custom JavaScript class/method AddressBook.cancel()
page.address_book.cancel
In trying to develop a "lightbox" style modal form, I have been
successful in saving the form data via AJAX but I can''t seem to close
the "lightbox". I am using the
2006 May 09
2
Disabling FOREIGN KEYs in a Rake task
Hi,
How could I disable my database FOREIGN KEYs in a Rake task?
Or, how could I call the execute() method in a Rake task?
I''m trying to perform something like:
task :delete_the_cippalippa => :environment do
require RAILS_ROOT+''/lib/marsian.rb''
# FIXME: execute() is undefined
execute "SET FOREIGN_KEY_CHECKS = 0"
Cippalippa.delete(-1)
2020 Sep 01
0
OpenPVN authentication via Samba AD
I have it working but I struggled for a while before getting there.
Read this page:
https://www.reddit.com/r/PFSENSE/comments/esxwrv/could_not_bind_to_ldap_serv
er/
Due to a bug in PHP, what you set in the LDAP page doesn't stick. You have
to go to the pfsense's console menu and press option 16 followed by option
11.
"The way PHP requires an LDAP connection to be setup in the
2010 Mar 11
4
Call a controller method from a view
Hi,
I am trying to call a controller method from my view, but I get an error
and I don''t know how to correct it.
What i am trying to do:
I am in the edit form of the model Product, and products can have many
ingredients. So on my edit form there is a text_field where you type the
ingredient with a link "Add" which is supposed to add the typed
ingredient to the current
2002 Sep 08
2
Printing via smbprint to a WinPrinter
Hi all.
I would like to print from a Linux Server to a printer connected to a Windows ME machine. I'm able to connect via smbclient, with
smbclient //windowsme/printer -U '' -N
and I receive the smb> prompt
Now, when I try to print any file, nothing comes out from the printer. The printer is a Canon LBP-810 which, according to
www.linuxprinting.org site, is a WinPrinter. My
2002 Nov 13
0
How call method of root "class" directly?
Is there a way of calling the method of the root class directly? Here is
an example explaing my question. Everything relates to S3/UseMethod
classes and methods. I have an object x of class MicroarrayMatrix, which
inherits from class Matrix. The "core" object of x is a simple matrix.
In other words, I basically have
x <- matrix(logratios, ncol=nbrOfSpots, nrow=nbrOfSlides)
2006 Feb 21
0
Odp: RE: Ajax reqest and http status
Hi Marco.
I now that the way prevent IE caching AJAX call is to link to parameters one parameter which will be complete random.
Bur here is much important question. I using ajax call to connect url which is accesible only if user is logged (i mean there is a user session). Somethimes session expired and url is not accesible and there is redirect to other url i see that server return code 302 but
2006 Oct 08
3
Call an helper method from a controller
Hello, this have been debated few times in the forum but I didn''t found
a satisfying solution : my problem is very simple, I have few methods
dealing with cookies that are intended to be used in controllers and
views.
Let say I have the read_cookie() method. Because it deals with the
response object putting this method in the /lib directory doesn''t fit
nicely because I
2020 Sep 01
2
OpenPVN authentication via Samba AD
On 2020-09-01 4:04 pm, Marco Shmerykowsky via samba wrote:
> On 2020-09-01 1:57 pm, Marco Shmerykowsky via samba wrote:
>> On 2020-09-01 1:36 pm, Stefan G. Weichinger via samba wrote:
>>> Am 01.09.20 um 19:07 schrieb Marco Shmerykowsky via samba:
>>>> A little off topic, but this does revolve around
>>>> Samaba.
>>>>
>>>> I'm
2017 Oct 04
2
Script to reset group memberships...
I was used, for users that leave my network, to disable the account but
also ''sanitize'' the memberships, eg reset group membership to a
default values (normally, 'domain users').
Clearly, using smbldap-tools in a NT domain was easy.
How can achieve the same result in a samba AD domain? Seems that
avaliable commands/tools (pdbedit, wbinfo, samba-tool) does not have
this
2006 May 08
7
How to get difference between two dates in days???
Hi,
I want to calculate difference between Current date & previous date
(stored in database). The difference should be in days. Hhow to do
that??
PLs tell me.
Thanx in advance.
Prash
--
Posted via http://www.ruby-forum.com/.