Greetings,
I want to tinker with the global memcache object, and I found the following problems.
Cache is a constant
Cache is a module
I only want to modify the behavior of Cache globally for a small section of code for a possible major performance gain.
Since Cache is a module, I can't re-assign it, or encapsulate it.
I Would Lik...
So I'm trying to get the user to return to the page they were looking at before they click "log in"
This is what I got in my user application controller:
def redirect_back_or_default(default)
redirect_to(session[:return_to] || default)
session[:return_to] = nil
end
And this is what I have in my sessions controller:
def new
...
Rails is setting and returning a remember_token cookie like this:
= cookies[:remember_token]
= value6c69b17681d2bf316f8eexpiresThu Jun 10 14:55:00 -0400 2010
In other words, when I'm calling the cookie I don't just get the value. Why is this?
I am setting the cookie as follows:
cookies[:remember_token] = { :value => @user.remember_...
Sometimes I watch screen casts where someone is using text mate.
I'm a rails developer, so these are rails screen casts.
They'll type something like:
def
for example
and "end" will automatically appear underneath.
I do have the bundle for Rails enabled - why doesn't this happen for me?
Thanks!
...
I'm building an app which will allow a user to scan the barcode on a 'shelf', 'box' or 'product' which will then bring up that particular item or all the associated items.
As these are all separate models with their own ID's, I need a global ID table.
I was thinking of a polymorphic table called 'barcodes'
barcodes
id
barcode_numbe...
I'm trying to override as_json in one of my models, partly to include data from another model, partly to strip out some unnecessary fields. From what I've read this is the preferred approach in Rails 3. To keep it simple, let's say I've got something like:
class Country < ActiveRecord::Base
def as_json(options={})
super(
:o...
I'm working on integrating a shipping solution into a Rails ecommerce app. We're only going to use one shipping provider. So the question is: FedEx or UPS?
I'm wondering what Rails developers think about the tech side of this question.
What do you think about the APIs, ease of integration, focus on developer's needs between FedEx a...
I'm trying to create a perma link for a nested attribute.
For example, look at the links for the answers in SO. I would like to do something similar in rails:
I have Project model with multiple tasks and I would like to create a perma link to a task.
The task can only viewed with the project, just like Q & A on SO.
Ideally, i woul...
I want to run a paperclip method on create only
has_attached_file :file
This method doesn't seem to accept the :on => :create that some other rails methods do.
I tried:
before_create
after_create
etc, but those didn't work.
I also did:
if :create
How can I test if the controller is using the create method from the model?
Than...
I have the following at the top of my view:
<%= GMap.header %>
Heroku is giving me an ActionView::TemplateError on that line.... this works on my own machine but not on Heroku.... why is that? Is there something about Heroku that doesn't allow?
In the final compile on the browser, the above code translates into this on the client si...
Is there a way to check which controller method was called from within the model?
Example:
Say the controller create method was called:
def create
do something
end
Then in the model do something only when create in the controller was called
if create?
do something
end
...
I am displaying a list of articles. I sort my articles by the param order and I want when displaying the list of article to be able to "move" them up or down.
In php I do everything with a for browsing my array of results and inside the for I go to the next index to find where I am in the list, and with which other article I must swap m...
I'm working on an app that needs to be able to send out email updates and then route the reply back to the original item.
All emails will come to a single address (this can't change unfortunately), and I need to be able to determine where they go. My initial thought was setting the message-id for the item so that it comes back as a Ref...
I am experimenting with Rails and was wondering what's needed to allow/add support for JSON requests?
I have a vanilla installation of Rails 2.3.5 and the default scaffolding seem to provide support for HTML & XML requests but not JSON.
class EventsController < ApplicationController
# GET /events
# GET /events.xml
def index
@...
Hey,Guys!
In rails , I met a question!
when i use the multiple select ,i don't know ,how can i get the all parameter values ,it likes
in javaEE,
String[] strs=request.getParameters("aaa");
so,who can tell me the method in rails to realize the function?
Thank you in advance!
...
I have a resource
/system/resource
And I wish to ask the system a boolean question about the resource that can't
be answered by processing on the client (i.e I can't just GET the resource
and look through the actual resource data - it requires some processing
on the backend using data not available to the client). eg
/system/reso...
I'm in the process of migrating from Prototype to jQuery and moving all JS outside of the view files. All is going fairly well with one exception. Here's what I'm trying to do, and the problem I'm having. I have a diary where users can update records in-line in the page like so:
user clicks 'edit' link to edit an entry in the diary
...
Two models:
Invoice
:invoice_num string
:date datetime
.
.
:disclaimer_num integer (foreign key)
Disclaimer
:disclaimer_num integer
:version integer
:body text
For each disclaimer there are multiple versions and will be kept in database. This is how I write the ...
I opened a heroku account.
I followed the instructions on http://docs.heroku.com/quickstart.
I have a working rails app which I have deployed successfully elsewhere.
I have a github account that works.
I have a local git repository for my rails app.
I installed the heroku gem. It shows up in my gem list.
I typed 'heroku create' at the c...
Background Job gets mentioned a lot but all the tutorials I've seen seem to indicate that its for queuing jobs which are created by some external event such as a user clicking "Send mail".
But what about when you have code that needs to scheduled to run every 30 seconds to listen for new messages from twitter?
Normally rake is recommen...