railstar 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/railstar/active_record_ext.rb +39 -0
- data/lib/railstar/search_base.rb +92 -0
- data/lib/railstar/version.rb +1 -1
- data/lib/railstar.rb +4 -0
- data/test/dummy/app/controllers/projects_controller.rb +2 -1
- data/test/dummy/app/controllers/tasks_controller.rb +32 -54
- data/test/dummy/app/models/search/project.rb +14 -0
- data/test/dummy/app/models/search/task.rb +18 -0
- data/test/dummy/app/views/general/index.html.erb +2 -1
- data/test/dummy/app/views/projects/index.html.erb +10 -5
- data/test/dummy/app/views/tasks/_detail.html.erb +8 -0
- data/test/dummy/app/views/tasks/_form.html.erb +14 -26
- data/test/dummy/app/views/tasks/confirm.html.erb +9 -0
- data/test/dummy/app/views/tasks/destroy.html.erb +12 -0
- data/test/dummy/app/views/tasks/edit.html.erb +6 -4
- data/test/dummy/app/views/tasks/index.html.erb +35 -21
- data/test/dummy/app/views/tasks/new.html.erb +5 -3
- data/test/dummy/app/views/tasks/show.html.erb +6 -18
- data/test/dummy/config/routes.rb +3 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120305073308_create_tasks.rb +2 -1
- data/test/dummy/db/schema.rb +2 -1
- data/test/dummy/db/seeds.rb +4 -0
- data/test/dummy/log/development.log +8918 -0
- data/test/dummy/resources/code/status.csv +6 -0
- data/test/dummy/resources/db/projects.yml +11 -0
- data/test/dummy/resources/db/tasks.yml +34 -0
- metadata +27 -7
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Railstar
|
|
3
|
+
module ActiveRecordExt
|
|
4
|
+
module ClassMethods
|
|
5
|
+
def truncation
|
|
6
|
+
return if self.count > 0
|
|
7
|
+
self.truncation!
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def truncation!
|
|
11
|
+
table_name = self.to_s.underscore.pluralize
|
|
12
|
+
file_name = "#{table_name}.yml"
|
|
13
|
+
file_path = File.join(Rails.root, "resources", "db", file_name)
|
|
14
|
+
raise "#{file_path} file not found." unless File.exist?(file_path)
|
|
15
|
+
self.transaction do
|
|
16
|
+
case self.connection.adapter_name
|
|
17
|
+
when "SQLite"
|
|
18
|
+
self.connection.execute("DELETE FROM `#{self.table_name}`")
|
|
19
|
+
else
|
|
20
|
+
self.connection.execute("TRUNCATE TABLE `#{self.table_name}`")
|
|
21
|
+
end
|
|
22
|
+
YAML.load_file(file_path).each do |key, value|
|
|
23
|
+
self.create value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
module InstanceMethods
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.included(base)
|
|
33
|
+
base.extend ClassMethods
|
|
34
|
+
base.class_eval do
|
|
35
|
+
include InstanceMethods
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
module Railstar
|
|
3
|
+
class SearchBase
|
|
4
|
+
attr_accessor :where, :values
|
|
5
|
+
|
|
6
|
+
def initialize(hash)
|
|
7
|
+
self.where = []
|
|
8
|
+
self.values = {}
|
|
9
|
+
if hash
|
|
10
|
+
hash.each do |k,v|
|
|
11
|
+
send("#{k}=", v)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def to_params
|
|
17
|
+
ret = {}
|
|
18
|
+
TARGET_COLUMN.each do |c|
|
|
19
|
+
unless eval(c.to_s).blank?
|
|
20
|
+
ret[c] = eval(c.to_s)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
return ret
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def to_str_params
|
|
27
|
+
ret = to_params.map do |k,v|
|
|
28
|
+
begin
|
|
29
|
+
"#{k}=#{CGI.escape(v)}"
|
|
30
|
+
rescue
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
ret.join("&")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def base
|
|
37
|
+
create_conditions #TODO: 毎回条件作成をしないようにしたい
|
|
38
|
+
target_model.where([self.where.join(" AND "), values])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
def like(method, options={})
|
|
43
|
+
value = eval(method.to_s)
|
|
44
|
+
unless value.blank?
|
|
45
|
+
column = options[:column] || method
|
|
46
|
+
self.where << "#{with_table_name(options[:table_name],column)} like :#{method}"
|
|
47
|
+
self.values[method] = "%#{value}%"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def eq(method, options={})
|
|
52
|
+
compare(method, "=", options)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def inc(method, options={})
|
|
56
|
+
value = eval(method.to_s)
|
|
57
|
+
value = value.split(",") if value.is_a?(String) && value.include?(",")
|
|
58
|
+
unless value.blank?
|
|
59
|
+
column = options[:column] || method
|
|
60
|
+
self.where << "#{with_table_name(options[:table_name],column)} in (:#{method})"
|
|
61
|
+
self.values[method] = value
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def compare(method, sign, options={})
|
|
66
|
+
return unless sign =~ /^[<>=]{1,2}$/
|
|
67
|
+
value = eval(method.to_s)
|
|
68
|
+
unless value.blank?
|
|
69
|
+
column = options[:column] || method
|
|
70
|
+
self.where << "#{with_table_name(options[:table_name],column)} #{sign} :#{method}"
|
|
71
|
+
self.values[method] = value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def bit(method, options={})
|
|
76
|
+
value = eval(method.to_s)
|
|
77
|
+
unless value.blank?
|
|
78
|
+
column = options[:column] || method
|
|
79
|
+
self.where << "#{with_table_name(options[:table_name],column)} & :#{method} = :#{method}"
|
|
80
|
+
self.values[method] = value
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def with_table_name table_name, method
|
|
86
|
+
ret = ""
|
|
87
|
+
ret << "#{table_name || target_model.table_name}." if table_name
|
|
88
|
+
ret << method.to_s
|
|
89
|
+
ret
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
data/lib/railstar/version.rb
CHANGED
data/lib/railstar.rb
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
require 'railstar/engine'
|
|
2
2
|
require 'railstar/code_holder'
|
|
3
|
+
require 'railstar/search_base'
|
|
4
|
+
|
|
3
5
|
require 'railstar/helper'
|
|
4
6
|
ActionView::Base.send(:include, Railstar::Helper)
|
|
7
|
+
require 'railstar/active_record_ext'
|
|
8
|
+
ActiveRecord::Base.send(:include, Railstar::ActiveRecordExt)
|
|
5
9
|
|
|
6
10
|
module Railstar
|
|
7
11
|
def self.env
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
class ProjectsController < ApplicationController
|
|
7
7
|
def index
|
|
8
|
-
@
|
|
8
|
+
@search = Search::Project.new(params[:search])
|
|
9
|
+
@projects = @search.base.joins("inner join tasks on tasks.project_id = projects.id").order("created_at desc").group("projects.id").all
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def show
|
|
@@ -1,83 +1,61 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# destroyメソッドに注意。モバイル対応&テキストリンク利用のためイレギュラーなことをしている
|
|
3
|
+
# restに対応した形を徹底したい場合は、削除確認ページへのリンクを以下の様に、formにする
|
|
4
|
+
# <%= form_tag(Task_path(task, :mode => "draft"), :method=>:delete) do %><%= submit_tag "delete", :name => "delete" %><% end %>
|
|
5
|
+
|
|
1
6
|
class TasksController < ApplicationController
|
|
2
|
-
# GET /tasks
|
|
3
|
-
# GET /tasks.json
|
|
4
7
|
def index
|
|
5
|
-
@
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
format.html # index.html.erb
|
|
9
|
-
format.json { render json: @tasks }
|
|
10
|
-
end
|
|
8
|
+
@search = Search::Task.new(params[:search])
|
|
9
|
+
@search.project_id = params[:project_id]
|
|
10
|
+
@tasks = @search.base.order("created_at desc").all
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
# GET /tasks/1
|
|
14
|
-
# GET /tasks/1.json
|
|
15
13
|
def show
|
|
16
14
|
@task = Task.find(params[:id])
|
|
17
|
-
|
|
18
|
-
respond_to do |format|
|
|
19
|
-
format.html # show.html.erb
|
|
20
|
-
format.json { render json: @task }
|
|
21
|
-
end
|
|
15
|
+
render "destroy" if params[:mode] == "draft"
|
|
22
16
|
end
|
|
23
17
|
|
|
24
|
-
# GET /tasks/new
|
|
25
|
-
# GET /tasks/new.json
|
|
26
18
|
def new
|
|
27
|
-
@task = Task.new
|
|
28
|
-
|
|
29
|
-
respond_to do |format|
|
|
30
|
-
format.html # new.html.erb
|
|
31
|
-
format.json { render json: @task }
|
|
32
|
-
end
|
|
19
|
+
@task = Task.new(params[:task])
|
|
33
20
|
end
|
|
34
21
|
|
|
35
|
-
# GET /tasks/1/edit
|
|
36
22
|
def edit
|
|
37
23
|
@task = Task.find(params[:id])
|
|
38
24
|
end
|
|
39
25
|
|
|
40
|
-
# POST /tasks
|
|
41
|
-
# POST /tasks.json
|
|
42
26
|
def create
|
|
43
27
|
@task = Task.new(params[:task])
|
|
44
|
-
|
|
45
|
-
respond_to do |format|
|
|
46
|
-
if @task.save
|
|
47
|
-
format.html { redirect_to @task, notice: 'Task was successfully created.' }
|
|
48
|
-
format.json { render json: @task, status: :created, location: @task }
|
|
49
|
-
else
|
|
50
|
-
format.html { render action: "new" }
|
|
51
|
-
format.json { render json: @task.errors, status: :unprocessable_entity }
|
|
52
|
-
end
|
|
53
|
-
end
|
|
28
|
+
save
|
|
54
29
|
end
|
|
55
30
|
|
|
56
|
-
# PUT /tasks/1
|
|
57
|
-
# PUT /tasks/1.json
|
|
58
31
|
def update
|
|
59
32
|
@task = Task.find(params[:id])
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if @task.update_attributes(params[:task])
|
|
63
|
-
format.html { redirect_to @task, notice: 'Task was successfully updated.' }
|
|
64
|
-
format.json { head :no_content }
|
|
65
|
-
else
|
|
66
|
-
format.html { render action: "edit" }
|
|
67
|
-
format.json { render json: @task.errors, status: :unprocessable_entity }
|
|
68
|
-
end
|
|
69
|
-
end
|
|
33
|
+
@task.attributes = params[:task]
|
|
34
|
+
save
|
|
70
35
|
end
|
|
71
36
|
|
|
72
|
-
# DELETE /tasks/1
|
|
73
|
-
# DELETE /tasks/1.json
|
|
74
37
|
def destroy
|
|
75
38
|
@task = Task.find(params[:id])
|
|
76
|
-
|
|
39
|
+
if params.key?("back")
|
|
40
|
+
redirect_to(task_url)
|
|
41
|
+
elsif params[:mode] != "draft"
|
|
42
|
+
@task.destroy
|
|
43
|
+
redirect_to(task_url, :notice => "deleted success.")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
77
46
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
def save
|
|
50
|
+
if !params.key?("back") && @task.valid?
|
|
51
|
+
if params[:mode] == "draft"
|
|
52
|
+
render :action => 'confirm'
|
|
53
|
+
else
|
|
54
|
+
@task.save!
|
|
55
|
+
redirect_to task_path(@task), :notice => 'saved success.'
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
render (@task.new_record? ? :new : :edit)
|
|
81
59
|
end
|
|
82
60
|
end
|
|
83
61
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class Search::Project < Railstar::SearchBase
|
|
2
|
+
TARGET_COLUMN = %w(name like_name)
|
|
3
|
+
attr_accessor *TARGET_COLUMN
|
|
4
|
+
|
|
5
|
+
private
|
|
6
|
+
def create_conditions
|
|
7
|
+
eq(:name)
|
|
8
|
+
like(:like_name, column: :name, table_name: "tasks")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def target_model
|
|
12
|
+
::Project
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class Search::Task < Railstar::SearchBase
|
|
2
|
+
TARGET_COLUMN = %w(name like_name status project_id from_price to_price)
|
|
3
|
+
attr_accessor *TARGET_COLUMN
|
|
4
|
+
|
|
5
|
+
private
|
|
6
|
+
def create_conditions
|
|
7
|
+
eq(:project_id)
|
|
8
|
+
eq(:name)
|
|
9
|
+
like(:like_name, column: :name)
|
|
10
|
+
inc(:status)
|
|
11
|
+
compare(:from_price, ">=", column: :price)
|
|
12
|
+
compare(:to_price, "<=", column: :price)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def target_model
|
|
16
|
+
::Task
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
<%= link_to "Railstar", railstar.root_path
|
|
1
|
+
<%= link_to "Railstar", railstar.root_path %><br />
|
|
2
|
+
<%= link_to "TestProject", projects_path %><br />
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
<h1>Listing projects</h1>
|
|
2
2
|
|
|
3
|
+
<%= form_tag(nil, :method => :get) do %>
|
|
4
|
+
<%= label :search, :name %>:<%= text_field :search, :name %><br />
|
|
5
|
+
<%= label :search, :like_name %>:<%= text_field :search, :like_name %><br />
|
|
6
|
+
<%= submit_tag :search %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
3
9
|
<table>
|
|
4
10
|
<thead>
|
|
5
11
|
<tr>
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
<th>Name</th>
|
|
13
|
+
<th></th>
|
|
8
14
|
<th></th>
|
|
9
15
|
<th></th>
|
|
10
16
|
</tr>
|
|
@@ -14,9 +20,8 @@
|
|
|
14
20
|
<tbody>
|
|
15
21
|
<% @projects.each do |project| %>
|
|
16
22
|
<tr>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<td><%= link_to 'Show', project %></td>
|
|
23
|
+
<td><%= link_to project.name, project_tasks_path(:project_id => project.id) %></td>
|
|
24
|
+
<td><%= link_to 'Show', project %></td>
|
|
20
25
|
<td><%= link_to 'Edit', edit_project_path(project) %></td>
|
|
21
26
|
<td><%= link_to 'Delete', project_path(project, :mode => "draft") %></td>
|
|
22
27
|
</tr>
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
<%= form_for(@task) do |f| %>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<%= form_for(@task, :url => save_action(@task, :mode => "draft")) do |f| %>
|
|
2
|
+
<% if @task.errors.any? %>
|
|
3
|
+
<% @task.errors.full_messages.each do |msg| %>
|
|
4
|
+
<p><%= msg %></p>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<% end %>
|
|
9
|
+
<table class="bordered-table zebra-striped">
|
|
10
|
+
<tr>
|
|
11
|
+
<th><%= f.label :name %></th>
|
|
12
|
+
<td><%= f.text_field :name %></td>
|
|
13
|
+
</tr>
|
|
14
|
+
</table>
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
<%= f.label :name %><br />
|
|
16
|
-
<%= f.text_field :name %>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="field">
|
|
19
|
-
<%= f.label :project_id %><br />
|
|
20
|
-
<%= f.number_field :project_id %>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="field">
|
|
23
|
-
<%= f.label :status %><br />
|
|
24
|
-
<%= f.number_field :status %>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="actions">
|
|
27
|
-
<%= f.submit %>
|
|
28
|
-
</div>
|
|
16
|
+
<%= f.submit :class => "btn primary" %>
|
|
29
17
|
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<h1>Confirm task</h1>
|
|
2
|
+
|
|
3
|
+
<%= render :partial => 'detail' %>
|
|
4
|
+
|
|
5
|
+
<%= form_tag({}, :method => request.request_method) do %>
|
|
6
|
+
<%= raw params_to_hidden_tag :task %>
|
|
7
|
+
<input type="submit" value="戻る" name="back" class="btn" />
|
|
8
|
+
<input type="submit" value="保存" class="btn primary" />
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h1>Destroy task</h1>
|
|
2
|
+
|
|
3
|
+
<%= render :partial => 'detail' %>
|
|
4
|
+
|
|
5
|
+
<%= form_tag({}, :method => "delete") do -%>
|
|
6
|
+
<input type="submit" value="Cancel" name="back" class="btn" />
|
|
7
|
+
<input type="submit" value="Destroy" class="btn error" />
|
|
8
|
+
<% end -%>
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<%= link_to 'Back', tasks_path, :class => "btn" %>
|
|
12
|
+
</div>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
<h1>Editing
|
|
1
|
+
<h1>Editing project</h1>
|
|
2
2
|
|
|
3
|
-
<%= render 'form' %>
|
|
3
|
+
<%= render :partial => 'form' %>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<%= link_to '
|
|
5
|
+
<div>
|
|
6
|
+
<%= link_to 'Show', project_path(@project), :class => "btn" %>
|
|
7
|
+
<%= link_to 'Back', projects_path, :class => "btn" %>
|
|
8
|
+
</div>
|
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
<h1>Listing tasks</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<th></th>
|
|
11
|
-
</tr>
|
|
3
|
+
<%= form_tag(nil, :method => :get) do %>
|
|
4
|
+
<%= label :search, :name %><%= text_field :search, :name %><br />
|
|
5
|
+
<%= label :search, :like_name %><%= text_field :search, :like_name %><br />
|
|
6
|
+
<% C.status.to_opt.each do |status| %>
|
|
7
|
+
<%= label :search, "status_#{status.first}" %><%= check_box_tag "search[status][]", status.last, !!@search.status ? @search.status.detect{|s| s == status.last} : false %>
|
|
8
|
+
<% end %><br />
|
|
9
|
+
<%= label :search, :price %><%= text_field :search, :from_price %><%= text_field :search, :to_price %><br />
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
<tr>
|
|
15
|
-
<td><%= task.name %></td>
|
|
16
|
-
<td><%= task.project_id %></td>
|
|
17
|
-
<td><%= task.status %></td>
|
|
18
|
-
<td><%= link_to 'Show', task %></td>
|
|
19
|
-
<td><%= link_to 'Edit', edit_task_path(task) %></td>
|
|
20
|
-
<td><%= link_to 'Destroy', task, confirm: 'Are you sure?', method: :delete %></td>
|
|
21
|
-
</tr>
|
|
11
|
+
<%= submit_tag :search %>
|
|
22
12
|
<% end %>
|
|
23
|
-
</table>
|
|
24
13
|
|
|
25
|
-
<
|
|
14
|
+
<table>
|
|
15
|
+
<thead>
|
|
16
|
+
<tr>
|
|
17
|
+
<th>Name</th>
|
|
18
|
+
<th>Status</th>
|
|
19
|
+
<th>Price</th>
|
|
20
|
+
<th></th>
|
|
21
|
+
<th></th>
|
|
22
|
+
<th></th>
|
|
23
|
+
</tr>
|
|
24
|
+
</thead>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<tbody>
|
|
28
|
+
<% @tasks.each do |task| %>
|
|
29
|
+
<tr>
|
|
30
|
+
<td><%= task.name %></td>
|
|
31
|
+
<td><%= C.status[task.status].name %></td>
|
|
32
|
+
<td><%= task.price %></td>
|
|
33
|
+
<td><%= link_to 'Show', project_task_path(:id => task.id) %></td>
|
|
34
|
+
<td><%#= link_to 'Edit', edit_task_path(task) %></td>
|
|
35
|
+
<td><%#= link_to 'Delete', task_path(task, :mode => "draft") %></td>
|
|
36
|
+
</tr>
|
|
37
|
+
<% end %>
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
26
40
|
|
|
27
|
-
<%= link_to 'New Task',
|
|
41
|
+
<%= link_to 'New Task', new_project_task_path %>
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
<
|
|
1
|
+
<h1>Showing project</h1>
|
|
2
|
+
<%= render :partial => 'detail' %>
|
|
2
3
|
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<%=
|
|
6
|
-
</
|
|
4
|
+
<div>
|
|
5
|
+
<%= link_to 'Edit', edit_project_path(@project), :class => "btn" %>
|
|
6
|
+
<%= link_to 'Back', projects_path, :class => "btn" %>
|
|
7
|
+
</div>
|
|
7
8
|
|
|
8
|
-
<p>
|
|
9
|
-
<b>Project:</b>
|
|
10
|
-
<%= @task.project_id %>
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
<p>
|
|
14
|
-
<b>Status:</b>
|
|
15
|
-
<%= @task.status %>
|
|
16
|
-
</p>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<%= link_to 'Edit', edit_task_path(@task) %> |
|
|
20
|
-
<%= link_to 'Back', tasks_path %>
|
data/test/dummy/config/routes.rb
CHANGED
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
|
@@ -22,7 +22,8 @@ ActiveRecord::Schema.define(:version => 20120306035929) do
|
|
|
22
22
|
create_table "tasks", :force => true do |t|
|
|
23
23
|
t.string "name"
|
|
24
24
|
t.integer "project_id"
|
|
25
|
-
t.
|
|
25
|
+
t.string "status"
|
|
26
|
+
t.integer "price"
|
|
26
27
|
t.datetime "created_at", :null => false
|
|
27
28
|
t.datetime "updated_at", :null => false
|
|
28
29
|
end
|