What's the best way to dynamically create a controller in Rails.
I've got a class that needs to generate a bunch of controller that inherit from it. I could just create a bunch of files in /app/controllers, but they'd all be basically empty files. There's got to be a way to generate these classes dynamically and have them treated like...
I've inherited a little rails app and I need to extend it slightly. It's actually quite simple, but I want to make sure I'm doing it the right way...
If I visit myapp:3000/api/persons it gives me a full list of people in XML format. I want to pass param in the URL so that I can return users that match the login or the email e.g. yapp:30...
I've been trying to fix a bug in the Rails app I'm developing, and I keep getting a blank screen with no errors. I haven't found anything helpful in development.log, either (though it does show queries being run and such).
Finally, I started to wonder if it's somehow set not to show errors anymore. I tried commenting out a necessary rou...
Hi everyone,
I'm trying to get started with twitter4r but I'm having some issues:
Why I can't load the gem in IRB?
$ sudo gem install twitter4r
Successfully installed twitter4r-0.3.2
1 gem installed
Installing ri documentation for twitter4r-0.3.2...
Installing RDoc documentation for twitter4r-0.3.2...
$ irb
>> require 'rubygems'
=> f...
My enviroment.rb is like this:
ActionMailer::Base.default_charset = "iso-8859-1"
wich should be enough for accents, but here is how the message's subject is been sent:
Convite para participação de projeto
Does anyone know what I have to do to fix it?
Thanks
...
I'd like to be able to read an XML file uploaded by the user (less than 100kb), but not have to first save that file to the database. I don't need that file past the current action (its contents get parsed and added to the database; however, parsing the file is not the problem). Since local files can be read with:
File.read("export.op...
I need some advice, what is the rule of the thumb when creating Rails controllers names?
Should controller be all be verbs or a combination of nouns and verbs (or adjectives)?
This is the example provided on creating controllers in Rails,
./script/generate controller CreditCard open debit credit close # which is a combination of nouns...
Hi All,
Where could i enter this PIN number.I am running this application in my localhost.
Thanks in advance
...
I would like to fix up some error messages my site generates. Here is the problem:
class Brand < ActiveRecord::Base
validates_presence_of :foo
...
end
My goal is to make a message "Ticket description is required" instead of "Foo is required" or may not be blank, or whatever.
The reason this is so important is because lets say...
I have a link on a website that says "add object". When I do this, an AJAX call is made and I want to do the following things:
1) if the container in the session does not exist, create one, else use existing
2) add the object to the container
I'm new to RESTful design and am wondering how to best accomplish this in Rails. Step #1 in pa...
I'm starting to develop a small application in ruby on rails and many questions arise. I should say that I have about 1 year of experience with ASP.NET MVC and feel at home with models views and controllers. I've been using view models extensively (with the help of AutoMapper) and now wondering if view models are used similarly in rails ...
I installed Typus plugin (http://intraducibles.com/projects/typus) for my app and I love it. But along the development of the app I frequently do migrations and change the DB Schema and relationships, and then the plugin fails. Is there a way to re-generate the plugin with the new schema? Thanks!
...
I got problem
"Processing environment.rb: Pre Initialisation Phase (using rails 2.3.5)"
"Processing environment.rb: Main Initialisation Phase"
C:/Ruby/bin/rake: No such file or directory - svnversion
[memcache-client] Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: no such file to
load -- system_tim...
I'm working on a problem where I need to store serialized hierarchies of Ruby objects in the database. Many of the objects that will need to be saved are ActiveRecord objects with a lot of attributes. Instead of saving the entire objects and then refreshing their attributes from the DB when I load them (in case they changed, which is l...
There are many places in my application where I need to generate links with unique tokens (foo.com/g6Ce7sDygw or whatever). Each link may be associated with some session data and would take the user to some specific controller/action.
Does anyone know of a gem/plugin that does this? It's easy enough to implement, but would be cleaner ...
You know, I think I have to check current user in the model callbacks (like before_update). Rather than rely solely on adding where ('something.user_id = ?', 'current_user.id') in the controllers. I need something like Thread.CurrentPrincipal in .NET
Is it safe to put reference to current user in User model? I'm sorry I don't really unde...
Hi,
I'm going to develop a social like network using Ruby on Rails.
For this app I need basic social functionality like friends, activities, authentication, user profile, facebook connect, comments. I searched for rails plugins with social functions and i found - tog and community engine.
So which is better and more easier to extend?
Tha...
I remember, I have a GoF book back in college about design patterns which helped me a lot with my C and C++ programming, since my jump ship to Rails I was trying to use those design patterns I learned previously, Rails is a relatively new paradigm to me, plurals, verbs, REST, DRY.. Can you give me a recommended book for Rails that I can ...
I have an application which obtains data in JSON format from one of our other servers. The problem I am facing is, there is is significant delay when when requesting for this information. Since a lot of data is passed (approx 1000 records per request where each record is pretty huge) is there a way that compression would help reducing th...
I haven't implemented a search feature before and feel a bit stuck. I have a Sunspot search feature which finds results based on keywords - this works great - but I now want to implement the multi select facet feature, but I can't even seem to figure out how to set-up a basic facet search.
I have a many to many relationship (in rails no...