Adding rails part #2

This commit is contained in:
magnolia-fan
2011-04-03 20:21:05 +04:00
parent 6571a3ae0a
commit ede7fc1cb5
58 changed files with 10715 additions and 1 deletions
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
@@ -0,0 +1,5 @@
class ArtistController < ApplicationController
def view
@artist = Artists.getByName(params[:name])
end
end
+2
View File
@@ -0,0 +1,2 @@
module ApplicationHelper
end
+2
View File
@@ -0,0 +1,2 @@
module ArtistHelper
end
+6
View File
@@ -0,0 +1,6 @@
class Artists < ActiveRecord::Base
set_table_name 'musicbrainz.bh_artist'
def self.getByName(name)
Artists.first(:conditions => ['name = ? AND id=credit_id', name], :order => 'rating DESC')
end
end
+6
View File
@@ -0,0 +1,6 @@
class ReleaseGroups < ActiveRecord::Base
set_table_name 'musicbrainz.bh_release_group'
def self.getArtistAlbums(artist_id)
ReleaseGroups.all(:conditions => ['artist_id = ? AND type=1', artist_id], :order => 'year ASC, id ASC')
end
end
+1
View File
@@ -0,0 +1 @@
<h1><%= @artist.name %></h1>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Beathaven</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>