similar to: DRY Rails question

Displaying 20 results from an estimated 30000 matches similar to: "DRY Rails question"

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 Apr 21
9
Yet another dry question..
One of these days I''ll figure this out, but in the meantime help me be a better programmer by eliminating some excess code: I''m trying to check to see if somebody trying to view/edit/update a product is the owner. In my scaffold I have this code that works: def edit @owner = Product.find(params[:id].to_i) if @owner.user_id == @user.id @product =
2005 Jun 07
2
codec preference
Need some help understanding codec preferences: I have 2 asterisk servers. Server 1 sends calls to the PSTN and has allow=g729 allow=gsm and allow=ulaw in iax.conf Server 2 receives calls and routes them to server 1. It has the same allow lines. We receive calls from a phone co and route them via server 2 to server 1. The calls originate in g729 and everything works fine. Now I want to take
2005 Dec 19
1
Application.rb / Application_Helper.rb / DRY help
Hi all, I have defined the following method in both application.rb and application_helper.rb: def still_logged_in? !session[:user_id].nil? end This method is called in a before_filter in my application.rb, as well as in my layout/application.rhtml and view/user/login.rhtml (for showing a login / logout button, etc.) I had to put it both places, otherwise I would get an
2006 Feb 08
2
Protecting controllers - looking for a DRY solution
Hello everyone, I''ve got several different user roles (i.e. admin, user, guest, ...) and have set up a bunch of controllers for each user role. I''m trying to set up some sort of validation that the user accessing e.g. the admin/subjects controller has the ''admin'' role. The brute force way to do this would be something like: - for each controller, put in
2006 Jan 06
3
problems permision owner root
Hello I have directory /rsyncprob/config/pref owner root Own is: drwxr-xr-x 3 root datasync 12288 Jan 5 18:08 prefs I execute: su - datasync #datasync> rsync -arvz --update /rsyncprob/ datasync@172.31.199.203:/rsyncprob/ <mailto:datasync@172.31.199.203:/rsyncprob/> Obtaing error: rsync: send_files failed to open
2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi, I have four controllers: one for the store front and three for the store admin. In each controller I have copied and pasted exactly the same code. It is a method called redirect_to() to override Action Controller''s redirect_to(). Copy and paste is bad. I can think of two options but I don''t know how Rails will feel about them. Option 1: Can I create an intermediate
2006 Apr 24
1
E1 testing
Skipped content of type multipart/alternative-------------- next part -------------- Console logs from Asterisk A: Executing Dial("SIP/test0-5821", "Zap/6/327557670||Tt") in new stack -- Requested transfer capability: 0x00 - SPEECH -- Called 6/327557670 -- Zap/6-1 is proceeding passing it to SIP/test0-5821 -- Accepting UNAUTHENTICATED call from 195.66.73.122:
2010 Apr 18
1
problems originating an outgoing IAX2 call
Dear all i'm trying to originate an outgoing call with the command originate, from Asterisk's CLI i'm typing: CLI> originate IAX2/my-iax-provider/number2call application wait 10 [Apr 18 19:31:12] DEBUG[32331]: chan_iax2.c:4000 create_addr: prepending 40 to prefs -- Call accepted by 62.149.202.150 (format ilbc) -- Format for call is ilbc -- Hungup
1999 Jul 08
1
Gnome interface status report
Hi, The Gnome version now compiles, and it should also be working (at least as much as it ever has). I've changed Makefile.in to the new system, which is very cool. What I want to work on now is: - Graphics. I want to move to the Gnome canvas for this, which should be reasonably easy. This will give us rotated text (which I never got going properly before) and the option for
2007 Jul 17
12
Getting past my login system
Thank you in advance for your help. I am relatively new to both Rails and Rspec and I am hoping for some insight from some experienced veterans. Right now I am using Rspec for code that has already been written so that additional functionality can be developed using the BDD method. My problem shows up when I try to spec controllers that are behind the login system. Each page checks for the
2013 Sep 28
1
iax: unable to transfer - one way audio
We have zoiper connected over iax to asterisk in Sydney. The call is to asterisk in New York. The caller in NZ can hear clearly. Nothing in NY. Here's the sydney server: -- Accepting AUTHENTICATED call from <zoiperipaddr>: > requested format = speex, > requested prefs = (), > actual format = ulaw, > host prefs = (silk16|ulaw|gsm|g722),
2006 Oct 25
1
Phone Rings, Immediate Hangup and then Rings Again.
I am having a problem with an Asterisk server, in that when it is receiving a call from another Asterisk server using an IAX2 trunk the phone rings for 10 ms and then there is a hungup from asterisk and then the phone rings again before another hangup. The funny thing is that after I really hang up on the calling phone it repeats this as if I am still trying to call. Any Ideas?
2006 Oct 12
5
unauthenticated calls
Hi list, i noticed from the cli my asterisk box is accepting unauthenticated calls how can i prevent this? CLI: -- Accepting UNAUTHENTICATED call from 192.168.0.2: > requested format = gsm, > requested prefs = (), > actual format = ulaw, > host prefs = (g729|ulaw|alaw), > priority = mine -------------- next part -------------- An HTML
2005 May 24
3
PHPAGI problems
Hi Here is part of my extensions.conf exten => 8661231234,1,agi,dtmf.php When I dial this number, this is what I see in my asterisk console: -- Accepting AUTHENTICATED call from 198.22.67.70: > requested format = gsm, > requested prefs = (), > actual format = gsm, > host prefs = (gsm|ilbc|speex), > priority = mine -- Executing
2011 Apr 20
1
[IAX] Everyone is busy/congested at this time (1:0/0/1)
Hi, I have a problem with IAX accounts... I set up a few months ago an Asterisk server, with mysql support to load iax accounts. Settings seems fine because apparently the system works as expected. Yesterday I tried to add another iax account in the iax.conf directly. And I have a problem with this new account (named 444). I can authenticate from 444 to the server, and I can receive calls from
2006 Apr 12
13
Public Directory not accessible
Been trying to deploy my rails app on Redhat ES3, Apache2, FastCGI with Plesk all day. Fun stuff. Basically, the issue that I can not solve has to do with access to /public. None of my images, javascripts, etc. are working in the app. Trying to access any of these results in a 404 (or routing error if in developer mode). Oddly, the 404 file it displays is -- you guessed it -- in fact *in*
2003 Feb 06
1
Trouble with include/exclude patterns
I'm using rsync 2.5.4 on my RedHat 7.3 client laptop and rsync 2.5.5 on my RedHat 8.0 server. On the client, I have a directory "rpm" with 5 subdirectories, out of which I only want to copy the one called SRPMS across. I also have another directory ".mozilla" out of which I want to copy across 2 files. I have constructed the following rsync invocation: rsync -e ssh -av
1998 Apr 07
2
Netscape profile scripts?
A while back there was a thread in which many people were discussing how to make Netscape work with roaming profiles. There was some talk about how this would require a script to modify the registry, etc. I just talked to one of the NS programmers who said that the problem would be fixed and even enhanced in a version 4.5. He didn't say whether the 4.5 code was going to be an internal or
2006 Apr 19
4
Another DRY question
I have some code working that lists only items from a particular user. The code in my list action finds the user and then conditionally lists only his/her items: def list user = User.find(session[:user]) user_id = user.id @product_pages, @products = paginate :products, :per_page => 10, :conditions =>[''user_id = ?'', user.id]