I'm looking for a restful way of passing through options to a service. Right now I have a devices resource accessed in standard rails manner with:
map.resources :devices, :member => [:historical]
So I can get my device with /devices/:id and I can get historical data with /devices/:id/historical
I'd like to actually add a param onto ...
I have a bunch of SQL statements to execute on a database. (I'm doing things that Rails doesn't provide methods for, as far as I know: creating views, adding foreign keys, etc. It's mostly for non-Rails interaction with the data.) In essence, I'm doing the following:
sql = "statement_1; statement_2; statement_3; etc;"
ActiveRecord::...
Hi,
I have been searching for a way for resumable file upload in RoR. In conclusion, I found out other than Java Applet no client-side-and-cross-platform agent can access the file system in such a way that to request the file from the position where the upload got terminated (due to any reason) with some exceptions like http://github.co...
This is probably an RJS thing, but I'm a little unsure how to update a facebox properly if it contains a form. Let's say that I've got a sample app that does this:
<%= facebox_link_to "Something", :url => some_path %>
which renders a facebox (no issue here) like this:
<% remote_form_for(@something) do |f|%>
<%= f.error_messages %>
.....
I am writing an ASP.NET MVC 2 site with REST endpoints. I want to consume this service with ActiveResource in a Rails web application.
So far, I've managed to get routes setup in ASP.NET MVC that match the ActiveResource conventions. But where I'm having problems is with de-serializing the data that ActiveResource sends to the REST se...
I recently ported my gem management to bundler, to get my app to play nice with heroku. Upon doing so I started to see the following errors (though my app is running fine):
config.gem: Unpacked gem environment.rb in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem environment.r...
Is there a way to capture the querystring and send that along as part of a form post? I'm using Rails 2.3.5 and my user is on a page that has multiple querystring parameters. On this page, they are going to submit a form. Inside the action that receives the post, I want to know what those querystring parameters were. Obviously, they are ...
I'm trying to think ahead a little and avoid myself some extra pain if possible.
I've had this problem in past applications and have usually opted for the most verbose approach but would like the opinions of a few others.
If you have a basic table such as below, is it wise, and/or more efficient to include a field which includes a calc...
I'm just diving into ActiveRecord and have not been able to find an answer to my question. If I am updating an object's attributes and then calling save()... will ActiveRecord save to the DB ONLY when the new values are different from the old values?
Let's say I do something like this:
thing_to_update = Thing.find_or_create_by_code(so...
I have Haml/Sass installed as a Gem and using it with Rails. I can't figure out, how to pass options like template_location and style to Sass. Sass::Plugin.options doesn't work (since Haml/Sass isn't installed as a plugin). The gem is required through Rails::Initializer#gem.
Thanx a lot for help!
...
My team is currently using Authlogic for user authentication, which disables a user's account after 6 failed_login_attempts. I want to re-enable such a user's account after a 15-minute time period. The problem is that we are deploying to the Rails cloud host, Heroku, which offers only a one-hour cron job and a daily cron job. I seem to n...
I have a website which useses a mysql database for its whole operation . But for a new requirement i need to query a external oracle database( used by other component) and compile a list of items and display in a page in the website. How is it possible to connect to a external database just for rendering a single page.
And is it possib...
So I'm new to Rails and I'm trying to figure out what the canonical way to add custom form elements is. Currently the way I'm doing it is super grotty.
module ActionView
module Helpers
module FormOptionsHelper
def some_new_field(object, method, options = {}, html_options = {})
#code code
end
end
class...
I have a website and before i included the design and some changes(layout, scripts, etc), it was working fine. Then, I don't know what happened but the onChange method from my select field is accessing "show" action instead of the one that's written in the line.
I have the following at my New view:
<%= collection_select('category', 'id...
Is there a way to get Authlogic to validate the format of a password, for instance must contain at least one letter and at least one number? The omission of a validates_format_of_password_options method to be used in the acts_as_authentic config block seems to indicate that Authlogic has the opinion that one should not be imposing such ...
Hi everybody,
I have a XML-file, which I want to send to a rails server. To do so I use the following code:
<mx:HTTPService id="dataService"
result="resultHandler(event)"
resultFormat="e4x"/>
In a Function triggered by a save button, I do the following:
var params:Object = {};
params["xml_file"] = xmlDoc;
dataService.method = ...
From a cursory glance, they appear to be simply two different approaches to the same set of problems, except that named scopes are chainable, while association extensions are not.
Can anyone explain further, or provide an example that would be more appropriate for an association extension than a named scope?
...
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => 'created_at desc'
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
be...
for my CMs i want to be able to easily add new themes, my idea was to simply add a mime type for the new theme (so application.theme1.erb would work).
but for 99% of the themes im not going to want to change the views, well not all of them.
is there someway to have rails fall back on html if the themed view isnt present?
...
I have a combined Sinatra/Rails app that shares a session using Rack::Session::Cookie. The app works fine when started with Rack::Handler::Thin.run app, but if the rackup file is start with thin start, I get an error in Rack::Session::Cookie:
!! Unexpected error while processing request: no marshal_dump is defined for class Proc
no mar...