Is there a way to use fields_for with in a form without having a scope?
For example:
<% fields_for "user[]" do |x|
<%= x.text_field :name %>
<% end %>
Without the user model being loaded in memory?
I got it working using territory[user][][name], but I would like to keep it in ERB.
...
When you're solving a problem in Rails, what websites do you turn to as resources?
(... other than StackOverflow!)
I'm not looking for links to tools such as IDEs, but rather information resources.
One url per answer please to help voting.
...
Hulu, Twitter, Techcrunch, etc are written in Ruby.
Yahoo, Facebook, and tons of big social networks are written in PHP.
But what are some big top-name enterprise sites written in Python?
I am going to spend my time investing in either Python (w/ Django) or Ruby (w/ Rails) to create a data-intensive web application that has a personali...
Hello,
I have two forms in my rails app. They both exist in separate tabs and I when I submit one form I want the data in the other form to be saved as well. How should I do that? Or Is there a better way of doing this instead of using two separate forms? Is there a better way to spread a long form into multiple tabs and when I press su...
I have a VirtualHost which sets the handler for Location / to a PerlModule to deploy a catalyst application.
I want to convert the catalyst application to rails, but gradually. The front end is all javascript using the ExtJS Framework, and the backend only serves JSON. This will allow for a gradual transition as long as the JSON is i...
Hey. I've got some code from Agile Web Development that wraps some HTML around a method call as so:
# from tagged_builder.rb, included as a FormBuilder helper
def self.create_tagged_field(method_name)
define_method(method_name) do |label, *args|
@template.content_tag("p",
@template.content_tag("label" ,
...
Not sure if the terminology is correct, but are there rough equivalents to Java Servlet Filters in Ruby and PHP ? Are they actual concrete classes ?
I assume there is also a number of common web app libraries/frameworks in Python. Is there an equivalent there ?
Thanks.
=== ADDENDUM ===
On the good advice of Kevin Davis, I just want t...
Here is one more newbie question:
require 'tasks/rails'
I saw this line in Rakefile in the root path of every rails project. I guess this line is used to require vendor/rails/railties/lib/tasks/rails.rb to get all rake tasks loaded:
$VERBOSE = nil
# Load Rails rakefile extensions
Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| l...
Another basic Rails question:
I have a database table that needs to contain references to exactly two different records of a specific data type.
Hypothetical example: I'm making a video game database. I have a table for "Companies." I want to have exactly one developer and exactly one publisher for each "Videogame" entry.
I know that ...
I have implemented authentication systems for webapps several times over the years, but before I do it once more, I thought I'd ask if there's a canned solution I should know about.
Last time I checked, there was no built-in Rails authentication system and the standard solution was the restful-authentication plugin. Is that still the ca...
Mac OS 10.4
rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15)
rspec-rails (1.1.11)
rspec_generator (0.5.15)
rails 2.2.2
ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
Created a new project...
$ rails myproject
Installed rspec into the project...
$ script/generate rspec
Generated a resource...
$ script/generate rspec_scaffold myre...
I've been a dev using rails since it's initial release and have recently lost touch with it because I've done a lot of work with Django due to my recent fondness of python. I do like Ruby as well and was asked by a friend recently if he should approach Rails or Django. Given that Rails is merging with merb and has a huge user-base versus...
I want to take advantage of the new partitioning in MySQL 5.1 but using a standard ActiveRecord model. The problem I have encountered is that to use the partitioning the primary key on the table must include the columns used in the partitioning function. (http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations-partitioning-keys...
With :limit in query I will get first N records. What is the easiest way to get last N records?
...
I have a Rails application where users can set up their domains and publish content onto them. I need to collect public traffic statistics such as pageview count etc. One good example of this feature is flickr usage statistics i can see as a customer.
The question is what is the best way to collect usage information. Should it be done b...
I have a task in capistrano wherein I want just a single line to run only if the server is a marked as primary. Is there a variable or method that I can reference inside a task? 'primary?' or 'primary' doesn't seem to work.
I've also tried something akin to the following:
after "deploy", "task1"
after "deploy", "task2"
after "deploy"...
I'm trying to load a div into a page based on a change in the drop down. I either want to show a div which has state/zip or province/postal_code, (each is a file) but I am getting a "406 Not Acceptable [http://localhost/profiles/residency]"
Here is my JQuery code:
$(function(){
$("#profile_country").change(onSelectChange);
});
fun...
What is the best way to ensure that the proper RJS is being generated in a Controller action?
For example, I want to ensure that a div is highlighted as such:
def new
render :update do |page|
page.visual_effect :highlight, :some_div
end
end
Rant:
This is quickly becoming one of the reasons I grow tired of RSpec after using it...
Tomorrow, I will meet a client that is not working in technology but might ask if RubyOnRails is the right choice for his site. He might think that there's not enough RoR programmers and that he will be "hostage" of the language.
I have good reasons to use RoR and the client has good reasons to like it (it costs less!).
Do you have "of...
I'm try to install the sqlite gem on a Fedora 9 Linux box with ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results:
sudo gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
...