Hi all,
I'm using will_paginate to paginate my geokit search results. The code works, however, when looking at the log it does double the geokit query when using the following will_paginate call:
@posts = Post.paginate :page => params[:page], :per_page => 1,
:origin => @search, :within => @miles, :include => :u...
Currently, a date picker is shown by:
<%= select_date @blog.date, :use_short_month => true %>
it is shown as 3 drop down lists, example:
[2009] [Jun] [4]
how can I change the [yyyy] [mmm] [d] sequence to [d] [mmm] [yyyy] dynamically when the form loads? So it looks like:
[4] [Jun] [2009]
Note: changes required to be done in ...
Hi,
I am new to Ruby on Rails. I am using Netbeans IDE. While importing a new project, I used the inbuilt JRuby 1.4 that comes with Netbeans as the Ruby version. The main reason I want the JRuby is because of its debugging abilities.
Now the doubt/problem I have is integrating libraries/plugins. One of the assignments I have requires ...
I have objects that have comments. As part of a periodic email summary, I want to determine comments for a period, and present the objects in the order of oldest commented object first.
Data:
object_id comment_id
30 40
40 42
32 41
30 43
32 44
Output:
Object #30
comment 40
comment 43
Objec...
I have a dedicated server that hosts about 70 domains... some are just plain php static websites, others are wordpress websites and a few others are on ruby on rails.
In the past few days I have experienced very slow queries on mysql server...
Queries like:
SELECT * FROM users WHERE id = 5
takes 1.8 secs...
I enabled the slow q...
It seems that inside of HAML's :javascript filter, no Ruby code is
allowed, not even a comment.
So this is NOT allowed:
:javascript
- 1.upto(10) do |i|
:javascript
-# just a comment not to show to public
(somebody said there is not way to hide comment like that inside a
:javascript filter. Is that true?
but it seems the only t...
The illustration is like this:
class Product
end
class SalesOrder
belongs_to :product
belongs_to :customer
att_accessor :deliverable
# give all sales orders that are deliverable because the stock is ready
# and also assign deliverable
def self.calculate_deliverable
all_so = SalesOrder.find(:all, :order => 'input_date ...
I'm trying to get Capistrano deploying my web app. I'm deploying a php app using remote_cache from a git repo to a Linux host via a Windows computer. Everything is deploying okay except that it doesn't copy over the .htaccess files. I'm new to Capistrano and Ruby, so any pointers would be helpful!
Capistrano 2.5.18 with Ruby 1.8.6 on...
I have the following in the view:
<% unless contact_email.statuses.empty?%>
(<%= contact_email.statuses.find(:last).status%>)
<% end %>
contact_email is an instance of a specific model.
Could I do something like this?
class ContactEmail < ActiveRecord::Base
attr_accessible :contact_id, :em...
I am trying to communicate with a RESTful service in Rails. It can return data in different formats, json and xml. Is there a specific way that I can get the data type that I want.
The service mentions that ACCEPT needs to be set in HTTP header. I am not sure how to do that in Ruby.
Currently I'm doing this for get
response = Net::HTT...
My Ruby on Rails application is consuming around 129 MB of memory.. is this normal?
I have around 3,000 unique visitors a day, i have no complex queries...
My users table has about 18k rows.
...
This is a noob question:
How do I add gems to my rails app in a way that I can just copy my app's directory structure to a remote location and have it just work, with all the gems I depend on installed and available?
...
When I print an ActiveRecord of a Department, I get:
Department:0x210ec4c {
:id => 3,
:name => "Computer Science",
...
:school_id => 3
}
How can I make it give me the School instead of the School_ID? In other words, call to_s on the school found by the school_id. Just lik...
We generate an unique token for each user and store it on database.
Everything is working fine in the local environment. However, after we upload the code to the production server on Engine Yard, things become weird.
We tried to register an account right after the deploy. It is working fine and we can see the token in the db. But afte...
Hi,
i have some action in my rails application
def show
@issue = Issue.find(params[:id], :include => [:answers, :comments])
@answers = @issue.answers
@comments = @issue.comments
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @issue }
end
end
and rspec test
def mo...
Is something like this possible?
Product.price_greater_than(10000).or_tags_name_equals('luxury')
The wiki doesn't help much on this...
I saw in the wiki:
User.id_or_age_lt_or_username_or_first_name_begins_with(10)
=> "id < 10 OR age < 10 OR username LIKE 'ben%' OR first_name like'ben%'"
I really don't get that, how in the worl...
I have few variables which are used system-wide in my rails app. It runs well if I just have one user using the app. If there are more then one user, many unexpected problem pop out. I don't get any error log, and I have many unexpected behaviors. I believe most of those strange response are due to unexpected change of global variable.
...
Models:
* Person
* Club
Relationships
* Membership
* Committee
People should be able to join a club (Membership)
People should be able to be on the board of a club (Committee)
For my application these involve vastly different features, so I would prefer not to use a flag to set (is_board_member) or similar.
I find myself wanting ...
Hello, i am a C# programmer and i am looking in to ruby on rails. but i am having some trouble probably with the mind set or something.
I have an object Vote, that object can be Pro, Neutral or con.
I would normaly make the vote object have a field some thing like this
private VoteEnum voteEnum = VoteEnum.Neutral
how on earth can i ...
My application needs to parse a user-generated CSV file. And, once uploaded, the application will queue it in delayed job to be processed. My question is, how do you usually handle the exceptions that might happen during the content parsing stage? Do you store all the error messages in exception-objects before display it to user?
Thank ...