Accessing URL/URI information in Rails in the environments file?
Hi, How would I access the domain name from Rails inside the environments/deveopment.rb? I want to find out whether or not I am on localhost or a real domain. Thank you! ...
Hi, How would I access the domain name from Rails inside the environments/deveopment.rb? I want to find out whether or not I am on localhost or a real domain. Thank you! ...
class ProfilePresenter < ActionView::Base def initialize super url_for # i got: You have a nil object when you didn't expect it! # The error occurred while evaluating nil.url_for end end url_for doesn't work. why? i make a new instance like this ProfilePresenter.new ...
Using YAHOO.widget.treeview to generate a table with three levels of data: module, submodule, and detail. If there is an image associated with a detail row the javascript generates a link: "<td><a href=\"/screenshot/show/" + rowData.id + "\">Screenshot</a></td>" that is appended to the html for the row. The url is generated correct...
Hi all, I would like to access the ActionController::Request from within the environments/development.rb file so that I can set a global variable there depending on the domain name. Any ideas? Thank you! ...
I'm currently on a Shared server with hostingrails and I'm finding my app to be unbearably slow at times but running at a normal pace at other times. Is there something in the configuration that could cause this or should I think about changing hosts? I'm using mod rails and I'm told that if I don't have many users it can be slow at time...
The title is a bit difficult to put together for this question. Say I have two models, Foo and Bar. Foo has many Bar's. Bar belongs to one Foo. How do I use Foo.find to find all of the Foos that currently have zero Bars? In SQL this would translate into something like: SELECT * from foo where id NOT IN (select foo_id from bar); ...
I'm trying out capybara with cucumber to get some better javascript test coverage. I have a lot of steps that check or use things from the Rails integration test helpers, for instance: assigns(:current_user).should_not be_nil No matter how I call assigns, even if I say something like p assigns it errors with: undefined method `templa...
I've been looking around in Google, but haven't found an answer. Do you guys know any? ...
I'm working with some old code and using ActiveResource for a very basic Twitter integration. I'd like to touch the app code as little as possible and just bring OAuth in while still using ActiveResource. Unfortunately I'm finding no easy way to do this. I did run into the oauth-active-resource gem, but it's not exactly documented and i...
I have three partials that I'd like to consolidate into one. They share the same collection, but each gets passed its own :local variable. Those variables are used for specific Models, so as a result, I have three different calls to the partial and three different partials. Here's the repetitive code: <% for email in campaign.email...
I just read a little about resque here and how you use redis as a "advanced key-value store" for the jobs. As you might know you can use resque on multiple machines to process the jobs: Workers can be given multiple queues (a "queue list") and run on multiple machines. In fact they can be run anywhere with network access to the Redi...
I have a rails app with the config/environment.rb line config.gem 'authlogic', :version => '2.1.2' The system gem for authlogic is 2.1.4 The one in my GEM_PATH is 2.1.2 No matter what I try, Rails is only using the 2.1.4 version, which is a problem. How to force rails to use 2.1.2? Thanks ...
I have a standard jquery ui accordion and I load content into it using a link_to_remote tag (in the accordion header). All this works fine. The problem is, once the content is loaded, I dont want a ajax call, I just want the accordion to fold, like it should normally do. I tried doing this using the following jquery but clicking the head...
Hi, Has anyone got any suggestions on where to start with building a google map into a rails app? I would like users to be able to add a marker by clicking the map, and have spent a few days looking for a suitable tutorial or plugin (beyond ym4r), to little avail...any help would be much appreciated as I am finding the Google Maps API r...
Re-factoring dbase to support many:many:many. At the second and third levels we need to preserve end-user 'mapping' or aligning of data from different sources, e.g. Order 17 FirstpartyOrderID => aha LineItem_for_BigShinyThingy => AA-1 # maps to 77-a LineItem_for_BigShinyThingy => AA-2 # maps to 77-b, 77-c LineItem_for_LittleWi...
I'm trying to access the RAILS_ROOT constant in a file residing in the /lib directory, but I'm not able to (uninitialized constant error). Is there something that I need to require to be able to do this? Sorry if this is a dumb question.. ...
I have generated some scaffolding for my rails app. I am running the generated tests and they are failing. for example test "should create area" do assert_difference('Area.count') do post :create, :area => { :name => 'area1' } end assert_redirected_to area_path(assigns(:area)) end This test is failing saying ...
So I have a create_table like this for Courses at a School: create_table :courses do |t| t.string :name t.references :course t.timestamps end but I want it to reference TWO other courses like: has_many :transferrable_as #a Course has_many :same_as #another Course can I say t.references :transferrable_as, :as=> :c...
I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by: page = number_of_records_before_RECORD / number_of_pages + 1 Now I want to display the first item of today's events as the first item in that page. Maybe there is a way to generate page numbers around a re...
I must have done something, but am going crazy trying to find my mistake. After my last upload now all my URLs are pointing to localhost:3000 instead of the site. It was working before. :( This is only with items that call the absolute path like style sheets and javascripts. UPDATE - OK, so now everything is working again. Rebooted...