similar to: Parse request URL.

Displaying 20 results from an estimated 8000 matches similar to: "Parse request URL."

2006 Feb 27
5
Database connections...so many connections!
Hello all. I am currently running a very simple ruby app. It connects to an Oracle server using the OCI8 adapter. I have two controllers, each one connects to a different schema on the server, I looked at the WIKI that had details of multiple database connections (http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases), I moved the code from the application controller into each
2012 Nov 02
1
[Rails 3.2.8] issue in regex scan
running a scan in irb is fine : 1.9.3p194 :001 > request_url = "http://lvh.me::3000/en/backoffice/cms-admin/site/6/pages" => "http://lvh.me::3000/en/backoffice/cms-admin/site/6/pages" request_url.scan(/^([\S]+)(backoffice\/cms-admin\/site\/)(\d+)(\/pages)$/)[0][2] => "6" however running it in my controller doesn''t gives any result : (rdb:1)
2006 Mar 27
5
Accessing Session Object from a model
i realise that this goes against the basic idea of the MVC architecture, but i''ve found myself in a situation where i need to get information about the current user in a model & i''m not sure how to do it. Basically, we have a product where each customer has their own profile with data stored in a separate database. There are some tables in a common
2006 Jul 11
1
Nil.
before_filter :login_required @session[''user''] ||= {''login'' => ''guest''} if @session[''user''].login.downcase != "mohammad" || "nick" redirect_to :controller => ''login'' end what''s wrong with this I need this is an admin area is there an eaiser way to do this? Or an error
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a test that sees if a controller redirects to the correct place and preserves the query string. Here?s the code: class LoginRedirectTest < ActionController::IntegrationTest def test_non_admin_auth request_uri = "/datafeed/event/report?blah=blah" get(request_uri) follow_redirect!
2006 Jan 13
1
How to disconnect to a database????
Hi, We have experienced some problems with ActiveRecord::Base class of Ruby-Rails. We are building a web-application based on the Ruby-rails framework and the web-application needs to access to difference databases, so we do not pre-define our database accesses in the database.yml file. In fact, we are using the ActiveRecord::Base.establish_connection() to connect to our database, the function
2009 Nov 01
9
Dynamic Database Connections
Hey everyone! I have a problem that''s been making me a little nuts. I would like to use RoR for a upcoming project, but if I can''t get past this hiccup I''m afraid I''ll have to use PHP or Java. Ugh. The application needs to have a database-per-customer model. So when I do a Product.find(:all) I need to make sure i''m connecting to say acme.products
2006 Jul 19
1
flickr.rb error
hi all, i am trying to put flickr on my ruby app using the famous "Putting flickr on Rails" tutorial...i followed all the steps what was given there...but the followoing error always come... Error Message: NoMethodError in FlickrController#search private method `gsub'' called for 24:FixnumRAILS_ROOT: C:/rails/flickr/config/.. Application Trace | Framework Trace | Full
2007 Oct 26
3
Selecting a database from the application itself?
Hi everybody, I just started thinking about a project and am seeking some help regarding its design. The idea would be to create labels (i.e. address labels).I could let users type the text manually, but I dont think they would appreciate that when they''ll want to print 5000 addresses. I can also probably let them import csv files, that should not be a problem, but playing with those
2007 Jan 22
5
multiple database users for rails app?
Hey guys. Per my IT department''s policies, I need to have two separate database users for my rails database - one for public intarweb functionality, one for authenticated users'' functionality. The naive way to accomodate this would be to break the app up into two separate apps, but since they share the same models and resources, DRY suggests this isn''t the proper thing
2006 Mar 08
4
unless connected? + multiple databases
Hello all. I am still having fun with multiple databases. In this case it is the unless connected? statement. ActiveRecord::Base establishes a connection that is inherited by the majority of my models. However one Model (Componentlog) that uses a separate DB is coded as: unless Componentlog.connected? establish_connection( :adapter => "oci", :database =>
2006 Jul 28
2
change url based on account name
Hi, Is this possible Can I specify a url ie http://localhost/AccountName/:contorller/:action/:id Where AccountName is should be a userName, which will lookup a siteId in the database? Whats the best way of going about this, is there somthing in the routes.rb file I can change to get the account name into a variable? Thanks for your help jon -- Posted via http://www.ruby-forum.com/.
2006 Feb 27
1
decode URL
Hi, I have a URL with encoded characters, I want them to be decoded. Is this possible in the routes.rb? e.g. decoding the @params[category] map.connect ''performances/:category'', :controller => ''performance'', :action => ''list_performances'' regards, J?rg
2006 Apr 28
3
Handling errors - incorrect value entered in url...
I have many "edit" actions in my project. If the url is like http://localhost/project/3/edit and someone enters http://localhost/project/3333333/edit the edit action will fails because it cannot find a project with id of 3333333. To combat this I am adding to every action like edit: rescue redirect_to :action => ''index'' flash[''errors''] =
2006 Jan 09
5
Formatting timestamp objects
I want to print my timestamp objects in a specific format. I want to print a date like this: Sunday, January 8 2006 I don''t want it to print January 08. For the time, I want it to look like this: 9:08 pm Not 09:08 and lower case PM. I created these methods: def format_date(date) date.strftime("%A, %B #{date.day} #{date.year}") end def format_time(date) if
2006 Aug 01
8
Dumb views?
Hello again! I''ve another "what would you do in this situation" question. You''ve got 6 controllers, one named base. The other 5 controllers extend base. Currently they share one layout. Your layout displays navigation. However, there are two actions inside base for which you do not want navigation displayed (index, new). Do you... a) Add logic to your layout telling
2006 Jan 09
3
Pagination :conditions not working - MySQL v. PostgreSQL, Rails abstraction v. embedded SQL
Hi everyone, I have this code: @person_pages, @people = paginate :person, :per_page => 20, :conditions => [ "username LIKE ? OR first_name LIKE ? OR last_name LIKE ? OR preferred_name LIKE ?", "%" + params[:q].downcase + "%", "%" + params[:q].downcase + "%",
2006 Jul 12
3
How to get the current URL?
Hi, how can I get the current URL withing a controller? There seems to be no appropriate method in ActionController::Base. I''m creating a site, which requires a login for some pages. I''m using before_filter for authentication. My idea was to store the currect URL in a session before redirecting to the login page and then redirect to this URL after successful authenfication.
2006 May 02
4
useful bit of code (hopefully)
Hi, I often find myself using bits of code like this inside ActiveRecord, perhaps it''s useful for others, or others can improve on it: ########### # fix user input before validating it before_validation :sanitize_input # santize input before actual validation is called # this uses the little methods defined below def sanitize_input trim %w(adres postcode woonplaats email naam
2006 Feb 08
8
Strategies for Unit testing 2 databases
Hi, My application spans 2 (or more) databases for some very specific reasons... My models are working fine, even dynamically establishing connections as needed at runtime, and spanning relationships across the databases (which really impressed me). The problem is, I can''t seem to force Units for these models (that use a secondary db) to load their fixtures into and use the