我正在使用一个名为(smsin,smsout和smsparts)的三个表的工具(UltraSms)
我需要在具有其他表的相同Rails应用程序中使用这些表.使用ActiveRecrod,我知道表名必须是按惯例的多个Active记录类名.有没有办法轻松地将它们映射到ActiveRecrod类,还是应该找到手动方式为它做ORM?
谢谢,
谭
我从销售模板的网站为我的网站使用HTML模板,因为我不是设计师,并且想要做好准备,我使用Rails进行开发.我注意到一些网站通过使用CSS和页面中组件的绝对定位将其模板设计为"无表格".我实际上习惯在我的页面中使用表格.
你对此有什么看法?不使用表有真正的好处吗?
我正在设计一个需要从短文中提取人名的应用程序.
最好的方法是什么?是否有一个名称数据库,我可以测试,知道名称在哪里?虽然文本很短,但在处理需求方面可能不那么密集.
有任何想法吗?
谢谢,
谭
我有两个表:
我想从用户表中选择所有值,但我想显示特定用户的状态(例如id = 2),而其他用户保持为NULL。例如:如果我有用户:
? first_name last_name
------------------------
1 John Smith
2 Tom Summers
3 Amy Wilson
Run Code Online (Sandbox Code Playgroud)
在网络中:
user_id friend_id status
------------------------------
2 1 friends
Run Code Online (Sandbox Code Playgroud)
我想搜索所有其他用户的John Smith,所以我想得到:
id first_name last_name status
------------------------------------
2 Tom Summers friends
3 Amy Wilson NULL
Run Code Online (Sandbox Code Playgroud)
我尝试先执行LEFT JOIN,然后执行WHERE语句,但是它不起作用,因为它排除了与其他用户(而非该用户)有关系的行。
我可以使用UNION语句来执行此操作,但是我想知道如果没有UNION的话是否有可能做到这一点。
我暂时购买并安装了Flash Builder 4.相同的代码给我编译时错误,并建议使用mx1而不是mx!如果我使它成为mx1,编译错误就会消失.这是我的组件的顶部:
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
Run Code Online (Sandbox Code Playgroud)
我没有提到mx1.
尝试使用delayed_job对作业进行排队,如下所示:
Delayed::Job.enqueue(BackgroundProcess.new(current_user, object))
Run Code Online (Sandbox Code Playgroud)
打印出来时,current_user和object不是nil.奇怪的是,有时刷新页面或再次运行命令有效!
这是异常跟踪:
Delayed::Backend::ActiveRecord::Job Columns (44.8ms) SHOW FIELDS FROM `delayed_jobs`
TypeError (wrong argument type nil (expected Data)):
/Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml.rb:391:in `emit'
/Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml.rb:391:in `quick_emit'
/Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml/rubytypes.rb:86:in `to_yaml'
vendor/plugins/delayed_job/lib/delayed/backend/base.rb:65:in `payload_object='
activerecord (2.3.9) lib/active_record/base.rb:2918:in `block in assign_attributes'
activerecord (2.3.9) lib/active_record/base.rb:2914:in `each'
activerecord (2.3.9) lib/active_record/base.rb:2914:in `assign_attributes'
activerecord (2.3.9) lib/active_record/base.rb:2787:in `attributes='
activerecord (2.3.9) lib/active_record/base.rb:2477:in `initialize'
activerecord (2.3.9) lib/active_record/base.rb:725:in `new'
activerecord (2.3.9) lib/active_record/base.rb:725:in `create'
vendor/plugins/delayed_job/lib/delayed/backend/base.rb:21:in `enqueue'
Run Code Online (Sandbox Code Playgroud) 我在我的Rails应用程序中使用PaperClip插件,如下所示:
has_attached_file :photo, :styles => {:small => '64X64>', :medium => '250X250>'},
:url => "/assets/user_photos/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/user_photos/:id/:style/:basename.:extension"
# validates_attachment_presence :photo
validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png','image/gif']
validates_attachment_size :photo, :less_than => 1.megabytes
Run Code Online (Sandbox Code Playgroud)
它在开发上运行良好(Mac OSX + Mongrel).但是当我把它投入生产时(Linux Debian + Apache/Passenger)它只接受.gif并且我得到以下错误:.png和.jpg:
Photo /tmp/stream20091028-20066-1t1a0oz-0 is not recognized by the 'identify' command.
Photo /tmp/stream20091028-20066-1t1a0oz-0 is not recognized by the 'identify' command.
Run Code Online (Sandbox Code Playgroud)
我尝试添加以下行作为一些教程建议,但它没有帮助!
Paperclip.options[:command_path] = "/usr/local/bin"
Run Code Online (Sandbox Code Playgroud) 我有一个ICEFaces我们申请.一个页面有两个bean,它们在页面上显示不同的内容.
我希望能够在另一个bean更改bean上的内容时通知一个bean,以便第一个bean更新其在页面上的内容.
在ICEFaces有可能吗?如果是这样的话?
谢谢,
谭
我为用户提供了创建项目的能力.创建项目对话框,例如:
<s:Panel id="postitNoteCreatePanel"
horizontalCenter="0" verticalCenter="0"
...
Run Code Online (Sandbox Code Playgroud)
如何使面板可拖动,以便用户可以在页面上移动它,以便它不会阻止其他项目
我正在使用ActionMailer来实现我的Rails 2.3.9应用程序.
当我发送电子邮件时使用:
deliver_user_invite
Run Code Online (Sandbox Code Playgroud)
配置:
def user_invite(subject, content)
subject subject
from "User Invite <invite@mydomain.com>"
recipients "invites@mydomain.com"
sent_on Time.now
content_type "text/html"
body :content => content
end
Run Code Online (Sandbox Code Playgroud)
使用SMTP配置
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'mydomain.com',
:authentication => :plain,
:user_name => 'user@mydomain.com',
:password => 'password'
}
Run Code Online (Sandbox Code Playgroud)
但是,当发送电子邮件时,发件人电子邮件显示为user@mydomain.com而不是invite@mydomain.com.
我可以为不同的电子邮件地址配置不同的SMTP吗?或者有没有办法从ActionMailer配置中设置发件人电子邮件地址?
apache-flex ×2
actionmailer ×1
activerecord ×1
css ×1
delayed-job ×1
html ×1
html-table ×1
icefaces ×1
jsf ×1
namespaces ×1
panel ×1
paperclip ×1
passenger ×1
sql ×1
string ×1