I want to set a route :requirements on an array that verifies a particular parameter is included in an array:
atypes = [:culture, :personality, :communication]
map.with_options(:path_prefix => ':atype',
:requirements => {:atype => atypes.include?(:atype)}) do |assessment|
...
end
I haven't been able to find any documentat...
This is what I did.
> git clone git://github.com/rails/rails.git
> cd rails
> cd railties
> rake
And I got following error.
(in /Users/dorelal/dev/scratch/rails/railties)
./test/isolation/abstract_unit.rb:236:in `initialize': No such file or directory - /Users/dorelal/dev/scratch/rails/railties/tmp/app_template/config/boot.rb (Errno:...
./script/rails g generator admin
class AdminGenerator < Rails::Generators::NamedBase
def self.source_root
@source_root ||= File.expand_path('../templates', __FILE__)
end
def manifest
#I know I can copy my template files with the 'template' method
#How I can generate a migration, and a model here ?
end
end
...
I have a ROXML object that looks like:
class Activity
include ROXML
xml_accessor :id
end
If I have an array of these objects and call .to_xml on the array, I receive an empty xml collection:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<activities type=\"array\">\n</activities>\n"
Any idea why or how to fix this?
I'm running R...
hi,
anyone know how to create a suggestion box in ruby on rails? all the materials i found so far are about observe some text field and update some list in other , not related to suggestion box...
Thanks!
...
I am using a sharded db - horizontally partitioned. I am using the DataFabric gem from FiveRuns.
What would be the implications of using memcached on this? Would it work the same as if I was using ActiveRecord?
...
I'm adding a categorization functionality to my app and struggling with it. Objects have many categories through categorizations. I'm trying to intercept the creation of a new categorization, check if theres a similar one, if so, increment it's count, if not, create a new object. Here's what I have so far.
validate :check_unique
...
Say I have http://www.mysite.com/I-Like-Cheeseburgers and I want that to point to Item with id 3. Sometime later, I change the name of the item, and now its http://www.mysite.com/I-Like-Hamburgers (and perhaps many more times). I want all these URLs to remain pointing to Item 3. Is it efficient to simply keep a table of [strings,item...
So I put in in-place editing for one of my models.
One of the attributes is PRICE.
I used the to_currency method to format the value before it is displayed.
The problem I'm having is that with the in-place editor, I just can't figure out how to set a custom display value.
I'm trying to get the price to display as $20.00 until it is cl...
I want to give the users the ability to change their account info with restful_authentication plugin in rails.
I added this two methods to my users controller:
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
# Only update password when necessary
params[:user].delete(:p...
A couple of times I've been in the situation where I've wanted to refactor the design of some model and have ended up putting update logic in migrations. However, as far as I've understood, this is not good practice (especially since you are encouraged to use your schema file for deployment, and not your migrations). How do you deal with...
I have 3 relevant tables.
User, Orders, and Viewables
The idea is that each User has got many Orders, but at the same time, each User can View specific other Orders that belong to other Users. So Viewables has the attributes of user_id and order_id.
Orders has a
:has_many :Users, :through => :viewables
Is it possible to do a find thr...
how can i check if an ID of a clicked element is lets say 'target'.
what i am trying to do is actually show and hide comment form on clicking in the text field and hide it when the user clicks out of the form. the problem is that if the user clicks Submit button the form hides and nothing is sent over. so i'll have to check if the submi...
Is there an easy or at least elegant way to prevent duplicate entries in polymorphic has_many through associations?
I've got two models, stories and links that can be tagged. I'm making a conscious decision to not use a plugin here. I want to actually understand everything that's going on and not be dependent on someone else's code that...
I'm using a few different gems here (Devise, Warden, Warden_Oauth), but I think you could answer this question without necessarily being familiar with them. I'm trying to execute a Twitter Oauth strategy, where the app first looks for a user by an access_token and access_secret, and then if it doesn't find one, it creates a new user. I c...
we are currently developing a high traffic facebook application. all the traffic will be within one month, where there are 500.000 to 1.000.000 expected users.
after that month, the game is over and we have a winner - so the app will be archived.
we are currently planning to develop the application with ruby on rails and searching for h...
Hi guys, i am familiar with memcached and eager loading, but neither seems to solve the problem i am facing.
My main performance lag comes from hundreds of data retrieval calls from the database. The tricky thing is that I do not know which set of users i need to retrieve until i have several steps of computation.
I can refactor my c...
Hi all,
I have a relatively simple problem. I have a model named Item which I've added a status field. The status field will only have two options (Lost or Found). So I created the following array in my Item model:
STATUS = [ [1, "Lost"], [2, "Found"]]
In my form view I added the following code which works great:
<%= collection_sele...
I am looking for tasks like tmp:clear or db:migrate. Where can I find the code for these tasks. I remember seeing them before but don't recollect where.
Also, is there a way I can set some global variables in a .rake file that can be accessed by all tasks
in that file without passing them as arguments to each task.
thanks,
ash
...
----edit-----
QUICK QUESTION: Does Grails take too much resources for high traffic website, and is it expensier to host?
For example: if I can make a site that has millions of users/m easier in CakePHP does it worth to make it in Grails just to save some webserver resources- or will it need more servers?
---------------
Hello,
I kn...