Displaying 20 results from an estimated 3000 matches similar to: "How to store the same key multi times in a Hash ?"
2009 Feb 09
2
dynamic constant assignment
I have a constant set up like that :
ALL_LOCALES
=> {"it"=>"Italian", "fr"=>"Français", "de"=>"Deutsch", "en-
GB"=>"English (UK)", "es"=>"Español (España)", "pt-PT"=>"Português",
"pl"=>"Polski", "en-US"=>"English
2011 May 22
6
How to capture correctly a specific exception
I a using delayed_job, and I am raising an exception this way :
config/initializers/custom_exceptions.rb
class RemoteLockerException < StandardError; end
class RemoteLockerDenied < StandardError; end
lib/instruction_request_job.rb
class InstructionRequestJob < Struct.new(:style, :request_id)
def perform
....
> connector =
2011 Apr 23
3
Rails3 how to scope it, using a serialized array ?
giving a simple model, with a serialized Array attribute
class Instructor < User
..
serialize :languages, Array
I am looking in defining scopes like this :
>scope speaking_english, lambda { where("languages ... includes.... ?", :en) }
which look for instructors in which the languages array include ":en"
Is this kind of scope possible ? or not.... ( just using
2010 Aug 12
4
[Rails 3] How to test routes urls in console
I tried require ''url_writer''
but this is not the trick
what should be required/included to test the routes urls ?
thanks
erwin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this
2011 Nov 15
4
Need some guidance on running shell commands from my app..
During execution in my Rails web app, I need to create a virtual host
config on my Linux server, but I don''t know what would be the best way
to do it , here are the steps ( my_domain.com is fixed, only
my_subdomain is changing dynamically
1- create: /var/www/vhosts/my_domain.com/subdomains/my_subdomain/conf/
vhost.conf
ServerName mysubdomain.mydomain.com
.. content is always the
2009 Jun 28
2
validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
I wrote the following code in my form view :
<li><label for="email">Email</label>
<%= form.text_field :email, :size => "30" %>
<span id=''email_error'' class=\''warning-text warning-text-indent\''><%=
@user.errors.on(:email) %></span></li>
the generated html code is the following :
<span
2008 Jul 08
2
select helper still the worth thing in rails...
I have been trying all the day to make it happen, initial display is
fine , but I cannot redisplay the selected value once the choice is
done in my select helper
I setup my slector in a helper (need to include the first option
''all'', as a prompt is displayed only once....
in my partial
def company_role_selection(selection=nil)
roles= [[''all'', 0]]
2009 Apr 06
2
URL issue localhost/mongrel vs remote-server/apache
Hi all
I have a small issue I ma trying to solve (at least to understand..)
I am testing an app on my remote_server (w Apache/Passenger) in a
sub_URI, without any problem (I tested also the same app, locally w
Apache too)
in my environment.rb , I have initialized
config.action_controller.relative_url_root = "/my_subURI"
config.action_controller.asset_host =
2010 Dec 17
1
flash[;notice] not display after redirection
I read all previous posts about the same subject in Devise group but
couldn''t find any answer, so iy may not be related to Devise , so
I debugged it ..
.
class Users::RegistrationsController <
Devise::RegistrationsController
..
# POST /resource/sign_up
def create
build_resource
if resource.save
if resource.active?
set_flash_message :notice, :signed_up
2010 Dec 25
7
I sit possible to write it in one line ? Array init + Array loading
I am always writing it in 2 lines : ( Array init then loading the
array )
@providers = []
@authentications.map {|authentification| @providers <<
authentification.provider }
Is there any Ruby writing for writing just one line ?
thanks fyh
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group,
2012 Oct 16
8
<form> tag is self-closing before input fields .. (HAML generator used)
The form is inside a table, enclosing a <tr>
= form_tag admins_backoffice_dashboards_path, :remote =>"true" do
%tr.search
%th= link_to t(:clear), "#", :id => :clearFilter
%th= select_tag :role,
options_from_collection_for_select(Role.global, :id, :name, :selected
=> @role_id )
%th= text_field_tag :email, nil, :value
2009 Sep 10
2
undefined method `get_client_info' for Mysql:Class
after upgraded to Snow Leopard... (32bits arch)
I re-installed the mysql gem (i386 architecture) , all gems and
rails 2.3.4
testing in the console
$ irb
irb(main):001:0> require ''rubygems''
=> true
irb(main):002:0> require ''mysql''
=> true
Mysql.get_client_info
NoMethodError: undefined method `get_client_info'' for Mysql:Class
from
2011 May 16
2
Cannot get multipart => true , running well in my form when using remote => true
I have a simple form , with a file field
= form_for (Clip.new), :html => {:multipart => true} , :remote =>
true , do |f|
= f.hidden_field :user_id, {:value => current_user.id}
= f.text_field :name
= f.text_area :description
= f.file_field :image
= f.submit I18n.t(:add)
generating the html code
<form accept-charset="UTF-8"
2010 Aug 18
2
[Rails 3] remote_function ?
Is the remote_function still valid in Rails 3 as it seems many of the
Prototype helpers have been replaced ? (link_to_remote, ...)
where can I find any link on it ? not in the standard doc I guess ..
thanks for you feedback
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2012 Jan 14
2
mysql2 error in production
As I need to upgrade a Rails app to 3.1 , I am trying to deploy it on
a remote production server ( Linux Debian, after installing Rails
3.0.9 under rvm with all needed gems including mysql2 version 0.2.18
used by the app)
after deployment, starting the app, I get a Load error w mysql2...
** [out :: www.mydomain.com] /var/www/vhosts/mydomain.com/rails/
2011 May 17
2
Can't dump File ... when uploading files
I am getting this error on the redirect_to command ...
I am using Rails 3 w Paperclip to upload files ( but I tried also
CarrierWave .. same error)
I tried to change the session store from cookie-based to database ..
same error
I tried to delete the params content ...
I don''t know what to try next .. any clue ?
thanks
erwin
--
You received this message because you are subscribed to
2011 May 20
5
views w locale default template
[RAILS3]
I hesitate on how handling the locale view templates to default to
one language only ..
sending admin emails will go only to one locale ''en_GB''
should I set it up into the template name and set I18n.locale to
''en_GB''
membership_renew.en_GB.html.erb
OR
whatever locale is used , if I have :
membership_renew.html
it will be the default ?
--
2012 Mar 26
3
render :json not sending any data back ...
[rails 3.2.2]
I perform an ajax call :
...
$.ajax
url: " /backoffice/expenses/rate"
type: "GET"
dataType: "json"
data:
project_id: $(''#project_id'').val()
code: $(this).val()
success: (result) ->
alert result
$(''#expense_price'').val(result)
in
2010 Feb 23
1
how a js script can get the current locale from my rails app ?
I am not very fluent in JS, so I don''t see how to transfer the rails
app current locale ..
I have a JS script able to detect the default browser language ..
running fine
I can also modify the JS language, passing a global var ..
// Create a JSON Object
var myJSON = {
"lang": "fr"
};
// Pass it to the script immediately...
2009 Jul 01
2
Nested Forms - how to displayed the attributes content ?
I have a User model
class User < ActiveRecord::Base
has_one :account
accepts_nested_attributes_for :account, :allow_destroy => true
validates_associated :account
attr_accessible :account_attributes
is working fine, validating and updating both records (User and
Account), but I caanot display the value in the form when is updated,
ex: below the firstname is not displayed but