ruby-on-rails

Conferences/Symposiums/Courses in Britain

I see lots of advertisements for cool looking conferences based on the latest web technologies on tech-ey sites all the time, but they all seem to be based in the USA - which is too far away to justify the expense :( So, does anyone know of some cool/fun/interesting events for web developers occurring in the UK? Or any sites that would l...

Rails and Flex

Hi Any thoughts on using Flex to build an RIA for administering a complex rails app. We are starting to find it difficult using ajax to keep our admin section intuitive and easy for users to work with. Would welcome any advise or suggestions you all may have Thanks Dom ...

How to protect a Rails model attribute?

My Invoice model has an address_id attribute, and I don't want this address_id to change FOREVER. So I don't want this to happen outside the class: invoice.address_id = 1 invoice.address = some_address Rails automatically adds this address_id attribute to the model from the invoice table, so how can I declare this attribute private/pr...

Encapsulating SQL in a named_scope

I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently. ...

How do I turn off CSRF protection in a rails app?

The CSRF prevention built in to Rails is causing some problems for some automated load testing we are doing, and I want to turn it off for the duration of the process. How do I do this? ...

Generating a report by date range in rails

How would you go about producing reports by user selected date ranges in a rails app? What are the best date range pickers? edit in response to patrick : I am looking for a bit of both widget and active record advice but what I am really curious about is how to restfully display a date ranged list based on user selected dates. ...

How do I redirect a page after successful validation with form_remote_for()?

I'm using form_remote_for() to do validation on a form's data so that my rails app can show the user errors without reloading the page. I'm having troubles redirecting the page if there are no errors. Here is my code: def create # Validate the data if error_count > 0 render :update do |page| page.replace_html(div_id, error...

IE6 freezes due to *server* configuration

Our web site (running Rails) freezes IE6 nearly every time. The same code, deployed on a different server, does not freeze IE6. Where and how should we start tracking this down? ...

How do I fix routing errors from rails in production mode?

If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message Routing Error No route matches "/asdfasdifjasdfkj" with {:method=>:get} Even though I am in production mode. Clearly I don't want any real users to see this, and would prefer a 404 page. Anyone know what...

Has anyone used Ruby/Rails with a Sales Logix database?

Has anyone used Ruby/Rails with a Sales Logix database? ...

How to best handle per-Model database connections with ActiveRecord?

I'd like the canonical way to do this. My Google searches have come up short. I have one ActiveRecord model that should map to a different database than the rest of the application. I would like to store the new configurations in the database.yml file as well. I understand that establish_connection should be called, but it's not clea...

Database structure to track change history

I'm working on database designs for a project management system as personal project and I've hit a snag. I want to implement a ticket system and I want the tickets to look like the tickets in Trac. What structure would I use to replicate this system? (I have not had any success installing trac on any of my systems so I really can't see ...

RoR: Accessing models from with application.rb

i am working on a simple web app which has a user model and role model (among others), and an admin section that contains many controllers. i would like to use a before_filter to check that the user of the user in the session has a 'can_access_admin' flag. i have this code in the application.rb: def check_role @user = session[:user] ...

How to ignore accents in highlight function.

I have a micro-mini-search engine that highlights the search terms in my rails app. The search ignores accents and the highlight is case insensitive. Almost perfect. But, for instance if I have a record with the text "pão de queijo" and searches for "pao de queijo" the record is returned but the iext is not highlighted. Similarly, if I s...

Create xml-stylesheet PI with Rails XMLBuilder

I want to attach an xslt stylesheet to an XML document that I build with XMLBuilder. This is done with a Processing Instruction that looks like <?xml-stylesheet type='text/xsl' href='/stylesheets/style.xslt' ?> Normally, I'd use the instruct! method, but :xml-stylesheet is not a valid Ruby symbol. XMLBuilder has a solution for this ...

What is the best way to start Unit and Functional testing of a Ruby Rails website?

I am testing a Ruby Rails website and wanted to get started with Unit and Functional testing. ...

What's the best way of productizing a Rails application for multiple installations?

UPDATE: It looks like DHH and the Rails Core team finally have a productization itch to scratch as it were. I'll keep this question up-to-date as and when I get to grips with the new options. It's all in a state of flux at the moment. I'd like to install a Rails app, My$uperWeb$olutionTM, on multiple servers for multiple clients. At th...

What are the best practices for designing a RESTful public API on Rails?

What are the best practices for this? Rails comes with RESTful resources out of the box, but do you use those for your actual public API? If so, how would you accomplish versioning of your API (i.e. example.com/api/v2/foo/bar, etc)? ...

How to capture an anchor value from url in Ruby on Rails?

After updating or creating a record I use url helper to redirect to the part on the page where the record happened to be located: if record.save .... redirect_to records_url, :anchor => "record_" + record_id.to_s end the resulting url will be something like http://localhost:3000/records#record_343242 I want to highlight the rec...

Inadvertent Session Hijacking Issue With Restful Authentication

I'm using the current version of restful_authentication that is found on github and I'm having a bunch of strange session issues. The server seems to be somehow assigning sessions to users it shouldn't be. This only happens when crossing the logged out/logged in barrier. Here's an example. With no sessions active on the server, I log in...