Displaying 20 results from an estimated 102 matches for "display_name".
2009 Feb 24
4
Cannot pass id field to ActiveRecord
Dear all
I have a dummy question. The model code as follow:
class User < ActiveRecord::Base
set_primary_key "username"
end
In script/console
user = {:username => "123", :display_name => "345"}
=> {:username=>"123", :display_name=>"345"}
a = User.new(user)
=> #<User username: nil, display_name: "345">
Why the username field is nil instead of "123"? I also tried
{:id=>"123", :display_name=>&q...
2011 May 25
0
indentify delayed_job with display_name
Hi,
I just found this solution for identifying a job in the job table:
http://stackoverflow.com/questions/3638250/how-to-cancel-scheduled-job-with-delayed-job-in-rails
They are using this code:
class MyJob < Struct.new(:user_id);
def perform
# ...
end
def display_name
return "MyJob-User-#{user_id}"
end
end
# store reference to a User
my_job = MyJob.new(User.first.id) # users.id is 1
job = Delayed::Job.enqueue(my_job, 0, 1.hour.from_now)
job.name
# => "MyJob-User-1"
job.handler
# => "--- !ruby/struct:MyJob \nuser_id: 1\...
2007 Nov 03
2
Service.services bug (pure Ruby version)
Hi all,
I''ve hit a curious bug in the Service.services method. This is in the
pure Ruby version in CVS. Check it out and run this snippet:
Service.services{ |s|
p s.service_name
p s.display_name
}
That will segfault after about 14 entries for me. It appears to be a
problem with memcpy on line 658, but I couldn''t tell you why.
The interesting thing is that the more I use ''puts'', the less likely
this error is to occur. To show you what I mean, try this snippet:...
2023 Jun 12
1
[PATCH libnbd 2/2] generator: state machine: Be less verbose in debug messages
...pr " h, &next, blocked\n";
> pr " );\n";
> pr " if (get_next_state (h) != next) {\n";
> - pr " debug (h, \"transition: %%s -> %%s\",\n";
> - pr " \"%s\",\n" display_name;
> - pr " nbd_internal_state_short_string (next));\n";
> pr " set_next_state (h, next);\n";
> pr " }\n";
> pr " return r;\n";
> @@ -423,15 +420,6 @@ let
> pr " case %s:\n" (c...
2010 Jan 26
1
Why does UserSession.find return nil when using user_credentials = single_access_token?
...Authlogic::Session::Base
allow_http_basic_auth = true
params_key = ''user_credentials''
single_access_allowed_request_types = :all
end
class RegisteredUserSession < UserSession
end
class User < ActiveRecord::Base
set_table_name "users"
attr_accessible :display_name, :email, :password
acts_as_authentic do |c|
c.require_password_confirmation = false
end
class << self
def public_hash(obj)
{
:display_name => obj.display_name,
:email => obj.email,
:single_access_token => obj.single_access_token,...
2005 May 14
4
Problems with custom service and webrick
...39;'
prog += "-p #{port} -r #{root} -m #{home}"
full_path = path + prog
unless File.exists?(home + ''\webrick_daemon.rb'')
STDERR.puts "Error: webrick_daemon.rb not found in
#{home}. Exiting..."
exit!
end
service_name = ''WebrickSvc''
display_name = ''Webrick''
# Install the service
if OPTIONS[:install]
svc = Service.new
svc.create_service{ |s|
s.service_name = service_name
s.display_name = display_name
s.binary_path_name = ''c:\ruby\bin\ruby
c:\progra~1\rubyservices\webrick\webrick_...
2006 Mar 17
2
How do I use ''reply-to'' with Action Mailer
...eem to find it. I''m building a site and I want a way for one
user to contact another. Simple enough. The problem lies in the fact I
want the email to ''come from'' the user, and not from my system.
In my ActionMailer class if I do the following:
@from = "#{from_user.display_name} <notifier@mydomain.com>"
it works just fine. But I really want is:
@from = "#{from_user.display_name} <bob@bobsdomain.com>"
If I do that though, the email never gets delivered.
So I guess my question is can someone tell me how to make this work
correctly? Of if I can...
2006 Jun 16
0
Getting error on a group select
Hi,
I''m very new with Ruby and Rails. I have read Agile Web Development
with Rails and was trying to create a grouped selection list by
following his example on page 359.
My helper looks like this:
module LoginHelper
AssocOption = Struct.new(:code_name, :display_name)
class AssocType
attr_reader :type_name, :options
def initialize(name)
@type_name = name
@options = []
end
def <<(option)
@options << option
end
end
none = AssocType.new("NONE")
none << AssocOption.new("None", &...
2006 Jun 16
0
Getting an error on options_groups_from_collection_for_select
Hi,
I''m very new with Ruby and Rails. I have read Agile Web Development
with Rails and was trying to create a grouped selection list by
following his example on page 359.
My helper looks like this:
module LoginHelper
AssocOption = Struct.new(:code_name, :display_name)
class AssocType
attr_reader :type_name, :options
def initialize(name)
@type_name = name
@options = []
end
def <<(option)
@options << option
end
end
none = AssocType.new("NONE")
none << AssocOption.new("None", &...
2010 Oct 11
5
Object lost in memory/trashed?
...ark => comment }
- else
.comment{:class => cycle("odd", "even")}
= render :partial => "/comments/comment_content", :locals => {
:comment => comment}
## _comment_bookmark.html.haml
= image_tag "/images/iLight/icon.png"
== #{bookmark.user.display_name} lit this diagram
<small>(#{time_ago_in_words bookmark.created_at} ago)</small>
The problem happens in this last file, when calling
bookmark.user.display_name. It raises a Template error:
ActionView::TemplateError (You have a nil object when you didn''t expect
it!
You might hav...
2006 Apr 09
12
Validating two models from one form
...ce.new
@user.user_preference = @pref
end
def save
@user = User.create(params[:user])
@pref = UserPreference.create(params[:user_preference])
@user.user_preference = @pref
# Default display name to something nice
@user.user_preference.display_name = @user.username
User.transaction do
if @user.save and @user.user_preference.save
# do something useful
else
# breakpoint(''User not saved.'')
render(:action => ''index'')
end...
2007 Dec 05
5
Active Record, Migration, and Translation
Hi,
I think the columns and table in migration should be able to have an
optional "display_name" set manually. Something like:
create_table :people, {display_name => "Personne"} do |t|
t.column :first_name :string, :display_name => "Prénom".
end
Let me explain my point of view:
Rails is a framework made to write programs in English. You see it when
you a...
2006 Aug 03
3
HELP: multiple select list in ror
...lect several. My params with 2 menus selected looks like
this:
Parameters: {"commit"=>"Create", "action"=>"create",
"controller"=>"menu_sections", "menu_section"=>{"name"=>"test Menu",
"display_name"=>"", "position"=>"56"}, "menu_select"=>"1"}
I know there must be something simple wrong but I can''t see what. Why
isn''t the menu_select an array of id''s?
Thanks
ps anybody got a nice acts_as_multiple_sel...
2012 Oct 15
1
[PATCH for discussion] lib: update inspect_list_applications to return app_arch
Here's a partially implemented fix for RHBZ#859949. Seeing as this is
my first libguestfs patch, I'd like some other eyeballs on it to make
sure I've not done anything completely crazy.
If the rpm case looks ok, I'll update the deb and windows cases
if/where applicable.
2023 Jun 12
3
[PATCH libnbd 0/2] Two simple patches
These patches aren't related to each other, but both are quite simple.
The second one requires particular attention - it's my experience that
printing out the state transitions in debug mode has never helped me
to diagnose a bug, but it has made the debug logs huge and hard to
follow. However that might just be me! Has it helped anyone else?
Also I'm open to the concept of debug
2006 Mar 17
1
Autocompleter.Local problem/desparate plea for help...
...margin:0;
padding:0;
}
</style>
<div id="auto_complete" style="display: none;"></div>
<script type="text/javascript" language="javascript" charset="utf-8">
opts = new Array(<%= @tags.sort_by{|t| t.display_name}.collect!{|t1| ''"'' +
t1.display_name + ''",''} -%>'''');
// <![CDATA[
box = new Autocompleter.Local(''article_keywords'',''auto_complete'', opts
, { tokens: new Array('' '','...
2006 Jul 07
5
link_to: link is missing id
...1,
"article_type"=>"...", "flashline"=>nil, "publication"=>"...",
"base_doc_id"=>"...", "summary"=>"...", "file_location"=>"C",
"page"=>"...", "display_name"=>"...",
"rev_doc_id"=>"...", "article_id"=>329901.0, "section"=>"...",
"source"=>"...", "to_be_purged"=>1.0}>
>> article.id
=> nil
>>
2009 May 19
1
re-sending outstanding controller refactoring patches after rebase
I've rebased the patch series to the current next branch and am sending them again.
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
...mp;next_state, blocked);\n" state_enum;
- pr " if (h->state != next_state) {\n";
+ pr " if (get_state (h) != next_state) {\n";
pr " debug (h, \"transition: %%s -> %%s\",\n";
pr " \"%s\",\n" display_name;
pr " nbd_internal_state_short_string (next_state));\n";
- pr " h->state = next_state;\n";
+ pr " set_state (h, next_state);\n";
pr " }\n";
pr " return r;\n";
pr "}\n";
@@ -2434,7...
2019 Jun 05
0
[PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
..._state, blocked);\n" state_enum;
- pr " if (get_state (h) != next_state) {\n";
+ pr " if (get_next_state (h) != next_state) {\n";
pr " debug (h, \"transition: %%s -> %%s\",\n";
pr " \"%s\",\n" display_name;
pr " nbd_internal_state_short_string (next_state));\n";
- pr " set_state (h, next_state);\n";
+ pr " set_next_state (h, next_state);\n";
pr " }\n";
pr " return r;\n";
pr "}\n";
@@ -2...