How do you handle single table inheritance in SimpleForm so a single helper handles all models?
Specify :url=> networking_event_session_path
in the simple_form_for
.
Something like this:
<%= simple_form_form @session, :url => networking_event_session_path %>
How to show more attributes in each element of the collection with collection_select
As stated in the discussion, you needed to declare a method in your model's rb file like this:
def custom_name
"#{style.name}. #{date}"
end
And change the :style_name
parameter to :custom_name
How to show select menu for two models?
I think better way to do is to use polymorphic association.
class Price
belongs_to :pricable, polymorphic: true
end
class Product
has_one :price, as: :priceable
end
class Service
has_one :price, as: :priceable
end
Then, in your form, you can use: <%= form_for [@priceable, Price.new]
where @priceable is a product or a service. Using blank? or present? in model-scopes in Ruby on Rails
Try
scope :myScope1, where("myField IS NULL or CAST(myField as text) = ''")
It's not that simple as blank?
, but I can't see a simple enough solution.
Related Topics
Can Sunspot Search Inside Array
Case Insensitive Search in Rails
How to Add Values Dynamically to I18N
Understanding The Behaviour of Inject Used with a Lambda in Ruby
Ruby/Rails Audio Conversion Plugins
How to Get Nokogiri to Parse and Return an Xml Document
Ruby Datamapper Table Inheritance with Associations
Using Elasticsearch to Filter Through Tags with Whitespace
How to Make Devise Registrationscontroller to Show Sign_Up Page Only If User Is Already Signed In
Heroku Repo Size and Slug Size Increase with Each Deployment. Why
Rails 3. Sort by Associated Model
What Is The Ruby Equivalent to This Curl Request
List Array of Days Between Two Dates
Rails How to Tell If a Sidekiq Worker Is Done with Perform_Async