在实例化扩展Laravel的Eloquent Model类的模型类之后,有没有办法确定属性/属性是否映射到表,因此可以保存到表中?
例如,我有一个announcements包含列的表id,text以及"created_by".
我怎么知道created_by属性,如果设置将被保存?
$announcement = new Announcement();
Run Code Online (Sandbox Code Playgroud)
isset($announcement->created_by)如果我还没有明确设置该值,则可以理解地返回false.我已经尝试了从Eloquent模型类继承的各种函数,但到目前为止还没有工作.我正在寻找类似的东西:
$announcement->doesThisMapToMyTable('created_by')无论是否$announcement->created_by已设置,都返回true .
我正在本地开发环境中建立我的第二个"狂欢"商店,使用Spree gem for RubyOnRails处理电子商务项目.
第一个商店工作,但当我关闭store1的"rails服务器"并尝试为store2启动它时,当我去http://localhost:3000我得到这个错误:
Sprockets :: Rails :: Helper :: Spree :: Home #index中的AbsoluteAssetPathError
显示/Users/pivot/.rvm/gems/ruby-2.0.0-p481/gems/spree_frontend-2.3.2/app/views/spree/shared/_head.html.erb第7行引发:
传递给帮助者的资产名称不应包含"/ assets /"前缀.而不是"/assets/favicon.ico",请使用"favicon.ico"
提取的来源(第7行):
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1" name="viewport">
<%== meta_data_tags %>
<%= canonical_tag(current_store.url) %>
<%= favicon_link_tag image_path('favicon.ico') %> #THIS IS THE HIGHLIGHTED LINE
<%= stylesheet_link_tag 'spree/frontend/all', :media => 'screen' %>
<%= csrf_meta_tags %>
<%= javascript_include_tag 'spree/frontend/all' %>
Run Code Online (Sandbox Code Playgroud)
模板包含的跟踪:/Users/pivot/.rvm/gems/ruby-2.0.0-p481/gems/spree_frontend-2.3.2/app/views/spree/layouts/spree_application.html.erb
这个错误来自一个狂欢视图文件,而有问题的行实际上只是传入"favicon.ico"而不是"assets/favicon.ico",所以我不知道发生了什么.