This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= f.label :foo %> | |
<%= f.text_area :foo %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= f.fields_for :images do |image_field| %> | |
<% if image_field.object.new_record? %> | |
<%= render 'image_fields', :f => builder %> | |
<% end %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response = RestClient.get 'http://localhost:3000/wallet_attributes', { :Authorization => "Token token=abc", :params => {:id => 50, 'foo' => 'bar'} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SuggestionController < ApplicationController | |
def vote | |
end | |
def get | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% provide(:title, "Create course") %> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-4"> | |
<div class="custom-form chapter"> | |
<%= form_for(@course) do |f| %> | |
<%= render 'shared/error_messages', object: f.object %> | |
<%= f.label :title %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BooksController < ApplicationController | |
before_filter :authenticate_user! | |
def index | |
@books = current_user.books | |
end | |
def new | |
@book = Book.new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddPriceToProduct < ActiveRecord::Migration | |
def self.up | |
add_column :products, :price, :decimal, | |
:precision => 8, :scale => 2, :default => 0 | |
end | |
def self.down | |
remove_column :products, :price | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## /users/edit.html.erb | |
<% form_for [:cp, @user], :url => { :action => 'update', :id => @user.id } do |f| %> | |
... | |
<%= collection_select :users, :show_id, Show.find(:all), :id, :name, { :prompt => true } %> | |
## users_controller.rb | |
@user.shows << Show.find(params[:users][:show_id]) | |
## error | |
ActiveRecord::AssociationTypeMismatch in Cp/usersController#update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userJson = { | |
student: {} | |
} | |
if discharge_date | |
userJson["student"].merge(discharge_date: value) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventController < ApplicationController | |
def edit | |
event | |
end | |
private | |
def event | |
@event ||= Event.find(params[:id]) | |
end |
OlderNewer