我正在建立一个非常简单的应用程序与骨干,我收到一个错误.
Uncaught TypeError: undefined is not a function example_app.js:7
ExampleApp.initialize example_app.js:7
(anonymous function)
Run Code Online (Sandbox Code Playgroud)
这是Chrome Inspector(init文件 - example_app.js)中出现错误的地方:
var ExampleApp = {
Models: {},
Collections: {},
Views: {},
Routers: {},
initialize: function() {
var tasks = new ExampleApp.Collections.Tasks(data.tasks);
new ExampleApp.Routers.Tasks({ tasks: tasks });
Backbone.history.start();
}
};
Run Code Online (Sandbox Code Playgroud)
这是我的任务index.haml文件
- content_for :javascript do
- javascript_tag do
ExampleApp.initialize({ tasks: #{raw @tasks.to_json} });
= yield :javascript
Run Code Online (Sandbox Code Playgroud)
models/task.js
var Task = Backbone.Model.extend({});
Run Code Online (Sandbox Code Playgroud)
collections/tasks.js
var Tasks = Backbone.Collection.extend({
model: Task,
url: '/tasks'
});
Run Code Online (Sandbox Code Playgroud)
routers/tasks.js
ExampleApp.Routers.Tasks = Backbone.Router.extend({ …Run Code Online (Sandbox Code Playgroud) Errors running test:units! #<RuntimeError: Command failed with status (1): [ruby -I"lib:test" -I"/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib" "/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib/rake/rake_test_loader.rb" "test/unit/**/*_test.rb" ]>
这是否意味着我的单元测试文件有什么东西,或者我的模型有什么东西?或者它可能是?
完整跟踪下面.
[app:]$ rake test --trace
** Invoke test (first_time)
** Execute test
** Invoke test:run (first_time)
** Execute test:run
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** …Run Code Online (Sandbox Code Playgroud) 之前我曾经使用过paperclip和AWS,但我刚创建了这个Rails 4应用程序,我的image.url方法正在显示在' http://s3.amazonaws.com/ '上查找图像,当它应该是他们来自's3-us-west-2.amazonaws.com'.我假设这是因为第一个帐户的区域是美国标准,而新的帐户是俄勒冈州.
我有什么方法可以更改配置文件中的区域或其他东西?
我正在使用 mui 创建一个自定义主题,如下所示:
export default createMuiTheme({
breakpoints: {
keys: [
"xxs",
"xs",
"sm",
"md",
"lg",
"xl",
],
values: {
xxs: 0,
xs: 414, // iPhone X and below in portrait mode
sm: 600,
md: 960,
lg: 1280,
xl: 1920,
},
},
})
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在类声明中使用它时:
const styles = theme => ({
root: {
[theme.breakpoints.down('xxs')]: {
textAlign: "center",
padding: theme.spacing.unit * 2,
},
},
})
Run Code Online (Sandbox Code Playgroud)
我得到以下 CSS:
@media (max-width:NaNpx) {
.root-3 {
padding: 16px;
text-align: center;
}
}
Run Code Online (Sandbox Code Playgroud)
与仅修改现有断点相比,是否有一种特殊的方法可以添加自定义断点?
我对 Rails 很陌生,所以可能有一个简单的答案。我正在尝试将“user_category”列添加到我的“users”表中,该列指的是“user_categories”表。我尝试了以下方法:
rails generate migration add_user_category_to_users user_category:integer
Run Code Online (Sandbox Code Playgroud)
进而...
rails generate scaffold User_Category title:string description:text
Run Code Online (Sandbox Code Playgroud)
但是在 rake db:migrate 我收到以下错误:
== CreateUserCategories: migrating ===========================================
-- create_table(:user_categories)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "user_categories" already exists: CREATE TABLE "user_categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "description" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。
activerecord ×1
amazon-s3 ×1
backbone.js ×1
database ×1
javascript ×1
material-ui ×1
paperclip ×1
rake ×1
reactjs ×1
testing ×1
unit-testing ×1