Hello All,
I have a button which label is "save & copy" doing save the current object (@student) and redirect it back to new action and these new contains all the previous object attributes. I have stucked how to populate previous values.
Is ROR provide any such method to make clone of object.
...
hey,
I want to have my select_tag default to blank but i'm using a map
<%= select_tag "assignment[client_id]", options_for_select(@data.map{|d| ["#{d.first_name} #{d.last_name}",d.id]}, " ") %>
I know you can't use include_blank and you can't put " " to set it to blank. any ideas ?
Thanks, Alex
...
I'm attempting to build a custom control for Formtastic that takes a latitude and a longitude, however, I'm not sure how to go about passing the method names through. Ideally I'd have the following in the semantic_form_for block:
f.input :latitude, :longitude, :as => :location
I've also tried passing with an array:
f.input [:latitude...
I'm having a problem with some pesky select_tags, I can get them to show data fine on the new but when it comes to edit, they don't show up, here is the code I have at the moment. I think I need to use include? but I don't know where to put it.
This is what I have at the moment for the new
<% @data = Code.find(:all, :conditions => "sec...
We are using reverse-geocoding in a rails webservice, and have run into quota problems when using the Google reverse geocoder through geokit. We are also implementing the simple-geo service, and I want to be able to track how many requests per minute/hour we are making.
Any suggestions for tracking our reverse-geocoding calls?
Our code...
Hi,
I am a .NET guy and I try to understand the concept behind Rails and its Active Record stuff.
As I can see in all examples they always assume that your view is a 1:1 copy of your model. In reality frequently that´s not true.
Like a view that holds a customer and contact person(s) that are not related to that customer. User should ...
Hey,
I am trying to use permitted_to to hide/show links but in one of my forms it is not appearing.
The form belongs to assignments but the actual edit function is for candidates.
<% if permitted_to? :edit, @candidate %>
<%= link_to 'Edit', edit_candidate_path(@candidate) %>
<% end %>
I can navigate to the page by url so i know its ...
I'm using the sortable_element function in Rails to make a list of <li> elements sortable. This is working fine and I can drag and drop to my heart's content.
What I really want to do though is change the appearance of (some of) the list items depending on what item the user dropped where in the list. E.g. if the user drops an item at t...
In ruby on rails 3 you can use their ActiveMailer for sending emails.
Also you can install the Mail gem.
I wonder what the difference is?
Does the Mail gem provide things ActiveMailer doesnt?
Should i always install this gem?
Thanks
...
I've been working on getting our Rails 2.3.8 app running correctly under JRuby. Everything works great until I enable config.threadsafe! in order to achieve the concurrency that JRuby offers. This caused modules and classes in lib/ to no longer autoload.
with config.threadsafe! enabled:
$ ruby script/runner -e production 'p Sim::Sim200...
Hi everybody,
I'm trying to implement the in App purchase mechanism in my iPhone app. To do so I need to make a json object out of the receipt string on my rails server, and send it to a iTunes server.
How can I create a json object out of a string? to_json didn't work for me...
How can I send that json object to the specified Server ...
By default, rails is looking for images to "public/images" folder.
But it is not suiteable for me, since i have all the multimedia stuff in "public/data/:model/:id" folders.
How do i force rails to look into this folder.
I don't need obligatory such a pattern, that i mentioned above.
The only thing, i need, is just to change "public/i...
For some reason, extremely simple queries, such as SHOW TABLES, can take a long time on my local machine.
# line from log/development.log
SQL (955.1ms) SHOW TABLES
If I execute the same query in dbconsole manually, it runs in < 0.01s
Looking through the logs for any long running queries, aside from migrations, they're all SHOW TA...
hey,
I have a search page which finds candidates.
From this page you can click view to find more information about the candidate.
When on the candidate view you can click edit or do a number of other actions which would return you too the candidates view.
My problem is from the candidates view I need to add a button to go back to the s...
Problem
I'm getting the error:
key too long "rack:session:BAh7...."
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/memcache.rb:703:in `get_server_for_key'
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/memcache.rb:920:in `request_setup'
/usr/local/ruby-enterprise/lib/ruby/gems/1...
I wanted to add a method to two models, so I made a module like this and included it in both models.
module UserReputation
def check_something
...
end
end
That worked fine. I then wanted to have that method called as an :after_create on all those models. It works if I add it manually to all the models, but I wanted to be sma...
I have a db column which is a serialized Hash:
class Foo < ActiveRecord::Base
serialize :bar
end
When I store a hash inside of bar that is a few levels deep, the deeper levels do not seem to properly deserialize when I need them. Objects one level deep get deserialzed just fine. However, objects 2 or more levels deep remain YAML cl...
Hi,
I got an error while uploading a file.
/!\ FAILSAFE /!\ 07/26/2010 02:37
Status: 500 Internal Server Error
bad content body
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:467:in `parse_multipart'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:268:in `parse_multipart'
/usr/lib/ruby/gems/1.8/gem...
I have attribute name of model Person.
I want to use html-form with fields: first_name and surname:
<%= f.text_field first_name%>
<%= f.text_field surname%>
And I want to compose these virtual attributes to model attribute name.
What's the best way to do it?
I tried to use composed_of, but failed...
class Person < ActiveRecord::Ba...
Ive got a model caleld SpacialBody, and I need to seed some records so first off I added this to my seeds.rb
[
["Sol",0,0,0,"standard"]
].each do |body|
nb=SpacialBody.find_or_create_by_name(body[0])
nb.name = body[0]
nb.x = body[1]
nb.y = body[2]
nb.type = SpacialBody::Types[body[3]]
nb.class = body[4]
n...