Say User has_many Things. In a User form, I'd like a hidden_field that lets me create a relationship between this new User and a pre-existing Thing, say of id 8. What's wrong with the following code snippet? I think I'm just forgetting some syntax here.
<% f.hidden_field 'things[]', :value => 8 %>
...
What better ways to pass arguments to filters in Rails controllers?
EDIT: The filter has a different behavior depending on the parameters passed to it, or depends on the parameters to perform its action.
I have an example in my app, where a filter determines how the data is sorted. This filter has a klass param and calls klass.set_filte...
I currently have a Ruby on Rails system, and there are plans to port it to GWT. Before we do this, the powers that be want to have a proof of concept with part of the site being written in GWT to show that GWT can use and display the current content. The flow of data in the GWT portion of the system is as follows:
Client sends an RPC c...
Hi,
I am developing an application, with a years model and a courses model. Currently there is a has_and_belongs_to_many relationship linking these with a courses_years table, however I would like to store an extra field in the courses_years table.
The new field is a boolean value called "compulsory".
Is there an easy or nice way of ...
Hi all,
I'm trying to post an xml document from java to a rails application. I have a hard time writing the http request
Here's my java code:
Socket sock = new Socket(addr, port);
String path = "http://127.0.0.1:3000/mycontrollers.xml";
BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputS...
Suppose a service written with RoR starts to use AWS S3 to store some data. What is the best library to use for working with AWS S3? Currently the main two alternatives for me are:
RightScale AWS Ruby gems
http://github.com/rightscale/right_aws
AWS::s3 http://amazon.rubyforge.org/
What are their main advantages and disadvantages? Wha...
I have a primary model for my project, Place.rb with a places_controller, and I've currently got it exactly the way I want for the users end of my project. With a nested photos controller, review, etc.
I want now to create a management resource which is mostly just an alias for Places, with its own nested resources, some of them overla...
I've done some reading about how to extend ActiveRecord:Base class so my models would have some special methods. What is the easy way to extend it (step by step tutorial).
Thx!
...
Hi all,
I'm trying to set up a model (client) that contains some general attributes about a company but also has a company logo attached. I'm reluctant to use a plugin because I want to grasp this aspect of rails if possible.
I've created a clients model and an image model and I can create a new client (scaffold code) and upload an acc...
I my model I would like to check if the app is running inside IRB consol or as a website?
class MyModel < ActiveRecord::Base
def xmethod
if !isIRBconsol
self.user_id = UserSession.find.user.id
end
end
end
...
Just followed the Authlogic tutorial. I am getting "uninitialized constant Authlogic" when I try run the app. After searching, I can see that it has to do with gems/plugins but I can't find a solution.
Edit:
My UserSession model is:
class UserSession < Authlogic::Session::Base
end
...
Hi,
I have a prototype question in the context of Ruby on Rails.
QUESTION - In a rails view how do I trigger a remote AJAX call?
ie. like "link_to_remote" but directly without the link - so I want specifically in my case when the windows loads to be able to trigger a remote call to populate data in a DIV via a remote call...
thanks...
Hi ,
Does Ruby on Rails have a way to use jQuery rather than Prototype under-the-bonnet for its ajax view helpers? (e.g. "link_to_remote")
...
Does anyone know how I'd run plain text passwords through the authlogic hasing algorithm without using rails? It looks like the default for authlogic is sha512.
I have a database of plain text passwords (yes, I know... bad) and need to import them into a new DB that uses the authlogic setup.
This ruby script is outside of rails so I do...
I have a select that gets populated depending on the selection in a different select
To do this, I did what is recommended in Railscast #88 on 'Dynamic Select Menus'.
But now I need to render a partial, passing in the value selected in each of those selects.
I can't figure out how to simply trigger a method call from the :onchange event...
I am unable to save nonprintable characters (e.g. "\x83") to the database using Rails (v2.2).
Simplified example (from the console):
>> f = FileSpace.create( { :name => "/tmp/\x83" } )
=> #<FileSpace id: 7, name: "/tmp/\203">
>> f.name
=> "/tmp/\203"
>> FileSpace.last
=> #<FileSpace id: 7, name: "/tmp/">
So you can see, Rails is sile...
This happened to me several times and I'm yet to find an acceptable solution.
I have a form in the home page of a site, that forms points to another controller which actually does the job of processing the data. When the form is submitted successfully, the other controller sends you back to the homepage with a nice flash[:notice] messag...
I have an existing rails form with many sections that can be edited in place, using in_place_editor. Now I need to detect if any of the in place forms are visible, ie, the user is editing a section, before navigating away from the page. What's the usual "rails way" of doing this?
...
I'm pretty sure I understand how seeding work with respect to seeds.rb, but I can't seem to use it to stick a restful_authentication User object into the database.
User.create(:login => 'admin',
:role => Role.find_by_name('super_admin'),
:email => '[email protected]',
:password => '123123')
Am I mis...
I'm trying not to fight the defaults here and use Rails built-in support for nested attributes (from http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes). I'm labeling Things with Tags, and all works swell, and for each Thing I have a form with a nested field that creates a new Tag by a name. Trouble is, ...