I have a Model Property which has subclasses using STI,
and which I would like all to use the same controller with only different view partials depending on the subclass.
Property
Restaurant < Property
Landmark < Property
It works find except I'm not sure how to discern the subclass inside the controller to render the correct view. ...
Can anyone recommend a way of creating a view where users can upload images to my app through a WYSIWYG editor?
I've tried solving this using CK Editor and Paperclip but am having lots of trouble... Maybe I'm going about this the wrong way.
If someone's done this before I'd really like to know how! I don't have a editor or file storage...
Now that Rails 3.0 beta has been released, should I spend time building my first Rails application on 2.3 or does it make more sense to use the beta?
...
I've got some strange behaviour going on with my DB Seed. the piece of code in question is this:
#seeding info about Question Types
@question_types = [:name=> "Single Input", :name=> "Multiple Choice"]
@question_types.each do |question_type|
new_question_type = QuestionType.find_or_create_by_name(:name => question_type[:name]);
end
...
I would like to install Rails 3.0 Beta but ran into what appears to be a dependency error:
$: sudo gem install rack-mount
Successfully installed rack-mount-0.5.1
1 gem installed
Installing ri documentation for rack-mount-0.5.1...
Installing RDoc documentation for rack-mount-0.5.1...
$: sudo gem install rails --prerelease
ERROR: Erro...
I am not sure if this problem is a general Rails problem or Redmine specific.
There is a class User which has a class method try_to_login. I wrote a module containing a method_alias_chain to wrap that method and provide additional functionality. This works fine if I go into the console and call try_to_login. My wrapper will be executed ...
I currently have the following query
User.sum(:experience, :group => "clan", :conditions => ["created_at >= ? and created_at <= ?", "2010-02-15", "2010-02-16"])
I want to return the top 50 clans in terms of experience listed from most experience to least experience with only the top 50 in experience returning. How would I modify the ...
Topic says it all guys, my program needs to be able to keep track of the "software" that belongs to a user, as such I have a MVC for "Software". However, I can't use RESTful routes at the moment since my plural and singular names are the same, it's "software" for both. Can anybody help me either, create new named routes or suggest a ne...
Is there a custom tag in YAML for ruby to include a YAML file inside a YAML file?
#E.g.:
--- !include
filename: another.yml
A similar question was asked some time ago and there was no relevant answer.
I am wondering if there is some custom tag for Ruby similar to this one for Python.
...
undefined method `to_sym' for nil:NilClass
I have this error only in my edit page of my nifty_scaffold.
This is _form.html.erb
<% form_for @progress do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :date %><br />
<%= f.date_select :date %>
</p>
<p>
<%= f.label :description %><br />
<%= f.text_area :descriptio...
Ok, total Cucumber newbie here so please be gentle. As a learning Ruby/Cucumber/MongoDB endeavor I'm building a simple contact manager. I have a Person (parent) model and an have been able to write a simple test as follows:
Scenario: Show people
Given the following person exists
| firstname | lastname |
| Bob | Jones |
W...
Hi there, I'm having trouble with a date comparison in a named scope. I'm trying to determine if an event is current based on its start and end date. Here's the named scope I'm using which kind of works, though not for events that have the same start and end date.
named_scope :date_current, :conditions => ["Date(start_date) <= ? AND D...
Why do so many gems end in fu?
Not that this make it clear to me, but here is what Google says "define: fu".
...
Using the script off http://viralpatel.net/blogs/2008/12/set-maxlength-of-textarea-input-using-jquery-javascript.html I am trying to limit the input of a textarea to 1000 characters. Prototype is also included in the page.
It works fine in chrome, but in firefox the following error is given and the input is not limited:
$("textarea[ma...
I have a hash of hashes like so:
Parameters: {"order"=>{"items_attributes"=>{"0"=>{"product_name"=>"FOOBAR"}}}}
Given that the depth and names of the keys may change, I need to be able to extract the value of 'product_name' (in this example "FOOBAR") with some sort of search or select method, but I cannot seem to figure it out.
An ad...
I am attempting to get a Google Maps cluster working with ym4r_gm for Rails. I know the general code works because every point is being displayed on the map. The problem is that every point is being displayed on the map. I only have like 350 points (right now) so its not too bad without clustering, but I would like to have it working ...
I am working on rails 2.3.4 . As rails new version rails 3 has arrived , I want to know which are the major changes rails3 has?
...
I get this error when launching my Mongrel server...
$ script/server --debugger
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-...
Hello,
I'm using Authlogic to manage the sessions in my application.
However, by default, authlogic allows a user to be logged in many times from different computers.
I don't want that (the user pays to get access and I want to avoid users sharing their accounts).
Looking in the Authlogic documentation, I've found about the perishable_...
Is there a way to pass parameters with a link_to call without it showing up on the URL? I'm making a simple star-rating system, and I'm basically making each star an image link that passes its value as a parameter to a new rendering of the same page. The helper code looks like this:
def stars_generator(edit_mode = false)
@rating = pa...