say I want to scaffold generate university
but university should eventually be related to state. as in each university has one state and one state has many universities.
in my scaffold command should I include state_id??
script/generate scaffold university name:string address:string state_id:int
... I know I will have to update my m...
When I try to change password I see that authologic ignores the values in the password and password_confirmation fields (which store the values for the new password and its confirmation) and simply saves the form.
However it updates my crypted_password with the new password value when i work on the console.
The API has a method called v...
Hi guys, I need to pass self as object not class to :conditions string, is there any way to do this?
has_many :topic,
:class => 'FileTopic',
:conditions => "id in (select * from file_topics where program_id = #{self.id})"
My problem is self is always giving me the id of the class but not the instance of the class. I guess has_many is ...
Given that database is generally the least scalable component (of a web application), are there any situations where one would put logic in procedures/triggers over keeping it in his favorite programming language (ruby...) or her favorite web framework (...rails!).
...
I could use some help on including and extending Ruby modules and classes.
My previous question handled the named routes, but not all of the view/tag helpers due to the default_url_options Hash. The issue here is that ActionController::UrlWriter methods, like url_for, call the class attribute default_url_options. So when including Act...
I'm working on a RoR app, but this is a general question of strategy for OOP. Consider the case where there are multiple types of references that you are storing data for: Books, Articles, Presentations, Book Chapters, etc. Each type of reference is part of a hierarchy where common behaviors sit at the most general point of inheritance, ...
Is there any way to improve the performance of TextMate when a large project is open? Making it the active app is taking about 10 second each and every time.
...
I have a Comment model in my app but am encountering a lot of problematic postings that I have to remove manually.
What I want to do is add a "flag for moderator attention" feature so that users of the app have the ability to remove a comment from view without my need to review all content in the app.
I'm thinking that after a comment ...
I am using the Classifier:Bayes as part of a model class. I have the class set up to serialize the classifier to the db.
class Foo < ActiveRecord::Base
serialize :classifier
end
The yaml appears in the db just fine after doing some training and saving the object.
But when I query for the class, instance.classifier is a string
@f...
Hi there,
I have a web app that allows users to edit model data via a popup window. When the popup window form is completed, the user clicks a "Save" button, the window closes, and the original page reloads to show any updates that happened to the data.
My technique only works sometimes. I can't for the life of me figure out why it work...
I bought "Beginning Ruby: From Novice to Professional - by: Peter Cooper".
Being from a .NET background, I guess:
Ruby is to C#, and
Rails is to ASP.NET
when compared. Please correct me if I am wrong. Should I learn Rails along with Ruby or first I need to dip my hands well in Ruby? Do I need knowledge of Rails necessarily for develop...
I have code like:
@notifications = Notification.find_all_by_user_id(@user.id, :order=>'deliver_by DESC', :conditions=>"deliver_by >= '#{Date.today.to_s(:db)}'")
logger.info @upcoming_reminders[0].inspect
logger.info @upcoming_reminders[0].class
logger.info @upcoming_reminders[0].id
logger.info "--------------------------...
In an application I am building I am storing an XML file in my database using the acts_as_tree association. I would like to name the class XMLElement but this throws rails off since the capitalization is non-standard. It is looking for XMLElement from the file name xml_element.rb. I tried changing the filename to x_m_l_element.rb to t...
I just found a bug in my Rails app which would lead to certain records not getting deleted with their associated objects. The bug has been fixed, but I now have several thousand records in my database with foreign key values pointing to records that don't exist.
Is it possible to delete all records in a table where an integer foreign ke...
Hi,
I trying to navigate my new EC2 setup and was hoping to find an AMI setup for Rails. I've been having trouble. Basically, I'm looking for something like this:
* Apache 2.2
* Ruby Enterprise Edtion (REE)
* Passenger
* MySql Installed and configured with Ruby
Anyone have an AMI with a basic rails stack they could point me to?
...
I'm new with Ruby on Rails and want to get several records into the SQLite3 database so that I can manipulate the data. I am following a lesson, and wonder what is the fastest, most effective way to get the data into the database, which has four tables (includes one join table)?
Are there any plugins which are good for this?
...
class Gift < ActiveRecord::Base
has_many :contributions
accepts_nested_attributes_for :contributions, :reject_if => proc { |a| a['amount'].blank? }
Contribution has a :nickname attribute. In the :new form, it is pre-populated with the user's real name. A user might decide to change it to "Uncle Bob" (or whatever). Unfortunately, w...
Hi,
I'm thinking about defining Restful urls for a new project (developed with Ruby On Rails).
I like the simple and clean urls of the most famous web 2.0 services like "twitter.com/username". Not talking about problems in routing configuration (I want to do that with resources not using dirty "map.connect" overrides), the very problem i...
So for example ...
Lets say I have a Posts model and a News model, that are essentially the same thing (structure wise)
columns are
* title
* content
* createdat
* updatedat
The client has requested showing both news and Posts on the same page interleaved and sorted by created_at date ...
Does anyone know how I would go about doing so...
How exactly do I use Searchlogic with multiple models? I have a dashboard that pulls data from 3 models and displays them in a grid (table) - I want to allow sorting and searching for all three of these, but Searchlogic seems to demand that I use "search" as the parameter name; doing something like:
@users_search = User.search(params[:...