I would like to know if it's possible to set specific ruby environments to specific sites.
In /etc/httpd/conf/httpd.conf
LoadModule passenger_module /home/user/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /home/user/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.15
PassengerRuby /home/user/.r...
I need to do the following:
<% for customer in @customers do %>
<%= customer.orders.count %>
<% end %>
This strains the server, creating n queries, where n = number of customers.
How can I load these counts along with my customers in one query? Thanks.
...
To truncate an ActiveRecord table, I can do
Category.destroy_all
or
Post.destroy_all
How does one go about truncating a categories_post table?
...
I was wondering if it would be better to have things like perishable_token (used for account validation and resetting of passwords), banned (boolean to check if the user is banned), email_verified (boolean to check if user's email has been verified) in a separate table in the database, as it will rarely ever be used.
Also, I have my app...
In Ruby on Rails,I got a string number is made of 3 parts : prefix , counter , suffix
In model Setup:
def self.number
prefix = setup.receipt_prefix.blank? ? "" : setup.receipt_prefix.to_s
counter = setup.receipt_counter.blank? ? "" : setup.receipt_counter+1
suffix = setup.receipt_suffix.blank? ? "" : setup.receipt_suffix.to_s
each i...
I'm trying to get started using the Google Data API for Google Book Search in my Ruby on Rails 3 application, and I don't even understand how to get started. What gems do I need? What do I need to do in order to do something simple like searching for books with a title of Foobar?
...
How can I determine if a user is online or not? Preferably a group of users. I was thinking everytime a user visits a page create a record in the db with time.now and use ajax periodic call to remote to see if the time from last is say 10 minutes?
...
I'm submitting a parameter show_all with the value true. This value isn't associated with a model.
My controller is assigning this parameter to an instance variable:
@show_all = params[:show_all]
However, @show_all.is_a? String, and if @show_all == true always fails.
What values does Rails parse as booleans? How can I explicitly spe...
Out of the box, the devise gem asks for a user's email address and uses that to sign in (authenticate).
This railscast, "Customizing Devise", describes clearly how one can authenticate with a username in lieu of an email. How would one configure devise to try to authenticate against two different columns, either username OR email?
...
def create
@asset = Asset.new(params[:asset])
respond_to do |format|
if params[:Filedata]
@asset = Asset.new :swf_uploaded_data => params[:Filedata]
@asset.user = current_user
@asset.save!
format.html { render :text => @asset.image.url(:thumb) }
format.xml { render :nothing => true }
else
if @asset.save
...
This server runs on Ubuntu 10.04, particularly on Linode VPS.
Passenger Error:
A source file that the application requires, is missing.
It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries ...
I'm adding an ajax form through an ajax call from a similar form. The newly added form doesn't work. I'm using rails 3 and jquery. Here is my code:
update.js.erb: /* adds a form that can be used to create a new Xyz. Submitting the added form should use the create action which executes create.js.erb */
$("#mytable tr:last").after("<%= e...
My question is in bold (see below) but I hope to provide some insight into my issues just in case it helps anyone who could answer my question.
I'm not sure which framework or language is the best for this job but I'd like to make an app that has two or three independently scrollable areas, similar to a 2 column template, that are all d...
Hi all,
I need some of my emails to go using "smtp" and some others using "sendmail". Is there a clean way to switch between delivery methods depending on the mailer method?
Thanks!
...
Hi , i am new to Jersey in calling Rest Api
I created a New Blog Bean project in NetBeans and added the Jersey libraries as
package blogbean;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfi...
Firefox- windows-XP- A dot is appearing as you click on like link.
1) When i Log in the site,
2) Enter search criteria,
3) Now click on "Like" link,
Result:-a dot is appearing only at the time of liking
the response.
Its an UI issue, dot appears only when the link is clicked i.e when focus is on the link.
Can anyone suggest?
...
Suppose i have indicated that network is a resource. I am adding a new action, say "submit_question_for_network" to the controller.
However, after I added the action to the controller, it does not work
# does not work
/network/submit_question_for_network
# need to add to :collection
map.resources :network, :collection => {:submit_...
Hi,
The beauty of fast paced frameworks like Rails is that it allows you to deploy quickly- sometimes that comes with a price of having to find ways to scale later.
Twitter seem to still be having problems scaling, even though they have been working on this problem for well over a year.
I was wondering - what is preventing them from sca...
I want to create an web application that will link up a student's facebook, twitter and orkut accounts all under one shed. Its like connecting all the students within a college, to login into the web app, the userid will be the unique studentID provided by the college
itself.
Now, once a student has logged-in, he can open his facebo...
Beginner here, stuck wondering what I need to do to learn development in different web environments. Say, for instance I want to play around in PHP & MySQL. But I also want to try things with Ruby on Rails and maybe even server things with Python. Do I need a different environment for each platform? Am I required to have a virtual ma...