在渲染时执行jQuery脚本

时间:2017-07-27 22:09:01

标签: javascript jquery ruby-on-rails

我想在我的rails控制器中渲染动作时执行jQuery脚本。

更准确地说,我在用户控制器中有这个功能......

type Channel {
  id: ID!
  name: String!
}

type Mutation {
  setActiveVideos(input: SetActiveVideosInput!): SetActiveVideosPayload
}

type Query {
  activeVideos: [Video]!
}

input SetActiveVideosInput {
  ids: [ID]!
  clientMutationId: String!
}

type SetActiveVideosPayload {
  clientMutationId: String!
}

type Video {
  id: ID!
  active: Boolean!
  details: VideoDetails
  statsByAge(seconds: Int!): [VideoStats]!
}

type VideoDetails {
  title: String!
  description: String!
  thumbnailURL: String!
  publishedAt: String!
  channel: Channel!
}

type VideoStats {
  videoID: ID!
  recordedAt: String!
  views: String!
  likes: String!
  dislikes: String!
  favorites: String!
  comments: String!
}

...我想在我的def create @user = User.new(user_params) if @user.save # Successful save else render action: "new", layout: "signup" end end 文件中为特定元素添加一个类。我需要在渲染时才这样做,因为我不想事先将添加到

我该怎么做?

0 个答案:

没有答案