ruby-on-rails

How to solve rake tasks deprecation on the rails plugin?

Because of the concept introduced in here, Rails::Plugin is nothing more than a Rails::Engine, but since it's loaded too late in the boot process, it does not have the same configuration powers as a bare Rails::Engine. Opposite to Rails::Railtie and Rails::Engine, you are not supposed to inherit from Rails::Plugin. ...

Offline access using facebooker plugin

If I use Offline Access on my rhtml page in rails application, how can I get the infinite session key from facebook? so that I can store it in the database & from onward users on my website do not need to connect to facebook again? I'm using facebooker plugin in my rails application. Please help. ...

Rails, REST Architecture and HTML 5: Cross domain requests with pre-flight requests

While working on a project to make our site HTML 5 friendly, we were eager to embrace the new method for Cross Domain requests (no more posting through hidden iframes!!!). Using the Access Control specification we begin setting up some tests to verify the behaviour of various browsers. The current Rails RESTful architecture relies on t...

All permissions with declarative_authorization

Hi, I have a Rails application using Restful authentication and declarative authorization. I have some roles with an admin. Is there any method to have automatically granted all permissions to this role, instead of hardcode every controller in the authorization_rules? Something like: role :admin do has_permission_on :everything, :t...

Non-standard routes in Rails

I currently have a routes.rb file that looks like this: map.resources :profiles do |profile| profile.resources :projects, :has_many => :tasks end And this gives me routes like this: /profiles/:profile_id/projects/:project_id/tasks This is close to what I want, but instead of the '/profiles/:profile_id/' section I want to just hav...

Rails: validate presence of parent_id in has_many association

I have a projects resource that has many tasks. I want to ensure that every task has a project_id by adding validates_presence_of :project_id to the tasks model. However, when creating a new project with tasks, the project_id won't be available until the record saves, therefore I can't use validates_presence_of :project_id. So my que...

Working Mootools on Rails solutions?

There are several questions about this already, but they are from awhile ago, so here goes: I have this half-made project that was built using prototype, but am looking into moving to a javascript library I am way more familiar about: mootools. Is there a way so I don't have to change any of my current rjs? e.g. remote_form_for Thank ...

Can this STI structure be achived in Rails?

I want to have these models: AbstractArticle Article < AbstractArticle FeaturedArticle < AbstractArticle I want the name of the database table to be articles and not abstract_articles. (As the convention suggests) Is this possible with Rails? How can I tell my base model to use a different table? Will STI still work even though the ...

Rails: How to write to a custom log file from within a rake task in production mode?

Hey, I'm trying to write to my log files while running a rake task. It works fine in development mode, but as soon as I switch to the production environment, nothing is written to the log files. I read here http://stackoverflow.com/questions/1022093/how-do-i-use-a-custom-log-for-my-rake-tasks-in-ruby-on-rails/1648159#1648159 that thi...

How can I upload and parse a vcard using ruby on rails?

I would like to be able to upload a vcard and have it parsed into my application's Model. I am thinking that Paperclip would be a way to upload, but I have no idea how to do the parse. I did a search on google, the only library that seems related is vpim, with mixed commentary. Wanted to see what brilliant ideas might be out there to ...

Speech recognition webservice that scores the accuracy of one audio clips vs. another?

Does such a thing exist? Building a Rails based web application where users can upload an audio file of them speaking that then needs to be compared to another audio file for the purposes of determining how similar to voices are. Ideally I'd like to simply get a response that gives me a score of how similar they are in terms of percent...

How can I document implicit methods inside of rails models?

I'm using YARD on my Rails project and was wondering how I would go about documenting inherited/runtime methods on a Rails model? For instance documenting the existence of a first_name attribute on a User model. ...

Why is Rails date comparison not working?

What am I missing here, it's driving me crazy.. >> user.current_login_at.utc > 24.hours.ago.utc => false >> 24.hours.ago.utc => Mon May 17 18:46:16 UTC 2010 >> user.current_login_at.utc => Mon May 17 15:47:44 UTC 2010 user.current_login_at was 27 hours ago, yet the greater than comparison says it was not greater than 24 hours ago. It ...

Parsing Very Large XML file with Ruby on Rails (1.4GB) -- Is there a better way than SAXParser?

Currently, I'm using LIBXML::SAXParser::Callbacks to parse a large XML file containing data 140,000 products. I'm using a task to import the data for these products into my rails app. My last import took just under 10 hours to complete: rake asi:import_products --trace 26815.23s user 1393.03s system 80% cpu 9:47:34.09 total The pro...

Rails Authentication

Hey, i need some help with rails, again! Last it was about Authlogic.. Well I'm gone a bit backward since.. I mean, Authlogic isn't a Authentcate system i like.. So now i wan't you guys to tell me what you think is the best! I going to use it to a project of mine. Where there has to be a few roles like Admin, User and Guest.. So might y...

Rails i18n and routes in javascript

Sometimes it would be really handy to have the Rails localization files available in JavaScript. Same is true for for the routes helpers. I found these two plugins which are exactly doing this: Exposing i18n to JavaScript: http://github.com/fnando/i18n-js Rails Routes in JavaScript: http://tore.darell.no/pages/javascript_routes My q...

What is the most accepted way to implement a SOAP service in Rails 2.3?

datanoise-actionwebservice was what I used last time I needed one. What is current opinion on SOAP and Rails? ...

How to set RAILS_ENV variable when running Rails tests?

In both my environment.rb and test_helper.rb files I have: ENV["RAILS_ENV"] = "development" I have one functional test written, however when I run it, the script tries to connect to my database using the "test" configuration settings which are in the database.ymal file & won't connect the the database. How can I run my tests using th...

how to specify a BIGINT in a rails scaffold?

I am trying to create a model in ruby that uses a BIGINT datatype (as opposed to the INT done by :integer). I have search all over Google, but all I seem to find is "run an SQL statement to alter the table to a BIGINT" - This seems a bit hack-ish to me, so I wanted to know if there was a way to specify a bigint in the ruby system like ...

Any Ruby AMF clients out there?

Hi, I'm looking for a way to push/receive AMF0 / AMF3 messages in Ruby(Rails). From what I read rubyAMF can only act as a server. What I need is a library that allows client access to FMS/Wowza.Any ideas? ...