I have a rails app which shows the following log for a single action
Completed in 587ms (View: 415, DB: 29) | 200 OK [http://localhost/]
its taking 415 ms to render the view layer. Is there any way to optimize view rendering in rails ?
I am a beginner in ruby on rails.
I have render call like this on a page(written in HAML) that show...
This is more to do with maintenance issues for a Rails app. Currently , it has a lot of stored procedures (Postgres -pgsql) and I 'm wondering if I should do away with them and translate them into Rails classes. Performance-wise would rails classes be a better idea than pgsql stored procs? Thanks!
...
I've got a view for entering / editing posts.
I want to stop people from creating or editing posts if they are not logged in (in the model) & I want to redirect the ./posts/new view to the posts list with a "You cannot create new posts if you're not logged in" message.
I've tried changing the "new" command in the posts controller as so...
Hi,
Can any one guide how to search number with wildcard on thinking sphinx...
I have tried, by using
User.search "12", :star => true
which result only 12
but i need to display the number whichever has 12. like prefix and suffix...
...
I am using rvm
rvm list
rvm rubies
jruby-1.5.0 [ i386-java ]
jruby-1.5.1 [ i386-java ]
ruby-1.8.7-p299 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]
with:
rails -v
Rails 3.0.0.rc
ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
However, when starting rails (with either webrick or thin), the ruby interpretor used is ru...
Hi Guys,
when creating users with restful_auth everything works fine,
but changing the user in his lifetime doesn't work.
I already added the concerning attributes to the attr_accessible list.
It all doesn't help.
Any ideas?
Yours,
Joern.
...
This is how my RoR app is setup
note.rb
belongs_to :user
has_many :note_categories
has_many :categories, :through => :note_categories
category.rb
has_many :note_categories
has_many :notes, :through => :note_categories
I want to make it so that when a user deletes a note, the corresponding entry in the note_categories table is del...
Hi Everyone,
I am trying to get dynamic select menu's working in my Rails application.
I have a model called kase, a model called person and a model called company.
When a user creates a new kase, they are presented with a select field to choose a Person and a select field to choose a Company.
I am trying to make it dynamic, so if t...
I want to use REST in an Rails application that uses inherited_resources,
but I want certain properties not to be revealed during json and xml request.
Let's call that field 'password'.
I know I can overwrite the to_xml and to_json methods and then
super :except => [:password]
But I would have to do that for to_xml and to_json. Not ...
Ok so I have a site with users.
I want a user to be able to send a message to multiple users based on a search query.
Eg.
John searches for "Florida" and this search returns 1 million users/companies.
Whats the best way to let john send a message to all those users/companies returned by the search result?
Lets say, Susan was 1 of thos...
If you use something like each_hash to loop over a Mysql::Result set in Ruby when using the Mysql gem then you end up at the end of the result set and any subsequent each_hash loop doesn't have anything to loop over.
I see there is a Mysql::Result#row_seek method, which expects a Mysql::RowOffset object. But I'm unable to find any docum...
I am using Memcached as an Object Store with my Rails application where I store search results which are User objects in memcached
Now when I fetch the data out I get the Memcached Undefined Class/Module Error. I found a solution for this problem in this blog
http://www.philsergi.com/2007/06/rails-memcached-undefinded-classmodule.html...
For every project it's like having two parts: the Rails application and then all documents and pictures related to it.
I wonder how you organize them both.
Do you put everything under the same project root folder and apply Git on that folder or don't you protect your documents with Git at all?
Then, what if the docs are too sensitive ...
My file upload is working fine on IE.
But it's returning "406 not acceptable" error on firefox.
Any solution?
...
I have a lot of has_many :through relations in my app. I am extensivley showing informations related to this, such as number of connected objects. Whenever user updates the relation, join table is modified, and I can catch this my Sweepers.
The problem is, that join table entries are deleted, not destroyed. If relation is gone, I have ...
I can't seem to install the MySQL gem. I'm using this command:
ARCHFLAGS="-arch i386" gem install mysql --
--with-mysql-dir=/usr/local/mysql/
--with-mysql-config=/usr/local/mysql-5.1.50-osx10.6-x86/bin/mysql_config
The errors that I am getting seem to indicate that I have no headers and etc. Not sure where I can get those. I'm on Sn...
Hi,
I'm trying to get records from database, which are associated with another record based on conditions. This record can have either a "has_many" or "has_one" association to the records I'd like to fetch.
If it's "has_many", I can simply run
known_record.records_to_fetch.find(:all, :conditions => {...})
which will either give me t...
To my understanding the session variable gets cleared when a users closes their browser. Is there anyway to clear the session variable when a users closes a tab in a browser?
The reason I ask is that I need to differentiate two visits if a user is on the site and closes the tab but not the browser, and the user goes back to the site on...
Hi, I've got something like this
class Reply < AR::Base
end
class VideoReply < Reply
def hello
p 'not ok'
end
end
class PostReply < Reply
def hello
p 'ok'
end
end
...
So when I am creating object:
# params[:reply][:type] = "VideoReply"
@reply = Reply.new(params[:reply])
How can I invoke child method (in this case...
My development log fills up with
SELECT name FROM sqlite_master WHERE
type = 'table' AND NOT name =
'sqlite_sequence'
I'd like to turn off the sqlite_master queries in sqlite3, so that I only see the interesting queries.
...