I have a Rails app that is deployed on a machine but not to the root of that machine using Passenger (i.e. RailsBaseURI /myapp). I've tried to set up map.root to point to one of my controllers in the routes:
map.root :controller => :target
and it's redirecting, but not to the right place. Instead of going to www.mymachine.com/myapp/t...
Hi All,
I'm new to JQuery and so far I'm using prototype. But now I want to use JQuery and the thing is I done want to change my old code, which uses prototype
I installed jrails plugin also
my question is can i use
new Ajax.Updater etc.. kind of methods with JQuery (having the jrails plugin installed)
(it doesnt work for me)
BTW -...
Hello,
I have the following code
select "sales", "price", @salesprice, {:selected => '#{@sales}'}
This is what is in @salesprice
[["All"], ["Sale"], ["Discount"], ["Free"]]
and when select something, and it renders the partial again, it returns whatever is this first element in the select tag :S
Any help is most appreciated, tha...
I,m using Globalize2. I'd like to populate DB with db:seed for different locales: en, de and ru. Is there a better solution then:
categories = [{ :en => 'Health & Beauty', :ru => 'Красота и здоровье', :de => 'Beauty & Gesundheit'},
{ :en => 'Baby', :ru => 'Детские товары', :de => 'Baby' }]
categories.each_index do |i|
I...
I'm currently finishing up testing a new Ruby on Rails app. Just recently, some of the pages do not seem to finish downloading in IE8. In FireFox, Chrome and Safari, everything works perfectly. The pages all validate successfully using the W3C validator.
When I view the page source in IE8, the page has been chopped off around 75% of the...
I need a method that takes a block, and performs something similar to an around_each filter for every method within the block.
For instance:
def method_that_takes_block
(@threads ||= Array.new) << Thread.new {yield if block.given?}
end
method_that_takes_a_block do
method_one
method_two
method_three
end
In this instance I wou...
Hello,
I'm so used to oracle where you can simply
concat(field1, ' ', field2)
but if I'm using activerecord to find the field1 and field2, and I need a space in between, how do I accomplish this?
Cheers for all your help
...
My SQL result @products=Product.find_by_sql() gives me this (
ID title, user_name
1 Product1 Xpeper
1 Product1 John
2 Product2 Xpeper
How can I build XML in my xml.builder view file so the source bould be like this
<products>
<product>
<id>1</id>
<title>Product1</title>
<users>
<user>Xpe...
I have a fragment of JavaScript that I want to add to a page, but only in the production environment. Does rails have a way to insert or conditionally include on deployment. I know I could do "if Rails.env.production?" But I'd rather not do this condition check every time the page is loaded.
...
Given three models that are each nested in each other. If I create the top-level object and build_* the other child objects, I can retrieve all child objects through the relationships before and after save() on the original instance. However, if I try to retrieve the 2nd level nested object after find(:id) the original parent it fails. I...
I'm trying to figure out how to make this hack for attr_accessible to support a really common use case in my code, but really after looking at attr_acessible and ActiveRecord::Base source code for a while, still don't know where to start. I can probably figure it out after digging deeper, but first I'd like to ask if anyone else would f...
I know this seems silly, but I would like to call some of Rails' Text Helpers in a rake task I am setting up. (Thinks like the pluralize and cycle method: http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html)
How would you go about making these available in a rake task, or is it not easily possible?
...
I've got a Trip model, which among other attributes has a start_odometer and end_odometer value.
In my model, i'd like to validate that the end odometer is larger than the starting odometer.
The end odometer can also be blank because the trip may not have finished yet.
However, I can't figure out how to compare one attribute to another...
I've only just started learning ruby on rails and I would like to create an application that will allow me to add files to the database. Currently, I'm developing the rails application using the Aptana plugin for Eclipse and the application is using the default sqllite db.
I have tried generating a scaffold with the following parameters...
edited: followed suggestions. See at end of question.
I have a controller with two functions:
def new
if login_required
@discussion = Discussion.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @discussion }
end
end
en...
Hi-
I'm having trouble getting a Rails app to run in the production environment via Phusion Passenger on Nginx/Ubuntu. According to the docs, the environment is controlled by the rails_env option in nginx.conf ... but it runs in development mode on our box regardless of whether we specify 'rails_env production;' or leave it out (the de...
I'm a newbie Ruby on Rails developer. I have installed the 'paperclip' gem by modifying the config/environment.rb file and adding the following:
config.gem 'paperclip', :source => 'http://gemcutter.org'
and then running rake->gems->install and rake->gems->unpack. Now, I would like to run the 'paperclip' generator however, it does not ...
I'm wondering if there is a way to take an array of ActiveRecord results (or any array, for that matter) and process it in groups of 25 or so. Something like this:
User.all.each(25) do |group|
# Some code that works with this group of 25
end
I'm just looking to avoid doing multiple successive database queries. Thanks!
...
Seems that when i create an object, the time is not correct. You can see by the script/console output below. Has anyone encountered anything like this, or have any debugging tips?
>> Ticket.create(...)
=> #<Ticket id: 7, from_email: "[email protected]", ticket_collaterals: nil, to_email: "[email protected]", body: "hello", subject: "tes...
I'm not getting any undefined constant errors or anything, so I know the plugin is at least installed. The page shows up, but all there is is an empty div tag:
<div id="map" style="width:400px;height:300px" ></div>
...and no map.
Controller:
@user = User.find_by_email(session[:email])
@tickets = Ticket.find(:all, :origin => [@user....